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

163 lines
3.6 KiB

  1. <template>
  2. <view>
  3. <swiper
  4. class="swiper"
  5. :current="current"
  6. :autoplay="true"
  7. :display-multiple-items="1.5"
  8. @change="onChange"
  9. >
  10. <swiper-item v-for="item in list" :key="item.id" style="display: inline-block;">
  11. <view class="swiper-item">
  12. <view class="swiper-item-content">
  13. <image class="img" :src="item.url" mode="widthFix"></image>
  14. <view class="content">
  15. <view>
  16. <view
  17. v-for="(line, lIdx) in item.arr"
  18. :key="lIdx"
  19. :class="line.class"
  20. >
  21. {{ line.text }}
  22. </view>
  23. </view>
  24. <button class="btn flex" @click="$utils.navigateTo(item.btns[0].path)">
  25. <image class="btn-icon" src="@/pages_order/static/index/btn-icon.png" mode="widthFix"></image>
  26. <text>{{ item.btn.text }}</text>
  27. </button>
  28. </view>
  29. </view>
  30. </view>
  31. </swiper-item>
  32. <swiper-item style="display: inline-block;">
  33. <view class="swiper-item"></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: 320rpx;
  71. padding-left: 22rpx;
  72. &-item {
  73. width: 512rpx;
  74. height: 320rpx;
  75. padding: 24rpx 30rpx 40rpx 10rpx;
  76. box-sizing: border-box;
  77. &-content {
  78. position: relative;
  79. width: 100%;
  80. height: 100%;
  81. padding: 12rpx;
  82. box-sizing: border-box;
  83. border-radius: 32rpx;
  84. background-image: linear-gradient(#FAFAFF, #F3F3F3);
  85. box-shadow: -5rpx -5rpx 10rpx 0 #FFFFFF,
  86. 10rpx 10rpx 20rpx 0 #AAAACC80,
  87. 4rpx 4rpx 10rpx 0 #AAAACC40,
  88. -2rpx -2rpx 5rpx 0 #FFFFFF;
  89. .img {
  90. position: absolute;
  91. right: 24rpx;
  92. bottom: 24rpx;
  93. width: 200rpx;
  94. height: auto;
  95. }
  96. .content {
  97. position: absolute;
  98. left: 0;
  99. top: 0;
  100. width: 100%;
  101. height: 100%;
  102. padding: 24rpx;
  103. box-sizing: border-box;
  104. .font1 {
  105. font-size: 30rpx;
  106. font-weight: 600;
  107. line-height: 1.4;
  108. font-family: PingFang SC;
  109. color: #252545;
  110. }
  111. .font2 {
  112. font-size: 26rpx;
  113. font-weight: 400;
  114. line-height: 1.4;
  115. font-family: PingFang SC;
  116. color: #989898;
  117. }
  118. .font3 {
  119. font-size: 24rpx;
  120. font-weight: 400;
  121. line-height: 1.4;
  122. font-family: PingFang SC;
  123. color: #252545;
  124. }
  125. .btn {
  126. margin-top: 32rpx;
  127. display: inline-flex;
  128. padding: 14rpx 24rpx;
  129. font-size: 24rpx;
  130. font-family: PingFang SC;
  131. font-weight: 400;
  132. line-height: 1.4;
  133. color: #252545;
  134. border: 1rpx solid #252545;
  135. border-radius: 28rpx;
  136. &-icon {
  137. width: 28rpx;
  138. height: 28rpx;
  139. margin-right: 8rpx;
  140. }
  141. }
  142. }
  143. }
  144. }
  145. }
  146. </style>