普兆健康管家前端代码仓库
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.

196 lines
4.3 KiB

  1. <template>
  2. <view class="view">
  3. <view class="top">
  4. <view class="route">
  5. <image class="img" :src="configList.home_science_3" mode="widthFix"></image>
  6. </view>
  7. </view>
  8. <view class="bottom">
  9. <swiper
  10. class="swiper"
  11. :current="current"
  12. :autoplay="false"
  13. :display-multiple-items="2.5"
  14. @change="onChange"
  15. >
  16. <swiper-item v-for="(item, sIdx) in list" :key="item.id" style="display: inline-block;">
  17. <view class="swiper-item">
  18. <view class="swiper-item-content">
  19. <view class="card">
  20. <image class="img" :src="item.image" mode="heightFix"></image>
  21. <view class="title">{{ item.title }}</view>
  22. </view>
  23. <view class="desc ">
  24. <view>{{ `STEP ${sIdx + 1}` }}</view>
  25. <view class="text-ellipsis-2">{{ item.text }}</view>
  26. </view>
  27. </view>
  28. </view>
  29. </swiper-item>
  30. <swiper-item style="display: inline-block;">
  31. <view class="swiper-item"></view>
  32. </swiper-item>
  33. <swiper-item style="display: inline-block;">
  34. <view class="swiper-item"></view>
  35. </swiper-item>
  36. </swiper>
  37. <view class="flex">
  38. <view class="indicator flex">
  39. <view
  40. v-for="(item, index) in list"
  41. :key="index"
  42. :class="['indicator-dot', index === current ? 'is-active' : '']"
  43. @click="current = index"
  44. ></view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. import indicator from '@/components/home/indicator.vue'
  52. export default {
  53. components: {
  54. indicator,
  55. },
  56. data() {
  57. return {
  58. current: 0,
  59. list: [],
  60. }
  61. },
  62. created() {
  63. this.getData()
  64. },
  65. methods: {
  66. async getData() {
  67. try {
  68. this.list = await this.$fetch('getIntroduce')
  69. } catch (err) {
  70. }
  71. },
  72. onChange(e) {
  73. this.current = e.detail.current
  74. }
  75. },
  76. }
  77. </script>
  78. <style scoped lang="scss">
  79. .view {
  80. width: 100vw;
  81. }
  82. .top {
  83. width: 100%;
  84. padding: 80rpx 32rpx 30rpx 32rpx;
  85. box-sizing: border-box;
  86. .route {
  87. width: 100%;
  88. height: calc((100vw - 32rpx*2) * 314 / 343);
  89. border-radius: 64rpx;
  90. background-image: linear-gradient(#F3F3F3, #FAFAFF);
  91. box-shadow: -5rpx -5rpx 20rpx 0 #FFFFFF,
  92. 10rpx 10rpx 20rpx 0 #AAAACC80,
  93. 4rpx 4rpx 10rpx 0 #AAAACC40,
  94. -2rpx -2rpx 5rpx 0 #FFFFFF;
  95. .img {
  96. width: 100%;
  97. height: auto;
  98. }
  99. }
  100. }
  101. .bottom {
  102. width: 100%;
  103. }
  104. .swiper {
  105. width: 100%;
  106. height: 518rpx;
  107. padding-left: 22rpx;
  108. &-item {
  109. width: 310rpx;
  110. height: 518rpx;
  111. padding: 10rpx 30rpx 40rpx 10rpx;
  112. box-sizing: border-box;
  113. &-content {
  114. position: relative;
  115. width: 100%;
  116. height: 100%;
  117. box-sizing: border-box;
  118. .card {
  119. position: relative;
  120. width: 270rpx;
  121. height: 332rpx;
  122. border-radius: 32rpx;
  123. overflow: hidden;
  124. padding: 0;
  125. background-image: linear-gradient(45deg, #FAFAFF, #F3F3F3);
  126. box-shadow: -5rpx -5rpx 10rpx 0 #FFFFFF,
  127. 10rpx 10rpx 20rpx 0 #AAAACC80,
  128. 4rpx 4rpx 10rpx 0 #AAAACC40,
  129. -2rpx -2rpx 5rpx 0 #FFFFFF;
  130. .img {
  131. position: absolute;
  132. left: 0;
  133. bottom: 0;
  134. width: 100%;
  135. // height: auto;
  136. height: 224rpx;
  137. left: 50%;
  138. transform: translateX(-50%);
  139. }
  140. .title {
  141. position: absolute;
  142. top: 24rpx;
  143. width: 100%;
  144. text-align: center;
  145. font-weight: 200;
  146. font-size: 40rpx;
  147. line-height: 1.4;
  148. }
  149. }
  150. .desc {
  151. text-align: center;
  152. font-size: 24rpx;
  153. font-family: PingFang SC;
  154. font-weight: 300;
  155. line-height: 1.6;
  156. color: #252545;
  157. padding: 32rpx 0 40rpx 0;
  158. }
  159. }
  160. }
  161. }
  162. .indicator {
  163. display: inline-flex;
  164. width: auto;
  165. height: 12rpx;
  166. border-radius: 6rpx;
  167. background: #D9D9D9;
  168. &-dot {
  169. display: inline-block;
  170. width: 34rpx;
  171. height: 12rpx;
  172. border-radius: 6rpx;
  173. background: transparent;
  174. &.is-active {
  175. background-image: linear-gradient(to right, #4B348F, #845CFA);
  176. }
  177. }
  178. }
  179. </style>