PageBanner.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <view class="page-banner" :style="bannerStyle">
  3. <view class="banner-left">
  4. <image class="banner-logo" src="/static/logo.png" mode="aspectFit" />
  5. <view class="banner-texts">
  6. <text class="banner-name">浠艾福</text>
  7. <text class="banner-tagline">{{ tagline }}</text>
  8. </view>
  9. </view>
  10. <view class="banner-right" v-if="quote">
  11. <text class="banner-quote">{{ quote }}</text>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. import { white, BrandColors } from '@/utils/brand-colors.js'
  17. /**
  18. * 各主题对应沙盘颜色的渐变背景
  19. * 五行色来源:wuxing-sandbox 组件和 render.js
  20. * 身(body/土): #8D6E63
  21. * 心(mind/火): #FF6B35
  22. * 智(wisdom/金): #FFD700
  23. * 行(action/木): #4CAF50
  24. * 富(wealth/水): #F59E0B
  25. */
  26. var THEME_STYLES = {
  27. home: {
  28. background: 'linear-gradient(135deg, #FF8A65 0%, #FFB74D 100%)',
  29. color: BrandColors.white
  30. },
  31. body: {
  32. background: 'linear-gradient(135deg, #8D6E63 0%, #A1887F 100%)',
  33. color: BrandColors.white
  34. },
  35. mind: {
  36. background: 'linear-gradient(135deg, #FF6B35 0%, #E65100 100%)',
  37. color: BrandColors.white
  38. },
  39. wisdom: {
  40. background: 'linear-gradient(135deg, #FFD700 0%, #FFA000 100%)',
  41. color: '#5D4037'
  42. },
  43. 'mind-wisdom': {
  44. background: 'linear-gradient(135deg, #FF6B35 0%, #FFD700 100%)',
  45. color: BrandColors.white
  46. },
  47. action: {
  48. background: 'linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%)',
  49. color: BrandColors.white
  50. },
  51. wealth: {
  52. background: 'linear-gradient(135deg, #F59E0B 0%, #FBBF24 100%)',
  53. color: BrandColors.white
  54. }
  55. }
  56. export default {
  57. props: {
  58. /** banner 主题:home | body | mind | wisdom | mind-wisdom | action | wealth */
  59. theme: {
  60. type: String,
  61. default: 'home'
  62. },
  63. /** 平台一句介绍(显示在名称下方) */
  64. tagline: {
  65. type: String,
  66. default: '家庭健康成长俱乐部'
  67. },
  68. /** 右侧金句 */
  69. quote: {
  70. type: String,
  71. default: ''
  72. }
  73. },
  74. computed: {
  75. bannerStyle: function() {
  76. var style = THEME_STYLES[this.theme] || THEME_STYLES.home
  77. return {
  78. background: style.background,
  79. color: style.color
  80. }
  81. }
  82. }
  83. }
  84. </script>
  85. <style scoped>
  86. .page-banner {
  87. display: flex;
  88. flex-direction: row;
  89. align-items: center;
  90. justify-content: space-between;
  91. padding: 24rpx 30rpx;
  92. min-height: 100rpx;
  93. border-radius: 0;
  94. margin: 0;
  95. }
  96. .banner-left {
  97. display: flex;
  98. flex-direction: row;
  99. align-items: center;
  100. flex-shrink: 0;
  101. }
  102. .banner-logo {
  103. width: 56rpx;
  104. height: 56rpx;
  105. border-radius: 12rpx;
  106. flex-shrink: 0;
  107. margin-right: 16rpx;
  108. }
  109. .banner-texts {
  110. display: flex;
  111. flex-direction: column;
  112. }
  113. .banner-name {
  114. font-size: 32rpx;
  115. font-weight: 700;
  116. letter-spacing: 4rpx;
  117. line-height: 1.3;
  118. }
  119. .banner-tagline {
  120. font-size: 20rpx;
  121. opacity: 0.85;
  122. line-height: 1.4;
  123. margin-top: 2rpx;
  124. }
  125. .banner-right {
  126. flex: 1;
  127. text-align: right;
  128. margin-left: 20rpx;
  129. }
  130. .banner-quote {
  131. font-size: 22rpx;
  132. opacity: 0.92;
  133. line-height: 1.4;
  134. display: inline-block;
  135. text-align: right;
  136. letter-spacing: 1rpx;
  137. }
  138. </style>