splash.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <view class="splash-container">
  3. <!-- Logo 区域 -->
  4. <view class="logo-section">
  5. <image class="logo-icon" src="/static/image/public/logo.png" mode="aspectFill"></image>
  6. <text class="app-name">布尔销销乐</text>
  7. <text class="app-slogan">您的客户关系管理助手</text>
  8. </view>
  9. <!-- 加载动画 -->
  10. <view class="loading-section">
  11. <view class="loading-dots">
  12. <view class="dot dot1"></view>
  13. <view class="dot dot2"></view>
  14. <view class="dot dot3"></view>
  15. </view>
  16. <text class="loading-text">{{ loadingText }}</text>
  17. </view>
  18. <!-- 版本信息 -->
  19. <view class="version-info">
  20. <text class="version-text">v1.0.0</text>
  21. <view class="version-text">
  22. 浙江舒博特网络科技有限公司提供技术支持
  23. </view>
  24. </view>
  25. </view>
  26. </template>
  27. <script setup>
  28. import {
  29. ref,
  30. onMounted
  31. } from 'vue'
  32. import {
  33. isLogin
  34. } from '@/utils/userCache.js'
  35. const loadingText = ref('正在加载...')
  36. // 页面加载
  37. onMounted(() => {
  38. initApp()
  39. })
  40. /**
  41. * 初始化应用
  42. */
  43. const initApp = async () => {
  44. try {
  45. // 模拟加载延迟(提升用户体验)
  46. // await sleep(500)
  47. loadingText.value = '检查登录状态...'
  48. // 检查登录状态
  49. // const loggedIn = isLogin()
  50. // 再延迟一点,让动画更流畅
  51. // await sleep(800)
  52. if (false) {
  53. // 已登录,跳转首页
  54. uni.reLaunch({
  55. url: '/pages/index/index'
  56. })
  57. } else {
  58. // 未登录,跳转登录页
  59. uni.reLaunch({
  60. url: '/pages/login/login'
  61. })
  62. }
  63. } catch (error) {
  64. console.error('初始化失败:', error)
  65. // 出错时跳转到登录页
  66. uni.reLaunch({
  67. url: '/pages/login/login'
  68. })
  69. }
  70. }
  71. /**
  72. * 延时函数
  73. * @param {number} ms - 毫秒数
  74. */
  75. const sleep = (ms) => {
  76. return new Promise(resolve => setTimeout(resolve, ms))
  77. }
  78. </script>
  79. <style lang="scss" scoped>
  80. .splash-container {
  81. min-height: 100vh;
  82. background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
  83. display: flex;
  84. flex-direction: column;
  85. align-items: center;
  86. justify-content: center;
  87. padding: 0 40rpx;
  88. }
  89. // Logo 区域
  90. .logo-section {
  91. display: flex;
  92. flex-direction: column;
  93. align-items: center;
  94. margin-bottom: 120rpx;
  95. .logo-icon {
  96. width: 200rpx;
  97. height: 200rpx;
  98. background: linear-gradient(135deg, #ffffff 0%, #e6f7ff 100%);
  99. border-radius: 40rpx;
  100. box-shadow: 0 16rpx 48rpx rgba(0, 0, 0, 0.2);
  101. display: flex;
  102. align-items: center;
  103. justify-content: center;
  104. animation: logoFloat 2s ease-in-out infinite;
  105. }
  106. .app-name {
  107. font-size: 48rpx;
  108. font-weight: 600;
  109. color: #ffffff;
  110. margin-top: 40rpx;
  111. letter-spacing: 2rpx;
  112. }
  113. .app-slogan {
  114. font-size: 26rpx;
  115. color: rgba(255, 255, 255, 0.8);
  116. margin-top: 16rpx;
  117. }
  118. }
  119. // 加载动画
  120. .loading-section {
  121. display: flex;
  122. flex-direction: column;
  123. align-items: center;
  124. .loading-dots {
  125. display: flex;
  126. justify-content: center;
  127. align-items: center;
  128. margin-bottom: 24rpx;
  129. .dot {
  130. width: 20rpx;
  131. height: 20rpx;
  132. border-radius: 50%;
  133. background-color: #ffffff;
  134. margin: 0 8rpx;
  135. opacity: 0.3;
  136. }
  137. .dot1 {
  138. animation: loadingDot 1.4s ease-in-out infinite;
  139. }
  140. .dot2 {
  141. animation: loadingDot 1.4s ease-in-out 0.2s infinite;
  142. }
  143. .dot3 {
  144. animation: loadingDot 1.4s ease-in-out 0.4s infinite;
  145. }
  146. }
  147. .loading-text {
  148. font-size: 26rpx;
  149. color: rgba(255, 255, 255, 0.9);
  150. }
  151. }
  152. // 版本信息
  153. .version-info {
  154. position: absolute;
  155. bottom: 80rpx;
  156. display: flex;
  157. flex-direction: column;
  158. align-items: center;
  159. justify-content: center;
  160. .version-text {
  161. font-size: 22rpx;
  162. color: rgba(255, 255, 255, 0.6);
  163. }
  164. }
  165. // 动画
  166. @keyframes logoFloat {
  167. 0%,
  168. 100% {
  169. transform: translateY(0);
  170. }
  171. 50% {
  172. transform: translateY(-20rpx);
  173. }
  174. }
  175. @keyframes loadingDot {
  176. 0%,
  177. 80%,
  178. 100% {
  179. transform: scale(0.6);
  180. opacity: 0.3;
  181. }
  182. 40% {
  183. transform: scale(1);
  184. opacity: 1;
  185. }
  186. }
  187. </style>