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

197 lines
4.3 KiB

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