search.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <template>
  2. <view class="search-index">
  3. <nav-bar title="搜索" @init="onInitNavbar"></nav-bar>
  4. <u-scroll-view>
  5. <view class="main-container">
  6. <u-search v-model="searchKeyword" placeholder="搜索展商 / 展品名称 / 会议" @search="onClickSearch"/>
  7. <view class="search-result-text">搜索结果</view>
  8. <template v-if="isEmpty">
  9. <van-empty description="暂无数据" />
  10. </template>
  11. <template v-else>
  12. <u-tabs :active.sync="tabActive" :tabs="tabs" tab-style="default" @change="tabChange"/>
  13. <view v-if="tabActive === 1" class="search-result-list exhibit-list">
  14. <template v-for="(item, index) in exhibitorList">
  15. <exhibitor-item :item="item" :key="index" />
  16. </template>
  17. </view>
  18. <view v-else-if="tabActive === 2" class="search-result-list exhibit-list">
  19. <template v-for="(item, index) in exhibitList">
  20. <exhibit-item :item="item" :key="index" />
  21. </template>
  22. </view>
  23. <view v-else-if="tabActive === 3" class="search-result-list exhibit-list">
  24. <template v-for="(item, index) in newsList">
  25. <news-item :item="item" :key="index" />
  26. </template>
  27. </view>
  28. <view v-else-if="tabActive === 4" class="search-result-list exhibit-list">
  29. <template v-for="(item, index) in activityList">
  30. <activity-item :item="item" :key="index" type="exhibitor" />
  31. </template>
  32. </view>
  33. <view v-else-if="tabActive === 5" class="search-result-list exhibit-list">
  34. <template v-for="(item, index) in activityList">
  35. <activity-item :item="item" :key="index" />
  36. </template>
  37. </view>
  38. </template>
  39. <disclaimer-text></disclaimer-text>
  40. </view>
  41. </u-scroll-view>
  42. </view>
  43. </template>
  44. <script>
  45. import NavBar from '@/components/layout/nav-bar'
  46. import UTabs from '@/components/common/u-tabs'
  47. import UScrollView from '@/components/common/u-scroll-view'
  48. import USearch from '@/components/common/u-search'
  49. import ExhibitItem from '@/pages/exhibitor/components/exhibit-item.vue'
  50. import ExhibitorItem from '@/pages/exhibitor/components/exhibitor-item.vue'
  51. import NewsItem from '@/pages/news/components/news-item.vue'
  52. import ActivityItem from '@/pages/activity/components/activity-item.vue'
  53. import DisclaimerText from '@/components/disclaimer-text/index.vue'
  54. export default {
  55. options: {
  56. styleIsolation: 'shared'
  57. },
  58. components: {
  59. NavBar,
  60. UScrollView,
  61. UTabs,
  62. USearch,
  63. ExhibitItem,
  64. ExhibitorItem,
  65. NewsItem,
  66. ActivityItem,
  67. DisclaimerText
  68. },
  69. data() {
  70. return {
  71. searchKeyword: '',
  72. tabActive: 1,
  73. isEmpty: false,
  74. tabs: [{
  75. label: '展商',
  76. value: 1
  77. }, {
  78. label: '展品',
  79. value: 2
  80. }, {
  81. label: '展商新闻',
  82. value: 3
  83. }, {
  84. label: '展商活动',
  85. value: 4
  86. }, {
  87. label: '同期活动',
  88. value: 5
  89. }],
  90. exhibitorList: [{ favourited: true }, { liked: true }, { voted: true }, {}],
  91. exhibitList: [{ favourited: true }, { liked: true }, { voted: true }],
  92. newsList: [{}, {}, {}, {}],
  93. activityList: [{ favourited: true }, {}, {}, {}, {}]
  94. }
  95. },
  96. onLoad(options) {
  97. console.log('options')
  98. console.log(options.query)
  99. this.searchKeyword = options.query
  100. },
  101. created() {},
  102. methods: {
  103. tabChange() {
  104. },
  105. onClickSearch() {
  106. }
  107. }
  108. }
  109. </script>
  110. <style lang="scss">
  111. .search-result-text{
  112. margin: 33rpx 0;
  113. display: block;
  114. font-size: $fontSize3;
  115. color: #000000;
  116. }
  117. .search-result-list{
  118. display: grid;
  119. grid-template-columns: 1fr;
  120. grid-row-gap: 28rpx;
  121. margin-top: 32rpx;
  122. }
  123. </style>