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

191 lines
4.0 KiB

  1. <template>
  2. <view class="product-swiper__view">
  3. <swiper
  4. class="swiper"
  5. :current="current"
  6. :autoplay="autoplay"
  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.imageUrl" 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="jumpToProduct">
  25. 全部产品
  26. </button>
  27. <button class="btn btn-right flex" :style="{ background: item.color }" @click="jumpToReport">
  28. 定制健康档案
  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. autoplay: {
  47. type: Boolean,
  48. default: false,
  49. },
  50. },
  51. data() {
  52. return {
  53. current: 0,
  54. list: [],
  55. }
  56. },
  57. created() {
  58. this.getData()
  59. },
  60. methods: {
  61. async getData() {
  62. try {
  63. this.list = await this.$fetch('getBanner')
  64. } catch (err) {
  65. }
  66. },
  67. jumpToProduct() {
  68. uni.navigateTo({
  69. url: '/pages/index/product'
  70. })
  71. },
  72. jumpToReport() {
  73. uni.navigateTo({
  74. url: '/pages/index/report'
  75. })
  76. },
  77. onChange(e) {
  78. this.current = e.detail.current
  79. },
  80. },
  81. }
  82. </script>
  83. <style scoped lang="scss">
  84. .swiper {
  85. width: 100vw;
  86. height: calc(100vw * 578 / 375);
  87. &-item {
  88. width: 100%;
  89. height: 100%;
  90. padding: 10rpx 32rpx 40rpx 32rpx;
  91. box-sizing: border-box;
  92. &-content {
  93. position: relative;
  94. width: 100%;
  95. height: 100%;
  96. border-radius: 64rpx;
  97. box-shadow: -5rpx -5rpx 10rpx 0 #FFFFFF,
  98. 10rpx 10rpx 20rpx 0 #AAAACC80,
  99. 4rpx 4rpx 10rpx 0 #AAAACC40,
  100. -2rpx -2rpx 5rpx 0 #FFFFFF;
  101. }
  102. .bg {
  103. width: 100%;
  104. height: 100%;
  105. border-radius: 64rpx;
  106. }
  107. .content {
  108. position: absolute;
  109. bottom: 0;
  110. width: 100%;
  111. // height: 592rpx;
  112. padding: 170rpx 60rpx 80rpx 60rpx;
  113. box-sizing: border-box;
  114. background-image: linear-gradient(#FFFFFF00, #FFFFFF);
  115. border-radius: 64rpx;
  116. }
  117. .font1 {
  118. font-size: 48rpx;
  119. font-weight: 600;
  120. line-height: 1.4;
  121. font-family: PingFang SC;
  122. color: #252545;
  123. }
  124. .font2 {
  125. font-size: 48rpx;
  126. font-weight: 600;
  127. line-height: 1.4;
  128. font-family: PingFang SC;
  129. color: transparent;
  130. background-image: linear-gradient(to right, #4B348F, #845CFA);
  131. background-clip: text;
  132. display: inline-block;
  133. }
  134. .font3 {
  135. font-size: 32rpx;
  136. font-weight: 400;
  137. line-height: 1.4;
  138. font-family: PingFang SC;
  139. color: #252545;
  140. }
  141. .btns {
  142. margin-top: 72rpx;
  143. display: flex;
  144. justify-content: space-between;
  145. .btn {
  146. width: 264rpx;
  147. box-sizing: border-box;
  148. font-size: 30rpx;
  149. font-family: PingFang SC;
  150. line-height: 1.4;
  151. border-radius: 45rpx;
  152. &-left {
  153. padding: 23rpx 0;
  154. font-weight: 400;
  155. color: #252545;
  156. border: 1rpx solid #252545;
  157. }
  158. &-right {
  159. padding: 24rpx 0;
  160. font-weight: 600;
  161. color: #FFFFFF;
  162. // background-image: linear-gradient(to right, #4B348F, #845CFA);
  163. }
  164. }
  165. }
  166. }
  167. }
  168. </style>