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

175 lines
3.8 KiB

  1. <template>
  2. <view class="view">
  3. <image class="img" :src="configList.home_team_bg" mode="widthFix"></image>
  4. <view class="content">
  5. <view class="card">
  6. <image class="img" :src="configList.home_more_nutritional" mode="widthFix"></image>
  7. <view class="info">
  8. <view class="info-header">
  9. <view class="info-header-title">
  10. 关注我们<br/><text>了解更多营养科学</text><view class="icon"><image class="icon-img" src="@/pages_order/static/index/btn-icon.png" mode="widthFix"></image></view>
  11. </view>
  12. <view class="info-header-desc">
  13. Background of team members
  14. </view>
  15. </view>
  16. <view class="info-content">
  17. <view class="info-card" v-for="item in list" :key="item.id" @click="jumpToProductDetail(item.id)">
  18. <view class="info-card-img flex">
  19. <image class="img" :src="getImage(item)" mode="widthFix"></image>
  20. </view>
  21. <view class="info-card-text flex flex-column">
  22. <view class="info-card-zh text-ellipsis">{{ item.name }}</view>
  23. <view class="info-card-en text-ellipsis">{{ item.enName }}</view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. export default {
  34. data() {
  35. return {
  36. list: [],
  37. }
  38. },
  39. created() {
  40. this.getData()
  41. },
  42. methods: {
  43. async getData() {
  44. try {
  45. this.list = await this.$fetch('getRecommendProduct')
  46. } catch (err) {
  47. }
  48. },
  49. getImage(obj) {
  50. const { image } = obj
  51. return image?.split(',')?.[0] || ''
  52. },
  53. jumpToProductDetail(id) {
  54. this.$utils.navigateTo(`/pages_order/product/productDetail?id=${id}`)
  55. },
  56. },
  57. }
  58. </script>
  59. <style scoped lang="scss">
  60. .view {
  61. font-size: 0;
  62. padding: 40rpx 32rpx 0 32rpx;
  63. }
  64. .content {
  65. padding-top: 80rpx;
  66. }
  67. .img {
  68. width: 100%;
  69. height: auto;
  70. }
  71. .card {
  72. width: 100%;
  73. border-radius: 64rpx;
  74. overflow: hidden;
  75. background-image: linear-gradient(#F3F3F3, #FAFAFF);
  76. box-shadow: -5rpx -5rpx 10rpx 0 #FFFFFF,
  77. 10rpx 10rpx 20rpx 0 #AAAACC80,
  78. 4rpx 4rpx 10rpx 0 #AAAACC40,
  79. -2rpx -2rpx 5rpx 0 #FFFFFF;
  80. }
  81. .info {
  82. padding: 32rpx;
  83. background-image: linear-gradient(#EDEDED, #FFFFFF);
  84. &-header {
  85. &-title {
  86. font-size: 48rpx;
  87. font-family: PingFang SC;
  88. font-weight: 600;
  89. line-height: 1.4;
  90. color: #252545;
  91. .icon {
  92. display: inline-block;
  93. vertical-align: middle;
  94. margin-left: 16rpx;
  95. &-img {
  96. width: 48rpx;
  97. height: 48rpx;
  98. }
  99. }
  100. }
  101. &-desc {
  102. font-size: 26rpx;
  103. font-family: PingFang SC;
  104. font-weight: 400;
  105. line-height: 1.4;
  106. color: #989898;
  107. }
  108. }
  109. &-content {
  110. display: grid;
  111. grid-template-columns: repeat(3, 1fr);
  112. grid-column-gap: 20rpx;
  113. }
  114. &-card {
  115. margin-top: 20rpx;
  116. min-width: 0;
  117. border-radius: 24rpx;
  118. background-image: linear-gradient(#FAFAFF, #F3F3F3);
  119. box-shadow: -5rpx -5rpx 10rpx 0 #FFFFFF,
  120. 10rpx 10rpx 20rpx 0 #AAAACC80,
  121. 4rpx 4rpx 10rpx 0 #AAAACC40,
  122. -2rpx -2rpx 5rpx 0 #FFFFFF;
  123. &-img {
  124. width: 100%;
  125. height: 160rpx;
  126. padding: 0 25rpx;
  127. box-sizing: border-box;
  128. }
  129. &-text {
  130. padding: 16rpx 0;
  131. }
  132. &-zh {
  133. width: 100%;
  134. text-align: center;
  135. font-family: PingFang SC;
  136. font-size: 28rpx;
  137. font-weight: 500;
  138. line-height: 1.4;
  139. color: #252545;
  140. }
  141. &-en {
  142. width: 100%;
  143. text-align: center;
  144. font-family: PingFang SC;
  145. font-size: 24rpx;
  146. font-weight: 400;
  147. line-height: 1.4;
  148. color: #989898;
  149. }
  150. }
  151. }
  152. </style>