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

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