鸿宇研学生前端代码
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.

173 lines
4.0 KiB

  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="list">
  26. <recordsView :list="list"></recordsView>
  27. </view>
  28. <template v-else>
  29. <uv-empty mode="list"></uv-empty>
  30. </template>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. import mixinsList from '@/mixins/list.js'
  36. import sortBar from './sortBar.vue'
  37. import recordsView from '@/components/growing/recordsView.vue'
  38. export default {
  39. mixins: [mixinsList],
  40. components: {
  41. sortBar,
  42. recordsView,
  43. },
  44. data() {
  45. return {
  46. keyword: '',
  47. isFocusSearch: false,
  48. queryParams: {
  49. pageNo: 1,
  50. pageSize: 10,
  51. title: '',
  52. sort: 'comprehensive',
  53. },
  54. // todo
  55. mixinsListApi: '',
  56. }
  57. },
  58. onLoad({ search }) {
  59. if (search) {
  60. this.keyword = search
  61. this.queryParams.title = search
  62. }
  63. this.getData()
  64. },
  65. methods: {
  66. // todo: delete
  67. getData() {
  68. this.list = [
  69. {
  70. id: '001',
  71. name: '新疆天山行7/9日丨醉美伊犁&吐鲁番双套餐',
  72. image: [
  73. '/pages_order/static/temp-38.png',
  74. '/pages_order/static/temp-38.png',
  75. '/pages_order/static/temp-38.png',
  76. ],
  77. createTime: '2025-07-12',
  78. },
  79. {
  80. id: '002',
  81. name: '仙踪新昌·韩妃江古道|邂逅“江南小桂林”',
  82. image: [
  83. '/pages_order/static/temp-38.png',
  84. '/pages_order/static/temp-38.png',
  85. '/pages_order/static/temp-38.png',
  86. ],
  87. createTime: '2025-06-18',
  88. },
  89. {
  90. id: '003',
  91. name: '山水石窟·大佛寺|江南佛窟造像,新昌山水轻徒',
  92. image: [
  93. '/pages_order/static/temp-38.png',
  94. '/pages_order/static/temp-38.png',
  95. '/pages_order/static/temp-38.png',
  96. ],
  97. createTime: '2025-06-15',
  98. },
  99. ]
  100. },
  101. search() {
  102. this.queryParams.pageNo = 1
  103. this.queryParams.pageSize = 10
  104. this.queryParams.title = this.keyword
  105. this.getData()
  106. },
  107. onSortChange(sort) {
  108. console.log('onSortChange', sort)
  109. },
  110. },
  111. }
  112. </script>
  113. <style scoped lang="scss">
  114. .search {
  115. $h: 64rpx;
  116. $radius: 32rpx;
  117. $borderWidth: 4rpx;
  118. margin: 24rpx 32rpx 0 32rpx;
  119. width: calc(100% - 32rpx * 2);
  120. height: $h;
  121. position: relative;
  122. border-radius: $radius;
  123. &-icon {
  124. margin: 0 13rpx 0 26rpx;
  125. width: 30rpx;
  126. height: auto;
  127. }
  128. /deep/ .uv-search__content {
  129. padding: 12rpx 0;
  130. background: #FFFFFF !important;
  131. border-color: #CFEFFF !important;
  132. border: 4rpx solid transparent;
  133. }
  134. &.is-focus {
  135. /deep/ .uv-search__action {
  136. padding: 19rpx 24rpx;
  137. font-size: 26rpx;
  138. font-weight: 500;
  139. line-height: 1;
  140. color: #FFFFFF;
  141. background: #00A9FF;
  142. border-radius: 32rpx;
  143. }
  144. }
  145. }
  146. .main {
  147. margin-top: 24rpx;
  148. padding: 0 32rpx 100rpx 32rpx;
  149. }
  150. .content {
  151. margin-top: 24rpx;
  152. display: grid;
  153. grid-template-columns: repeat(2, 1fr);
  154. gap: 16rpx;
  155. }
  156. </style>