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