鸿宇研学生前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

205 lines
4.8 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  1. <template>
  2. <view class="page__view">
  3. <!-- 导航栏 -->
  4. <navbar title="搜索结果" leftClick @leftClick="$utils.navigateBack" bgColor="transparent" color="#191919" />
  5. <!-- 搜索栏 -->
  6. <view :class="['flex', 'search', isFocusSearch ? 'is-focus' : '']" >
  7. <uv-search
  8. v-model="keyword"
  9. placeholder="输入关键词搜索"
  10. color="#181818"
  11. bgColor="transparent"
  12. :showAction="isFocusSearch"
  13. @custom="search"
  14. @search="search"
  15. @focus="isFocusSearch = true"
  16. @blur="isFocusSearch = false"
  17. >
  18. <template #prefix>
  19. <image class="search-icon" src="/static/image/icon-search-dark.png" mode="widthFix"></image>
  20. </template>
  21. </uv-search>
  22. </view>
  23. <view class="main">
  24. <sortBar v-model="queryParams.sort" @change="onSortChange"></sortBar>
  25. <view v-if="list.length" class="content">
  26. <view v-for="item in list" :key="item.id">
  27. <productCard
  28. :data="item"
  29. size="small"
  30. ></productCard>
  31. </view>
  32. </view>
  33. <template v-else>
  34. <uv-empty mode="list"></uv-empty>
  35. </template>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. import mixinsList from '@/mixins/list.js'
  41. import sortBar from '@/components/product/sortBar.vue'
  42. import productCard from '@/components/product/productCard.vue'
  43. export default {
  44. mixins: [mixinsList],
  45. components: {
  46. sortBar,
  47. productCard,
  48. },
  49. data() {
  50. return {
  51. keyword: '',
  52. isFocusSearch: false,
  53. queryParams: {
  54. pageNo: 1,
  55. pageSize: 10,
  56. title: '',
  57. // todo
  58. sort: 'comprehensive',
  59. },
  60. mixinsListApi: 'queryActivityList',
  61. }
  62. },
  63. onLoad({ search }) {
  64. if (search) {
  65. this.keyword = search
  66. this.queryParams.title = search
  67. }
  68. this.getData()
  69. },
  70. methods: {
  71. // todo: delete
  72. getData() {
  73. this.list = [
  74. {
  75. id: '001',
  76. image: '/static/image/temp-20.png',
  77. title: '新疆天山行7/9日丨醉美伊犁&吐鲁番双套餐',
  78. tagList: ['国内游','7-9天','12岁+'],
  79. priceDiscount: 688.99,
  80. priceOrigin: 1200,
  81. applyNum: 4168,
  82. },
  83. {
  84. id: '002',
  85. image: '/static/image/temp-20.png',
  86. title: '坝上双草原6日|乌兰布统+锡林郭勒+长城',
  87. tagList: ['国内游','7-9天','12岁+'],
  88. priceDiscount: 688.99,
  89. priceOrigin: 1200,
  90. applyNum: 4168,
  91. },
  92. {
  93. id: '003',
  94. image: '/static/image/temp-20.png',
  95. title: '牛湖线探秘 | 清远牛湖线徒步,探秘天坑与大草原',
  96. tagList: ['国内游','7-9天','12岁+'],
  97. priceDiscount: 688.99,
  98. priceOrigin: 1200,
  99. applyNum: 4168,
  100. },
  101. {
  102. id: '004',
  103. image: '/static/image/temp-20.png',
  104. title: '低海拔藏区草原,汉藏文化大穿越',
  105. tagList: ['国内游','7-9天','12岁+'],
  106. priceDiscount: 688.99,
  107. priceOrigin: 1200,
  108. applyNum: 4168,
  109. },
  110. {
  111. id: '005',
  112. image: '/static/image/temp-20.png',
  113. title: '新丝路到敦煌7日 | 甘青轻松穿越,沙漠+草原',
  114. tagList: ['国内游','7-9天','12岁+'],
  115. priceDiscount: 688.99,
  116. priceOrigin: 1200,
  117. applyNum: 4168,
  118. },
  119. {
  120. id: '006',
  121. image: '/static/image/temp-20.png',
  122. title: '呼伦贝尔6/8日|经典or环线双套餐可选',
  123. tagList: ['国内游','7-9天','12岁+'],
  124. priceDiscount: 688.99,
  125. priceOrigin: 1200,
  126. applyNum: 4168,
  127. },
  128. ]
  129. this.total = this.list.length
  130. },
  131. search() {
  132. this.queryParams.pageNo = 1
  133. this.queryParams.pageSize = 10
  134. this.queryParams.title = this.keyword
  135. this.getData()
  136. },
  137. onSortChange(sort) {
  138. console.log('onSortChange', sort)
  139. // todo set sort
  140. this.getData()
  141. },
  142. },
  143. }
  144. </script>
  145. <style scoped lang="scss">
  146. .search {
  147. $h: 64rpx;
  148. $radius: 32rpx;
  149. $borderWidth: 4rpx;
  150. margin: 24rpx 32rpx 0 32rpx;
  151. width: calc(100% - 32rpx * 2);
  152. height: $h;
  153. position: relative;
  154. border-radius: $radius;
  155. &-icon {
  156. margin: 0 13rpx 0 26rpx;
  157. width: 30rpx;
  158. height: auto;
  159. }
  160. /deep/ .uv-search__content {
  161. padding: 12rpx 0;
  162. background: #FFFFFF !important;
  163. border-color: #CFEFFF !important;
  164. border: 4rpx solid transparent;
  165. }
  166. &.is-focus {
  167. /deep/ .uv-search__action {
  168. padding: 19rpx 24rpx;
  169. font-size: 26rpx;
  170. font-weight: 500;
  171. line-height: 1;
  172. color: #FFFFFF;
  173. background: #00A9FF;
  174. border-radius: 32rpx;
  175. }
  176. }
  177. }
  178. .main {
  179. margin-top: 24rpx;
  180. padding: 0 32rpx 100rpx 32rpx;
  181. }
  182. .content {
  183. margin-top: 24rpx;
  184. display: grid;
  185. grid-template-columns: repeat(2, 1fr);
  186. gap: 16rpx;
  187. }
  188. </style>