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

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