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

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