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

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