DimensionIntroCard.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <view class="dim-intro-card" :style="'background:' + bgGradient">
  3. <view class="dim-intro-header">
  4. <text class="dim-intro-icon">{{ icon }}</text>
  5. <view class="dim-intro-text">
  6. <text class="dim-intro-title">{{ dimName }}</text>
  7. <text class="dim-intro-subtitle">{{ subtitle }}</text>
  8. </view>
  9. </view>
  10. <view class="dim-intro-features">
  11. <view class="dim-intro-feature" v-for="(f, i) in features" :key="i">
  12. <text class="dim-intro-bullet">●</text>
  13. <text class="dim-intro-feature-text">{{ f }}</text>
  14. </view>
  15. </view>
  16. <view class="dim-intro-footer" v-if="learnMoreText">
  17. <text class="dim-intro-link" @click="onLearnMore">{{ learnMoreText }}</text>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. var DIM_CONFIG = {
  23. body: { icon: '🌏', name: '身', subtitle: '科学管理全家健康数据', features: ['七维雷达图', '健康报告解读', '能量打卡', '精准营养方案'], gradient: 'linear-gradient(135deg, #FFF7ED, rgba(255,140,66,0.12))', color: '#FF8C42' },
  24. mind: { icon: '🔥', name: '心', subtitle: '关注全家心理健康与情绪成长', features: ['EMI心理测评', '情绪趋势追踪', '家庭天盘', '疏导工具'], gradient: 'linear-gradient(135deg, #FFF0F5, rgba(255,107,157,0.12))', color: '#FF6B9D' },
  25. wisdom: { icon: '⚡', name: '智', subtitle: '提升全家认知能力与学习效率', features: ['认知雷达图', '认知训练', '测评预约', '成长记录'], gradient: 'linear-gradient(135deg, #F0F0FF, rgba(99,102,241,0.12))', color: '#6366F1' },
  26. action: { icon: '🌿', name: '行', subtitle: '改善全家关系与沟通能力', features: ['关系质量问卷', '互动记录', '任务协作', '家庭挑战'], gradient: 'linear-gradient(135deg, #F0FFF4, rgba(16,185,129,0.12))', color: '#10B981' },
  27. wealth: { icon: '💧', name: '富', subtitle: '分享价值,收获财富', features: ['财富能量仪表盘', '推广收益统计', '邀请返利', '会员权益'], gradient: 'linear-gradient(135deg, #FFFBEB, rgba(245,158,11,0.12))', color: '#F59E0B' }
  28. }
  29. export default {
  30. name: 'DimensionIntroCard',
  31. props: {
  32. dimCode: {
  33. type: String,
  34. required: true,
  35. validator: function(v) { return DIM_CONFIG.hasOwnProperty(v) }
  36. },
  37. learnMoreText: {
  38. type: String,
  39. default: '了解更多 ›'
  40. },
  41. learnMoreUrl: {
  42. type: String,
  43. default: ''
  44. }
  45. },
  46. computed: {
  47. dimConfig: function() {
  48. return DIM_CONFIG[this.dimCode]
  49. },
  50. icon: function() { return this.dimConfig.icon },
  51. dimName: function() { return this.dimConfig.name },
  52. subtitle: function() { return this.dimConfig.subtitle },
  53. features: function() { return this.dimConfig.features },
  54. bgGradient: function() { return this.dimConfig.gradient }
  55. },
  56. methods: {
  57. onLearnMore: function() {
  58. if (this.learnMoreUrl) {
  59. uni.navigateTo({ url: this.learnMoreUrl })
  60. }
  61. }
  62. }
  63. }
  64. </script>
  65. <style>
  66. .dim-intro-card {
  67. margin: 16rpx 30rpx 0;
  68. padding: 24rpx 28rpx;
  69. border-radius: 16rpx;
  70. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
  71. }
  72. .dim-intro-header {
  73. display: flex;
  74. flex-direction: row;
  75. align-items: center;
  76. margin-bottom: 20rpx;
  77. }
  78. .dim-intro-icon {
  79. font-size: 48rpx;
  80. margin-right: 16rpx;
  81. }
  82. .dim-intro-text {
  83. flex: 1;
  84. }
  85. .dim-intro-title {
  86. font-size: 28rpx;
  87. font-weight: bold;
  88. color: #333;
  89. display: block;
  90. }
  91. .dim-intro-subtitle {
  92. font-size: 22rpx;
  93. color: #666;
  94. margin-top: 4rpx;
  95. display: block;
  96. }
  97. .dim-intro-features {
  98. margin-bottom: 16rpx;
  99. }
  100. .dim-intro-feature {
  101. display: flex;
  102. flex-direction: row;
  103. align-items: center;
  104. margin-bottom: 8rpx;
  105. }
  106. .dim-intro-bullet {
  107. font-size: 16rpx;
  108. color: #999;
  109. margin-right: 8rpx;
  110. }
  111. .dim-intro-feature-text {
  112. font-size: 24rpx;
  113. color: #333;
  114. }
  115. .dim-intro-footer {
  116. text-align: right;
  117. }
  118. .dim-intro-link {
  119. font-size: 24rpx;
  120. color: #999;
  121. }
  122. </style>