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

193 lines
3.5 KiB

  1. <template>
  2. <view :class="['card', `card-${index % 5}`]">
  3. <view class="header">
  4. <view class="index">{{ getNum(index) }}</view>
  5. <view class="intro">
  6. <view class="title">{{ data.info }}</view>
  7. <view class="desc">{{ data.content }}</view>
  8. </view>
  9. </view>
  10. <view class="main">
  11. <image class="img" :src="coverImg" mode="aspectFit"></image>
  12. <view class="flex flex-column">
  13. <!-- todo: check key -->
  14. <view class="use">推荐使用·每日一粒</view>
  15. <view class="name-zh">{{ data.name }}</view>
  16. <view class="name-en">{{ data.enName }}</view>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. props: {
  24. index: {
  25. type: Number,
  26. default: 0,
  27. },
  28. data: {
  29. type: Object,
  30. default() {
  31. return {}
  32. }
  33. },
  34. },
  35. computed: {
  36. coverImg() {
  37. console.log('data', this.data)
  38. const { image } = this.data || {}
  39. return image?.split(',')?.[0] || ''
  40. },
  41. },
  42. methods: {
  43. getNum(index) {
  44. let num = index + 1
  45. return num < 10 ? `0${num}` : num
  46. },
  47. },
  48. }
  49. </script>
  50. <style scoped lang="scss">
  51. $header-height: 374rpx;
  52. .card {
  53. width: 100%;
  54. height: auto;
  55. padding-top: calc(#{$header-height} - 8rpx);
  56. }
  57. .header {
  58. position: absolute;
  59. top: 0;
  60. left: -8rpx;
  61. width: calc(100% + 8rpx * 2);
  62. height: 374rpx;
  63. padding: 32rpx;
  64. box-sizing: border-box;
  65. border-top-left-radius: 64rpx;
  66. border-top-right-radius: 64rpx;
  67. .index {
  68. font-size: 128rpx;
  69. font-weight: 900;
  70. line-height: 1.4;
  71. font-family: HarmonyOS Sans;
  72. color: transparent;
  73. background-image: linear-gradient(#FFFFFF, #FFFFFF00);
  74. background-clip: text;
  75. display: inline-block;
  76. }
  77. .intro {
  78. position: absolute;
  79. left: 32rpx;
  80. bottom: 32rpx;
  81. width: calc(100% - 32rpx * 2);
  82. font-family: PingFang SC;
  83. color: #FFFFFF;
  84. .title {
  85. font-weight: 600;
  86. font-size: 40rpx;
  87. line-height: 1.4;
  88. }
  89. .desc {
  90. margin-top: 16rpx;
  91. font-weight: 400;
  92. font-size: 28rpx;
  93. line-height: 1.3;
  94. }
  95. }
  96. }
  97. .main {
  98. .img {
  99. width: 100%;
  100. height: 500rpx;
  101. // margin: 48rpx 0;
  102. }
  103. .use{
  104. font-family: PingFang SC;
  105. font-weight: 600;
  106. font-size: 48rpx;
  107. line-height: 1.4;
  108. color: #252545;
  109. }
  110. .name {
  111. &-zh {
  112. margin: 16rpx 0;
  113. font-size: 64rpx;
  114. font-weight: 900;
  115. line-height: 1.4;
  116. font-family: HarmonyOS Sans;
  117. color: transparent;
  118. background-clip: text;
  119. display: inline-block;
  120. }
  121. &-en {
  122. font-family: PingFang SC;
  123. font-weight: 400;
  124. font-size: 32rpx;
  125. line-height: 1.4;
  126. color: #989898;
  127. }
  128. }
  129. }
  130. .card {
  131. &-0 {
  132. $color: linear-gradient(to right, #667EE2, #77BDDF);
  133. .header,
  134. .name-zh {
  135. background-image: $color;
  136. }
  137. }
  138. }
  139. .card {
  140. &-1 {
  141. $color: linear-gradient(to right, #BB7721, #EBBF5B);
  142. .header,
  143. .name-zh {
  144. background-image: $color;
  145. }
  146. }
  147. }
  148. .card {
  149. &-2 {
  150. $color: linear-gradient(to right, #72281E, #AA4E3F);
  151. .header,
  152. .name-zh {
  153. background-image: $color;
  154. }
  155. }
  156. }
  157. .card {
  158. &-3 {
  159. $color: linear-gradient(to right, #493489, #8360F6);
  160. .header,
  161. .name-zh {
  162. background-image: $color;
  163. }
  164. }
  165. }
  166. .card {
  167. &-4 {
  168. $color: linear-gradient(to right, #699656, #B7D39C);
  169. .header,
  170. .name-zh {
  171. background-image: $color;
  172. }
  173. }
  174. }
  175. </style>