index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <template>
  2. <view class="launch-page">
  3. <!-- 背景图:与登录页一致的青山绿水 -->
  4. <image class="bg-img" src="/static/login-bg.jpeg" mode="aspectFill" />
  5. <!-- 柔光蒙版:与登录页一致的渐变 -->
  6. <view class="veil"></view>
  7. <!-- 内容层 -->
  8. <view class="content">
  9. <view class="brand">
  10. <view class="logo">
  11. <view class="leaf">
  12. <view class="leaf-vein"></view>
  13. </view>
  14. </view>
  15. <text class="title">绿水青山</text>
  16. <text class="subtitle">与自然同行</text>
  17. </view>
  18. <!-- 加载指示:嫩芽绿呼吸点 -->
  19. <view class="loading">
  20. <view class="dot" v-for="i in 3" :key="i"></view>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script setup lang="ts">
  26. import { onLoad } from '@dcloudio/uni-app'
  27. import { useAuthStore } from '@/stores'
  28. import { delay } from '@/utils'
  29. const authStore = useAuthStore()
  30. onLoad(async () => {
  31. await delay(800)
  32. authStore.checkLogin()
  33. if (authStore.isLoggedIn && authStore.userRole) {
  34. uni.switchTab({ url: '/pages/home/home' })
  35. } else {
  36. uni.reLaunch({ url: '/pages/login/login' })
  37. }
  38. })
  39. </script>
  40. <style scoped>
  41. /* ==================== 页面外壳:与登录页一致 ==================== */
  42. .launch-page {
  43. position: relative;
  44. max-width: 448px;
  45. margin: 0 auto;
  46. min-height: 100vh;
  47. display: flex;
  48. flex-direction: column;
  49. overflow: hidden;
  50. background-color: #f6fbf9; /* 云雾白兜底 */
  51. }
  52. .bg-img {
  53. position: absolute;
  54. top: 0;
  55. left: 0;
  56. width: 100%;
  57. height: 100%;
  58. z-index: 0;
  59. }
  60. .veil {
  61. position: absolute;
  62. top: 0;
  63. left: 0;
  64. width: 100%;
  65. height: 100%;
  66. z-index: 1;
  67. background: linear-gradient(
  68. 180deg,
  69. rgba(255, 255, 255, 0.52) 0%,
  70. rgba(246, 251, 249, 0.18) 38%,
  71. rgba(246, 251, 249, 0.10) 58%,
  72. rgba(31, 71, 56, 0.22) 100%
  73. );
  74. }
  75. /* ==================== 内容层 ==================== */
  76. .content {
  77. position: relative;
  78. z-index: 2;
  79. flex: 1;
  80. display: flex;
  81. flex-direction: column;
  82. align-items: center;
  83. justify-content: center;
  84. padding: 56px 32px calc(40px + env(safe-area-inset-bottom));
  85. }
  86. .brand {
  87. display: flex;
  88. flex-direction: column;
  89. align-items: center;
  90. }
  91. /* 磨砂玻璃 Logo 容器:与登录页一致 */
  92. .logo {
  93. width: 76px;
  94. height: 76px;
  95. border-radius: 24px;
  96. background-color: rgba(255, 255, 255, 0.86);
  97. display: flex;
  98. align-items: center;
  99. justify-content: center;
  100. box-shadow: 0 10px 28px -8px rgba(54, 143, 111, 0.45);
  101. backdrop-filter: blur(8px);
  102. -webkit-backdrop-filter: blur(8px);
  103. }
  104. /* 叶子 Logo(CSS 绘制,与登录页一致) */
  105. .leaf {
  106. position: relative;
  107. width: 38px;
  108. height: 38px;
  109. background: linear-gradient(135deg, #a4d898 0%, #368f6f 100%);
  110. border-radius: 4px 28px 4px 28px;
  111. transform: rotate(45deg);
  112. }
  113. .leaf-vein {
  114. position: absolute;
  115. left: 50%;
  116. top: 4px;
  117. bottom: 4px;
  118. width: 2px;
  119. margin-left: -1px;
  120. border-radius: 2px;
  121. background-color: rgba(255, 255, 255, 0.7);
  122. }
  123. .title {
  124. margin-top: 22px;
  125. font-size: 34px;
  126. font-weight: 800;
  127. letter-spacing: 6px;
  128. color: #368f6f; /* 青山绿 */
  129. }
  130. .subtitle {
  131. margin-top: 10px;
  132. font-size: 14px;
  133. letter-spacing: 4px;
  134. color: #709484; /* 晨雾灰绿 */
  135. }
  136. /* ==================== 加载指示 ==================== */
  137. .loading {
  138. display: flex;
  139. gap: 10px;
  140. margin-top: 48px;
  141. }
  142. .dot {
  143. width: 8px;
  144. height: 8px;
  145. border-radius: 50%;
  146. background-color: #a4d898; /* 嫩芽绿 */
  147. animation: breathe 1.2s ease-in-out infinite;
  148. }
  149. .dot:nth-child(2) {
  150. animation-delay: 0.2s;
  151. }
  152. .dot:nth-child(3) {
  153. animation-delay: 0.4s;
  154. }
  155. @keyframes breathe {
  156. 0%, 100% { opacity: 0.3; transform: scale(0.8); }
  157. 50% { opacity: 1; transform: scale(1.2); }
  158. }
  159. </style>