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

193 lines
4.1 KiB

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 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 class="list">
  24. <template v-if="total">
  25. <view class="list-item" v-for="item in list" :key="item.id" @click="jumpToDetail(item.id)">
  26. <view class="cover">
  27. <image class="img" :src="item.image" mode="aspectFill"></image>
  28. </view>
  29. <view class="info">
  30. <view class="title">{{ item.title }}</view>
  31. <view class="desc">{{ item.createTime }}</view>
  32. </view>
  33. </view>
  34. </template>
  35. <template v-else>
  36. <uv-empty mode="list"></uv-empty>
  37. </template>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. import mixinsList from '@/mixins/list.js'
  43. import recordsView from '@/components/growing/recordsView.vue'
  44. export default {
  45. mixins: [mixinsList],
  46. components: {
  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. mixinsListApi: '',
  60. }
  61. },
  62. onLoad({ title, api }) {
  63. this.title = title
  64. this.mixinsListApi = api
  65. this.getData()
  66. },
  67. methods: {
  68. // todo: delete
  69. getData() {
  70. },
  71. search() {
  72. this.queryParams.pageNo = 1
  73. this.queryParams.pageSize = 10
  74. this.queryParams.title = this.keyword
  75. this.getData()
  76. },
  77. jumpToDetail(id) {
  78. let api
  79. let idKey
  80. switch(this.mixinsListApi) {
  81. case 'queryNewsList':
  82. api = 'queryNewsById',
  83. idKey = 'newsId'
  84. break
  85. case 'queryPolicyList':
  86. api = 'queryPolicyById',
  87. idKey = 'policyId'
  88. break
  89. default:
  90. break
  91. }
  92. uni.navigateTo({
  93. url: `/pages_order/article/index?api=${api}&id=${id}&idKey=${idKey}`
  94. })
  95. },
  96. },
  97. }
  98. </script>
  99. <style scoped lang="scss">
  100. .search {
  101. $h: 64rpx;
  102. $radius: 32rpx;
  103. $borderWidth: 4rpx;
  104. margin: 24rpx 32rpx 0 32rpx;
  105. width: calc(100% - 32rpx * 2);
  106. height: $h;
  107. position: relative;
  108. border-radius: $radius;
  109. &-icon {
  110. margin: 0 13rpx 0 26rpx;
  111. width: 30rpx;
  112. height: auto;
  113. }
  114. /deep/ .uv-search__content {
  115. padding: 12rpx 0;
  116. background: #FFFFFF !important;
  117. border-color: #CFEFFF !important;
  118. border: 4rpx solid transparent;
  119. }
  120. &.is-focus {
  121. /deep/ .uv-search__action {
  122. padding: 19rpx 24rpx;
  123. font-size: 26rpx;
  124. font-weight: 500;
  125. line-height: 1;
  126. color: #FFFFFF;
  127. background: #00A9FF;
  128. border-radius: 32rpx;
  129. }
  130. }
  131. }
  132. .list {
  133. margin-top: 24rpx;
  134. padding: 12rpx 40rpx;
  135. &-item {
  136. column-gap: 16rpx;
  137. & + & {
  138. margin-top: 40rpx;
  139. padding: 24rpx;
  140. background: #F9F9F9;
  141. border: 2rpx solid #FFFFFF;
  142. border-radius: 24rpx;
  143. }
  144. .cover {
  145. width: 152rpx;
  146. height: 152rpx;
  147. border-radius: 8rpx;
  148. overflow: hidden;
  149. border: 2rpx solid #E6E6E6;
  150. .img {
  151. width: 100%;
  152. height: 100%;
  153. }
  154. }
  155. .info {
  156. flex: 1;
  157. .title {
  158. font-size: 28rpx;
  159. font-weight: 500;
  160. color: #000000;
  161. }
  162. .desc {
  163. margin-top: 8rpx;
  164. font-size: 24rpx;
  165. color: #8B8B8B;
  166. }
  167. }
  168. }
  169. }
  170. </style>