吉光研途前端代码仓库
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.

226 lines
5.5 KiB

1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
  1. <template>
  2. <view class="page__view">
  3. <view class="bg">
  4. <image class="img" :src="configList.config_image_page_header" mode="scaleToFill"></image>
  5. </view>
  6. <!-- 搜索栏 -->
  7. <view class="search">
  8. <uv-search v-model="keyword" placeholder="输入关键词搜索" bgColor="#FBFBFB" @custom="search" @search="search">
  9. <template #prefix>
  10. <image class="search-icon" src="@/static/image/icon-search.png" mode="widthFix"></image>
  11. </template>
  12. </uv-search>
  13. </view>
  14. <!-- 轮播图 -->
  15. <view class="swiper">
  16. <uv-swiper :list="bannerList" keyName="image" indicator indicatorMode="dot" indicatorActiveColor="#4883F9" indicatorInactiveColor="#FFFFFF" :height="swiperHeight"></uv-swiper>
  17. </view>
  18. <view class="flex filter">
  19. <view class="filter-item">
  20. <suspendDropdown v-model="queryParams.categoryServiceId" label="服务分类筛选" :options="serviceOptions" @change="onFilterChange"></suspendDropdown>
  21. </view>
  22. <view class="filter-item">
  23. <suspendDropdown v-model="queryParams.categoryMajorId" label="专业筛选" :options="majorOptions" @change="onFilterChange"></suspendDropdown>
  24. </view>
  25. <view class="filter-item">
  26. <suspendDropdown v-model="queryParams.categoryPeriodId" label="阶段筛选" :options="periodOptions" @change="onFilterChange"></suspendDropdown>
  27. </view>
  28. </view>
  29. <view class="list">
  30. <template v-if="total">
  31. <view class="list-item" v-for="item in list" :key="item.id" @click="jumpToDetail(item.id)">
  32. <image class="img" :src="item.image" mode="aspectFill"></image>
  33. </view>
  34. </template>
  35. <template v-else>
  36. <view class="flex empty">
  37. <image class="empty-icon" src="@/static/image/icon-empty.png" mode="widthFix"></image>
  38. </view>
  39. </template>
  40. </view>
  41. <tabber select="case" />
  42. </view>
  43. </template>
  44. <script>
  45. import mixinsList from '@/mixins/list.js'
  46. import tabber from '@/components/base/tabbar.vue'
  47. import suspendDropdown from '@/components/base/suspendDropdown.vue'
  48. export default {
  49. mixins: [mixinsList],
  50. components: {
  51. tabber,
  52. suspendDropdown,
  53. },
  54. data() {
  55. return {
  56. keyword: '',
  57. bannerList: [],
  58. serviceOptions: [],
  59. majorOptions: [],
  60. periodOptions: [],
  61. list: [],
  62. queryParams: {
  63. pageNo: 1,
  64. pageSize: 10,
  65. title: '',
  66. categoryServiceId: '',
  67. categoryMajorId: '',
  68. categoryPeriodId: '',
  69. },
  70. mixinsListApi: 'queryAriticleList',
  71. swiperHeight: '239rpx',
  72. }
  73. },
  74. onLoad() {
  75. const windowWidth = uni.getSystemInfoSync().windowWidth
  76. this.swiperHeight = `${(windowWidth - 18) * 239 / 714}px`
  77. this.fetchBanner()
  78. this.fetchOptions()
  79. this.getData()
  80. },
  81. methods: {
  82. search() {
  83. this.queryParams.pageNo = 1
  84. this.queryParams.pageSize = 10
  85. this.queryParams.title = this.keyword
  86. this.getData()
  87. },
  88. onFilterChange() {
  89. this.queryParams.pageNo = 1
  90. this.queryParams.pageSize = 10
  91. this.getData()
  92. },
  93. // 获取轮播图
  94. async fetchBanner() {
  95. try {
  96. this.bannerList = (await this.$fetch('queryBannerList', { type: '1' }))?.records // type:0-首页 1-案例 2-服务 3-其他
  97. } catch (err) {
  98. }
  99. },
  100. async fetchOptions() {
  101. this.$fetch('queryCategoryServiceList').then(res => {
  102. this.serviceOptions = res?.records?.map(item => ({ label: item.title, value: item.id })) || []
  103. }).catch(err => {
  104. })
  105. this.$fetch('queryCategoryMajorList').then(res => {
  106. this.majorOptions = res?.records?.map(item => ({ label: item.title, value: item.id })) || []
  107. }).catch(err => {
  108. })
  109. this.$fetch('queryCategoryPeriodList').then(res => {
  110. this.periodOptions = res?.records?.map(item => ({ label: item.title, value: item.id })) || []
  111. }).catch(err => {
  112. })
  113. },
  114. jumpToDetail(articleId) {
  115. uni.navigateTo({
  116. url: `/pages_order/case/index?articleId=${articleId}`
  117. })
  118. },
  119. }
  120. }
  121. </script>
  122. <style scoped lang="scss">
  123. .page__view {
  124. padding-bottom: 182rpx;
  125. }
  126. .bg {
  127. width: 100%;
  128. height: 264rpx;
  129. .img {
  130. width: 100%;
  131. height: 100%;
  132. }
  133. }
  134. .search {
  135. margin: 0 18rpx;
  136. width: calc(100% - 20rpx * 2);
  137. background-color: #FFFFFF;
  138. border-radius: 37rpx;
  139. padding: 13rpx 0 13rpx 18rpx;
  140. box-sizing: border-box;
  141. display: flex;
  142. align-items: center;
  143. /deep/ .uv-search__action {
  144. color: $uni-color;
  145. padding: 10rpx 18rpx;
  146. }
  147. &-icon {
  148. width: 26rpx;
  149. height: auto;
  150. }
  151. }
  152. .swiper {
  153. margin: 29rpx 18rpx 0 18rpx;
  154. border-radius: 25rpx 25rpx 0 0;
  155. overflow: hidden;
  156. /deep/ .uv-swiper-indicator__wrapper__dot {
  157. width: 15rpx;
  158. height: 15rpx;
  159. }
  160. /deep/ .uv-swiper-indicator__wrapper__dot--active {
  161. width: 15rpx;
  162. }
  163. }
  164. .filter {
  165. column-gap: 33rpx;
  166. padding: 0 23rpx;
  167. background: #FFFFFF;
  168. &-item {
  169. flex: 1;
  170. }
  171. }
  172. .list {
  173. padding: 34rpx 0;
  174. &-item {
  175. $width: calc(100vw - 37rpx * 2);
  176. margin: 0 37rpx;
  177. width: $width;
  178. // height: 284rpx;
  179. height: calc(#{$width} * 284 / 677);
  180. border-radius: 15rpx;
  181. overflow: hidden;
  182. & + & {
  183. margin-top: 25rpx;
  184. }
  185. .img {
  186. width: 100%;
  187. height: 100%;
  188. }
  189. }
  190. }
  191. .empty {
  192. margin-top: 65rpx;
  193. }
  194. </style>