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

189 lines
3.6 KiB

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="section swiper">
  8. <uv-swiper :list="bannerList" keyName="image" indicator indicatorMode="dot" indicatorActiveColor="#4883F9" indicatorInactiveColor="#FFFFFF" height="424rpx"></uv-swiper>
  9. </view>
  10. <view class="list">
  11. <view class="list-item"
  12. v-for="item in firstCategoryList"
  13. :key="item.id"
  14. @click="jumpToSecondCategory(item.id, item.title)"
  15. >
  16. <image class="list-item-bg" :src="item.image" mode="scaleToFill"></image>
  17. </view>
  18. </view>
  19. <tabber select="serve" />
  20. </view>
  21. </template>
  22. <script>
  23. import tabber from '@/components/base/tabbar.vue'
  24. export default {
  25. components: {
  26. tabber,
  27. },
  28. data() {
  29. return {
  30. bannerList: [],
  31. firstCategoryList: [],
  32. }
  33. },
  34. onLoad() {
  35. this.fetchBanner()
  36. this.getData()
  37. },
  38. methods: {
  39. // 获取轮播图
  40. async fetchBanner() {
  41. try {
  42. this.bannerList = (await this.$fetch('queryBannerList', { type: '2' }))?.records // type:0-首页 1-案例 2-服务 3-其他
  43. } catch (err) {
  44. }
  45. },
  46. async getData() {
  47. try {
  48. this.firstCategoryList = (await this.$fetch('queryCategoryServiceModuleList', { pageNo: 1, pageSize: 1000 }))?.records?.filter(item => item.hasChild == '1')
  49. } catch (err) {
  50. }
  51. },
  52. jumpToSecondCategory(pid, title) {
  53. uni.navigateTo({
  54. url: `/pages_order/serve/category?pid=${pid}&title=${title}`
  55. })
  56. },
  57. },
  58. }
  59. </script>
  60. <style scoped lang="scss">
  61. .bg {
  62. width: 100%;
  63. height: 264rpx;
  64. .img {
  65. width: 100%;
  66. height: 100%;
  67. }
  68. }
  69. .main {
  70. position: absolute;
  71. top: 0;
  72. left: 0;
  73. width: 100%;
  74. padding: 156rpx 0 182rpx 0;
  75. }
  76. .header {
  77. .title {
  78. margin-left: 25rpx;
  79. position: relative;
  80. padding: 51rpx 0 6rpx 42rpx;
  81. &-line {
  82. width: 151rpx;
  83. height: 11rpx;
  84. background: linear-gradient(76deg,#ffffff 2%, #4883f9 88%);
  85. border-radius: 6rpx;
  86. }
  87. &-text {
  88. position: absolute;
  89. top: 0;
  90. left: 0;
  91. font-size: 46rpx;
  92. font-weight: 700;
  93. color: #FFFFFF;
  94. }
  95. }
  96. .desc {
  97. font-size: 30rpx;
  98. font-weight: 700;
  99. color: #FFFFFF;
  100. margin: 14rpx 28rpx 32rpx 28rpx;
  101. }
  102. }
  103. .swiper {
  104. margin: 0 18rpx 15rpx 18rpx;
  105. border-radius: 25rpx;
  106. overflow: hidden;
  107. /deep/ .uv-swiper-indicator__wrapper__dot {
  108. width: 15rpx;
  109. height: 15rpx;
  110. }
  111. /deep/ .uv-swiper-indicator__wrapper__dot--active {
  112. width: 15rpx;
  113. }
  114. }
  115. .list {
  116. margin: 0 18rpx;
  117. &-item {
  118. position: relative;
  119. font-size: 0;
  120. border-radius: 25rpx;
  121. overflow: hidden;
  122. box-shadow: 0rpx 3rpx 6rpx 0rpx rgba(0,0,0,0.16);
  123. & + & {
  124. margin-top: 32rpx;
  125. }
  126. &-bg {
  127. $w: calc(100vw - 18rpx*2);
  128. width: $w;
  129. height: calc(#{$w} * 179 / 714);
  130. }
  131. &-fg {
  132. position: absolute;
  133. top: 38rpx;
  134. left: 51rpx;
  135. .title {
  136. font-size: 32rpx;
  137. font-weight: 700;
  138. color: #E67722;
  139. }
  140. .desc {
  141. margin-top: 2rpx;
  142. font-size: 28rpx;
  143. color: #BEA898;
  144. }
  145. }
  146. &:nth-child(2n) {
  147. .list-item-fg {
  148. left: 200rpx;
  149. .title {
  150. color: #052464;
  151. }
  152. .desc {
  153. color: #A8BADE;
  154. }
  155. }
  156. }
  157. }
  158. }
  159. </style>