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

201 lines
4.4 KiB

2 months ago
2 months ago
2 months ago
1 month ago
1 month ago
1 month 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="flex 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. search() {
  69. this.queryParams.pageNo = 1
  70. this.queryParams.pageSize = 10
  71. this.queryParams.title = this.keyword
  72. this.getData()
  73. },
  74. jumpToDetail(id) {
  75. let api
  76. let idKey
  77. let contentKey = 'details'
  78. switch(this.mixinsListApi) {
  79. case 'queryNewsList':
  80. api = 'queryNewsById',
  81. idKey = 'newsId'
  82. break
  83. case 'queryPolicyList':
  84. api = 'queryPolicyById',
  85. idKey = 'policyId'
  86. break
  87. case 'queryJournalList':
  88. api = 'queryJournalById',
  89. idKey = 'journalId'
  90. contentKey = 'content'
  91. break
  92. default:
  93. break
  94. }
  95. uni.navigateTo({
  96. url: `/pages_order/article/index?api=${api}&id=${id}&idKey=${idKey}&contentKey=${contentKey}`
  97. })
  98. },
  99. },
  100. }
  101. </script>
  102. <style scoped lang="scss">
  103. .page__view {
  104. background: linear-gradient(#DAF3FF, #FBFEFF 250rpx, #FBFEFF);
  105. }
  106. .search {
  107. $h: 64rpx;
  108. $radius: 32rpx;
  109. $borderWidth: 4rpx;
  110. margin: 24rpx 32rpx 0 32rpx;
  111. width: calc(100% - 32rpx * 2);
  112. height: $h;
  113. position: relative;
  114. border-radius: $radius;
  115. &-icon {
  116. margin: 0 13rpx 0 26rpx;
  117. width: 30rpx;
  118. height: auto;
  119. }
  120. /deep/ .uv-search__content {
  121. padding: 12rpx 0;
  122. background: #FFFFFF !important;
  123. border-color: #CFEFFF !important;
  124. border: 4rpx solid transparent;
  125. }
  126. &.is-focus {
  127. /deep/ .uv-search__action {
  128. padding: 19rpx 24rpx;
  129. font-size: 26rpx;
  130. font-weight: 500;
  131. line-height: 1;
  132. color: #FFFFFF;
  133. background: #00A9FF;
  134. border-radius: 32rpx;
  135. }
  136. }
  137. }
  138. .list {
  139. margin-top: 24rpx;
  140. padding: 12rpx 40rpx;
  141. &-item {
  142. align-items: flex-start;
  143. column-gap: 16rpx;
  144. padding: 24rpx;
  145. background: #F9F9F9;
  146. border: 2rpx solid #FFFFFF;
  147. border-radius: 24rpx;
  148. & + & {
  149. margin-top: 40rpx;
  150. }
  151. .cover {
  152. width: 152rpx;
  153. height: 152rpx;
  154. border-radius: 8rpx;
  155. overflow: hidden;
  156. border: 2rpx solid #E6E6E6;
  157. .img {
  158. width: 100%;
  159. height: 100%;
  160. }
  161. }
  162. .info {
  163. flex: 1;
  164. .title {
  165. font-size: 28rpx;
  166. font-weight: 500;
  167. color: #000000;
  168. }
  169. .desc {
  170. margin-top: 8rpx;
  171. font-size: 24rpx;
  172. color: #8B8B8B;
  173. }
  174. }
  175. }
  176. }
  177. </style>