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

164 lines
3.4 KiB

5 months ago
  1. <template>
  2. <view class="page__view highlight">
  3. <!-- 导航栏 -->
  4. <navbar :title="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 v-if="list.length" class="list">
  24. <view class="list-item" v-for="item in list" :key="item.id">
  25. <view class="cover">
  26. <image class="img" :src="item.image" mode="aspectFill"></image>
  27. </view>
  28. <view class="info">
  29. <view class="title text-ellipsis-2">{{ item.title }}</view>
  30. <view class="desc">{{ item.createTime }}</view>
  31. </view>
  32. </view>
  33. </view>
  34. <template v-else>
  35. <uv-empty mode="list"></uv-empty>
  36. </template>
  37. </view>
  38. </template>
  39. <script>
  40. import mixinsList from '@/mixins/list.js'
  41. import sortBar from './sortBar.vue'
  42. import recordsView from '@/components/growing/recordsView.vue'
  43. export default {
  44. mixins: [mixinsList],
  45. components: {
  46. sortBar,
  47. recordsView,
  48. },
  49. data() {
  50. return {
  51. title: '搜索',
  52. keyword: '',
  53. isFocusSearch: false,
  54. queryParams: {
  55. pageNo: 1,
  56. pageSize: 10,
  57. title: '',
  58. },
  59. // todo
  60. mixinsListApi: '',
  61. }
  62. },
  63. onLoad({ title, api }) {
  64. this.title = title
  65. this.mixinsListApi = api
  66. this.getData()
  67. },
  68. methods: {
  69. search() {
  70. this.queryParams.pageNo = 1
  71. this.queryParams.pageSize = 10
  72. this.queryParams.title = this.keyword
  73. this.getData()
  74. },
  75. },
  76. }
  77. </script>
  78. <style scoped lang="scss">
  79. .search {
  80. $h: 64rpx;
  81. $radius: 32rpx;
  82. $borderWidth: 4rpx;
  83. margin: 24rpx 32rpx 0 32rpx;
  84. width: calc(100% - 32rpx * 2);
  85. height: $h;
  86. position: relative;
  87. border-radius: $radius;
  88. &-icon {
  89. margin: 0 13rpx 0 26rpx;
  90. width: 30rpx;
  91. height: auto;
  92. }
  93. &.is-focus {
  94. /deep/ .uv-search__action {
  95. padding: 19rpx 24rpx;
  96. font-size: 26rpx;
  97. font-weight: 500;
  98. line-height: 1;
  99. color: #FFFFFF;
  100. background: #00A9FF;
  101. border-radius: 32rpx;
  102. }
  103. }
  104. }
  105. .list {
  106. margin-top: 24rpx;
  107. padding: 12rpx 40rpx;
  108. &-item {
  109. column-gap: 16rpx;
  110. & + & {
  111. margin-top: 40rpx;
  112. padding: 24rpx;
  113. background: #F9F9F9;
  114. border: 2rpx solid #FFFFFF;
  115. border-radius: 24rpx;
  116. }
  117. .cover {
  118. width: 152rpx;
  119. height: 152rpx;
  120. border-radius: 8rpx;
  121. overflow: hidden;
  122. border: 2rpx solid #E6E6E6;
  123. .img {
  124. width: 100%;
  125. height: 100%;
  126. }
  127. }
  128. .info {
  129. flex: 1;
  130. .title {
  131. font-size: 28rpx;
  132. font-weight: 500;
  133. color: #000000;
  134. }
  135. .desc {
  136. margin-top: 8rpx;
  137. font-size: 24rpx;
  138. color: #8B8B8B;
  139. }
  140. }
  141. }
  142. }
  143. </style>