search.vue 3.8 KB

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