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

174 lines
3.7 KiB

  1. <template>
  2. <view>
  3. <swiper
  4. class="swiper"
  5. :current="current"
  6. :autoplay="true"
  7. @change="onChange"
  8. >
  9. <swiper-item v-for="item in list" :key="item.id">
  10. <view class="swiper-item">
  11. <view class="swiper-item-content">
  12. <image class="bg" :src="item.url" mode="aspectFill"></image>
  13. <view class="content">
  14. <view class="flex flex-column">
  15. <view
  16. v-for="(line, lIdx) in item.arr"
  17. :key="lIdx"
  18. :class="line.class"
  19. >
  20. {{ line.text }}
  21. </view>
  22. </view>
  23. <view class="btns">
  24. <button class="btn btn-left flex" @click="$utils.navigateTo(item.btns[0].path)">
  25. {{ item.btns[0].text }}
  26. </button>
  27. <button class="btn btn-right flex" @click="$utils.navigateTo(item.btns[1].path)">
  28. {{ item.btns[1].text }}
  29. </button>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </swiper-item>
  35. </swiper>
  36. <indicator :current="current" :length="list.length" @click="current = $event"></indicator>
  37. </view>
  38. </template>
  39. <script>
  40. import indicator from '@/components/home/indicator.vue'
  41. export default {
  42. components: {
  43. indicator,
  44. },
  45. props: {
  46. list: {
  47. type: Array,
  48. default() {
  49. return []
  50. }
  51. }
  52. },
  53. data() {
  54. return {
  55. current: 0,
  56. }
  57. },
  58. onLoad() {
  59. },
  60. methods: {
  61. onChange(e) {
  62. this.current = e.detail.current
  63. }
  64. },
  65. }
  66. </script>
  67. <style scoped lang="scss">
  68. .swiper {
  69. width: 100vw;
  70. height: calc(100vw * 578 / 375);
  71. &-item {
  72. width: 100%;
  73. height: 100%;
  74. padding: 10rpx 32rpx 40rpx 32rpx;
  75. box-sizing: border-box;
  76. &-content {
  77. position: relative;
  78. width: 100%;
  79. height: 100%;
  80. border-radius: 64rpx;
  81. box-shadow: -5rpx -5rpx 10rpx 0 #FFFFFF,
  82. 10rpx 10rpx 20rpx 0 #AAAACC80,
  83. 4rpx 4rpx 10rpx 0 #AAAACC40,
  84. -2rpx -2rpx 5rpx 0 #FFFFFF;
  85. }
  86. .bg {
  87. width: 100%;
  88. height: 100%;
  89. border-radius: 64rpx;
  90. }
  91. .content {
  92. position: absolute;
  93. bottom: 0;
  94. width: 100%;
  95. height: 592rpx;
  96. padding: 170rpx 60rpx 80rpx 60rpx;
  97. box-sizing: border-box;
  98. background-image: linear-gradient(#FFFFFF00, #FFFFFF);
  99. border-radius: 64rpx;
  100. }
  101. .font1 {
  102. font-size: 48rpx;
  103. font-weight: 600;
  104. line-height: 1.4;
  105. font-family: PingFang SC;
  106. color: #252545;
  107. }
  108. .font2 {
  109. font-size: 48rpx;
  110. font-weight: 600;
  111. line-height: 1.4;
  112. font-family: PingFang SC;
  113. color: transparent;
  114. background-image: linear-gradient(to right, #4B348F, #845CFA);
  115. background-clip: text;
  116. display: inline-block;
  117. }
  118. .font3 {
  119. font-size: 32rpx;
  120. font-weight: 400;
  121. line-height: 1.4;
  122. font-family: PingFang SC;
  123. color: #252545;
  124. }
  125. .btns {
  126. margin-top: 72rpx;
  127. display: flex;
  128. justify-content: space-between;
  129. .btn {
  130. width: 264rpx;
  131. box-sizing: border-box;
  132. font-size: 30rpx;
  133. font-family: PingFang SC;
  134. line-height: 1.4;
  135. border-radius: 45rpx;
  136. &-left {
  137. padding: 23rpx 0;
  138. font-weight: 400;
  139. color: #252545;
  140. border: 1rpx solid #252545;
  141. }
  142. &-right {
  143. padding: 24rpx 0;
  144. font-weight: 600;
  145. color: #FFFFFF;
  146. background-image: linear-gradient(to right, #4B348F, #845CFA);
  147. }
  148. }
  149. }
  150. }
  151. }
  152. </style>