tab-transition.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <view class="tab-transition-overlay" :style="'background:' + bgGradient">
  3. <view class="transition-content">
  4. <!-- Large dimension character -->
  5. <text class="dim-char" :style="'color:' + dimConfig.color">{{ dimConfig.char }}</text>
  6. <!-- Icon -->
  7. <text class="dim-icon">{{ dimConfig.icon }}</text>
  8. <!-- Dimension label -->
  9. <text class="dim-label" :style="'color:' + dimConfig.color">{{ dimConfig.label }}</text>
  10. <!-- Animated energy bar -->
  11. <view class="energy-bar-track">
  12. <view class="energy-bar-fill" :style="'background:' + dimConfig.color"></view>
  13. </view>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. var DIM_MAP = {
  19. action: { char: '行', icon: '🌿', color: '#10B981', label: '知行合一' },
  20. body: { char: '身', icon: '🌏', color: '#8D6E63', label: '主动健康' },
  21. wisdom: { char: '智', icon: '⚡', color: '#6366F1', label: '赋能未来' },
  22. mind: { char: '心', icon: '🔥', color: '#FF6B9D', label: '大爱传承' },
  23. wealth: { char: '富', icon: '💧', color: '#F59E0B', label: '利他创富' }
  24. }
  25. export default {
  26. props: {
  27. dimCode: {
  28. type: String,
  29. required: true
  30. }
  31. },
  32. data() {
  33. return {
  34. }
  35. },
  36. computed: {
  37. dimConfig: function() {
  38. return DIM_MAP[this.dimCode] || DIM_MAP['action']
  39. },
  40. bgGradient: function() {
  41. var cfg = this.dimConfig
  42. var hex = cfg.color
  43. var r = parseInt(hex.slice(1, 3), 16)
  44. var g = parseInt(hex.slice(3, 5), 16)
  45. var b = parseInt(hex.slice(5, 7), 16)
  46. return 'linear-gradient(160deg, #FFF7ED 0%, rgba(' + r + ',' + g + ',' + b + ',0.4) 100%)'
  47. }
  48. },
  49. // mounted 已清空:显隐完全由父组件 v-if 控制
  50. }
  51. </script>
  52. <style scoped>
  53. .tab-transition-overlay {
  54. position: fixed;
  55. top: 0;
  56. left: 0;
  57. right: 0;
  58. bottom: 0;
  59. z-index: 9998;
  60. display: flex;
  61. align-items: center;
  62. justify-content: center;
  63. }
  64. .transition-content {
  65. display: flex;
  66. flex-direction: column;
  67. align-items: center;
  68. opacity: 0;
  69. animation: tab-fade-in 0.2s ease forwards;
  70. }
  71. .transition-content.fade-out {
  72. animation: tab-fade-out 0.3s ease forwards;
  73. }
  74. @keyframes tab-fade-in {
  75. from {
  76. opacity: 0;
  77. transform: scale(0.92);
  78. }
  79. to {
  80. opacity: 1;
  81. transform: scale(1);
  82. }
  83. }
  84. @keyframes tab-fade-out {
  85. from {
  86. opacity: 1;
  87. transform: scale(1);
  88. }
  89. to {
  90. opacity: 0;
  91. transform: scale(0.92);
  92. }
  93. }
  94. .dim-char {
  95. font-size: 120rpx;
  96. font-weight: 700;
  97. line-height: 1.2;
  98. margin-bottom: 8rpx;
  99. }
  100. .dim-icon {
  101. font-size: 48rpx;
  102. line-height: 1;
  103. margin-bottom: 16rpx;
  104. }
  105. .dim-label {
  106. font-size: 32rpx;
  107. font-weight: 500;
  108. line-height: 1;
  109. margin-bottom: 40rpx;
  110. opacity: 0.8;
  111. }
  112. .energy-bar-track {
  113. width: 200rpx;
  114. height: 4rpx;
  115. background: rgba(0, 0, 0, 0.08);
  116. border-radius: 2rpx;
  117. overflow: hidden;
  118. }
  119. .energy-bar-fill {
  120. width: 0%;
  121. height: 100%;
  122. border-radius: 2rpx;
  123. animation: bar-grow 0.6s ease 0.2s forwards;
  124. }
  125. @keyframes bar-grow {
  126. from {
  127. width: 0%;
  128. }
  129. to {
  130. width: 100%;
  131. }
  132. }
  133. </style>