search.vue 3.4 KB

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