App.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741
  1. <script setup lang="ts">
  2. import { onLaunch, onShow, onHide } from '@dcloudio/uni-app';
  3. import { watch } from 'vue';
  4. import { createPinia } from 'pinia';
  5. import { useUserStore } from './store/user';
  6. import { useNavigationStore } from './store/navigation';
  7. import { initDebug } from './utils/debug';
  8. import { initAnalytics } from './utils/analytics';
  9. import MiniPlayer from './components/MiniPlayer.vue';
  10. import CreditInsufficientModal from './components/CreditInsufficientModal.vue';
  11. // 初始化全局调试工具
  12. initDebug();
  13. // ==================== 微信环境检测 ====================
  14. function isInWechatBrowser(): boolean {
  15. // #ifdef H5
  16. const ua = navigator.userAgent.toLowerCase();
  17. return ua.includes('micromessenger');
  18. // #endif
  19. return false;
  20. }
  21. // ==================== 微信 OAuth 回调处理 ====================
  22. async function handleWechatOAuthCallback() {
  23. // 只在 H5 环境处理
  24. // #ifdef H5
  25. const searchParams = new URLSearchParams(window.location.search);
  26. const code = searchParams.get('code');
  27. const state = searchParams.get('state');
  28. console.log('[App] handleWechatOAuthCallback 触发', { code: !!code, fullUrl: window.location.href });
  29. if (!code) {
  30. console.log('[App] 无 code 参数,跳过 OAuth 处理');
  31. return; // 不是 OAuth 回调,跳过
  32. }
  33. console.log('[App] 检测到微信 OAuth 回调,处理 code...');
  34. uni.showLoading({ title: '授权中...' });
  35. try {
  36. const { post } = await import('./utils/request');
  37. const result = await post<{ openid: string }>('/payment/wechat/openid', { code });
  38. if (result.openid) {
  39. console.log('[App] OpenID 获取成功');
  40. // 先尝试根据 openid 自动登录
  41. try {
  42. const userStore = useUserStore();
  43. await userStore.loginByOpenid(result.openid);
  44. console.log('[App] OpenID 已绑定,自动登录成功');
  45. // 清除 URL 参数,停留在当前页
  46. searchParams.delete('code');
  47. searchParams.delete('state');
  48. const newSearch = searchParams.toString();
  49. const newUrl = window.location.origin + window.location.pathname
  50. + (newSearch ? '?' + newSearch : '') + window.location.hash;
  51. window.history.replaceState({}, '', newUrl);
  52. uni.hideLoading();
  53. uni.showToast({ title: '自动登录成功', icon: 'success' });
  54. return;
  55. } catch (e: any) {
  56. if (e?.message?.includes('未绑定') || e?.code === -1) {
  57. // 自动登录失败(未绑定账号),继续正常流程
  58. console.log('[App] OpenID 未绑定账号,将存储待登录');
  59. } else {
  60. console.error('[App] 自动登录异常:', e);
  61. }
  62. }
  63. // 未绑定账号或自动登录失败,存储 openid 等待手机号登录绑定
  64. localStorage.setItem('wx_openid', result.openid);
  65. // 🔧 标记刚从 OAuth 回来,页面组件可据此自动触发支付
  66. try { sessionStorage.setItem('wx_oauth_just_done', '1'); } catch (_) {}
  67. // 恢复之前保存的页面上下文
  68. let returnUrl: string | null = null;
  69. try {
  70. returnUrl = sessionStorage.getItem('wx_oauth_return');
  71. sessionStorage.removeItem('wx_oauth_return');
  72. } catch (_) {}
  73. if (returnUrl) {
  74. // 跳回原始页面(保留完整 hash 路由)
  75. // 用 location.replace 避免产生多余的历史记录
  76. window.location.replace(returnUrl);
  77. } else {
  78. // 没有上下文,清除 URL 参数后停留在当前页
  79. searchParams.delete('code');
  80. searchParams.delete('state');
  81. const newSearch = searchParams.toString();
  82. const newUrl = window.location.origin + window.location.pathname
  83. + (newSearch ? '?' + newSearch : '') + window.location.hash;
  84. window.history.replaceState({}, '', newUrl);
  85. }
  86. }
  87. } catch (e) {
  88. console.error('[App] OAuth 回调处理失败:', e);
  89. // 清除 URL 参数
  90. searchParams.delete('code');
  91. searchParams.delete('state');
  92. const newSearch = searchParams.toString();
  93. const newUrl = window.location.origin + window.location.pathname
  94. + (newSearch ? '?' + newSearch : '');
  95. window.history.replaceState({}, '', newUrl);
  96. } finally {
  97. uni.hideLoading();
  98. }
  99. // #endif
  100. }
  101. onLaunch(async () => {
  102. console.log('App Launch');
  103. // ============ 第一件事:加载导航配置 ============
  104. // 业务方要求:首次打开必须先获取底部 tab 导航接口,
  105. // 否则不允许加载任何业务内容。
  106. const navStore = useNavigationStore();
  107. try {
  108. await navStore.loadConfig({ throwOnError: true, timeout: 8000 });
  109. console.log('[App] 导航配置加载成功,tabs:', navStore.tabList.length);
  110. } catch (err: any) {
  111. console.error('[App] 导航配置加载失败,阻塞启动:', err?.message || err);
  112. // 不再继续后续初始化,等用户在重试 UI 上点击重试
  113. return;
  114. }
  115. const userStore = useUserStore();
  116. userStore.initUser();
  117. // 应用夜间模式
  118. applyDarkMode();
  119. // 初始化统计
  120. initAnalytics();
  121. // 处理微信 OAuth 回调(必须在 initUser 之后)
  122. // #ifdef H5
  123. handleWechatOAuthCallback().then(() => {
  124. // OAuth 回调处理完成后,再执行自动登录检查
  125. checkAutoLogin();
  126. });
  127. // #endif
  128. });
  129. // ==================== 全局自动登录检查 ====================
  130. async function checkAutoLogin() {
  131. // 只在微信环境下处理
  132. if (!isInWechatBrowser()) {
  133. console.log('[App] 非微信环境,跳过自动登录检查');
  134. return;
  135. }
  136. const userStore = useUserStore();
  137. // 如果已经登录,跳过
  138. if (userStore.isLoggedIn) {
  139. console.log('[App] 已登录,跳过自动登录检查');
  140. return;
  141. }
  142. // 检查 localStorage 是否有 openid
  143. const wxOpenid = localStorage.getItem('wx_openid');
  144. if (!wxOpenid) {
  145. console.log('[App] 微信环境无 openid,触发 OAuth 授权');
  146. // 触发 OAuth 授权
  147. await triggerWechatOAuth();
  148. return;
  149. }
  150. console.log('[App] 检测到 openid,尝试自动登录:', wxOpenid.substring(0, 8) + '...');
  151. try {
  152. await userStore.loginByOpenid(wxOpenid);
  153. console.log('[App] 自动登录成功!');
  154. uni.showToast({ title: '自动登录成功', icon: 'success' });
  155. } catch (e: any) {
  156. console.log('[App] 自动登录失败(openid 未绑定账号):', e?.message);
  157. // 不做处理,让用户手动登录
  158. }
  159. }
  160. // ==================== 触发微信 OAuth 授权 ====================
  161. async function triggerWechatOAuth() {
  162. // #ifdef H5
  163. uni.showLoading({ title: '正在跳转微信授权...' });
  164. try {
  165. const { get } = await import('./utils/request');
  166. // 直接使用当前完整 URL 作为回调地址
  167. const redirectUrl = window.location.href;
  168. console.log('[App] 授权回调地址:', redirectUrl);
  169. // 调用后端获取微信授权链接
  170. const result = await get<{ oauthUrl: string }>(`/payment/wechat/oauth-url?redirect=${encodeURIComponent(redirectUrl)}`);
  171. console.log('[App] 微信授权链接:', result.oauthUrl);
  172. // 跳转到微信授权页
  173. window.location.href = result.oauthUrl;
  174. } catch (e) {
  175. console.error('[App] 获取授权链接失败:', e);
  176. uni.hideLoading();
  177. uni.showToast({ title: '授权失败,请重试', icon: 'none' });
  178. }
  179. // #endif
  180. }
  181. onShow(() => {
  182. console.log('App Show');
  183. // 同步当前 tab 高亮(处理热更新/外部跳转等场景)
  184. syncCurrentTabFromPageStack();
  185. });
  186. onHide(() => {
  187. console.log('App Hide');
  188. });
  189. // 从页面栈同步当前 tab 高亮
  190. function syncCurrentTabFromPageStack() {
  191. try {
  192. const navStore = useNavigationStore();
  193. if (!navStore.isReady) return;
  194. const pages = getCurrentPages();
  195. const last = pages[pages.length - 1] as any;
  196. const route = (last && last.route) ? String(last.route) : '';
  197. if (route) navStore.syncCurrentTabByPagePath(route);
  198. } catch (_) {
  199. // 非 H5 环境 getCurrentPages 可能不可用
  200. }
  201. }
  202. // 应用夜间模式
  203. function applyDarkMode() {
  204. try {
  205. const isDark = uni.getStorageSync('dark_mode');
  206. if (isDark) {
  207. uni.setStorageSync('is_dark_mode', true);
  208. }
  209. } catch (error) {
  210. console.error('应用夜间模式失败:', error);
  211. }
  212. }
  213. // ==================== 启动态:导航配置重试 ====================
  214. const navStore = useNavigationStore();
  215. /**
  216. * 控制启动浮层 (#boot-splash) 的显示与内容。
  217. *
  218. * 该 DOM 元素由 main.ts 在 #app 之外创建,目的是绕过 uni-app H5 的 page HOC
  219. * (HOC 会吞掉 App.vue 模板里 router-view 之外的子节点,导致 v-if 不生效)。
  220. * 我们 watch navStore.isReady / loading / loadError 来同步浮层状态。
  221. */
  222. function renderBootSplash() {
  223. if (typeof document === 'undefined') return;
  224. const splash = document.getElementById('boot-splash');
  225. if (!splash) return;
  226. if (navStore.isReady) {
  227. splash.classList.add('is-hidden');
  228. return;
  229. }
  230. // 显示 splash
  231. splash.classList.remove('is-hidden');
  232. const showError = !navStore.loading && !!navStore.loadError;
  233. const loadingHtml = `
  234. <div class="boot-spinner"></div>
  235. <div class="boot-loading-text">正在加载导航…</div>
  236. <div class="boot-loading-hint">${navStore.loading ? '请稍候' : '准备中'}</div>
  237. `;
  238. const errorHtml = `
  239. <div class="boot-error-icon">⚠️</div>
  240. <div class="boot-error-title">导航服务连接失败</div>
  241. <div class="boot-error-message"></div>
  242. <button class="boot-retry-btn" id="boot-retry-btn">重新连接</button>
  243. <div class="boot-error-hint">网络异常时,请检查后端服务后重试</div>
  244. `;
  245. splash.innerHTML = `
  246. <div class="boot-logo"><span class="boot-logo-icon">📚</span></div>
  247. <div class="boot-app-name">AI 有声书</div>
  248. <div class="boot-state">${showError ? errorHtml : loadingHtml}</div>
  249. `;
  250. if (showError) {
  251. const msgEl = splash.querySelector('.boot-error-message');
  252. if (msgEl) msgEl.textContent = String(navStore.loadError || '');
  253. const btn = splash.querySelector('#boot-retry-btn');
  254. if (btn) {
  255. btn.addEventListener('click', () => {
  256. handleNavRetry();
  257. });
  258. }
  259. }
  260. }
  261. if (typeof window !== 'undefined') {
  262. watch(
  263. () => [navStore.isReady, navStore.loading, navStore.loadError],
  264. () => {
  265. renderBootSplash();
  266. },
  267. { immediate: true, deep: true }
  268. );
  269. }
  270. async function handleNavRetry() {
  271. try {
  272. await navStore.loadConfig({ throwOnError: true, timeout: 8000 });
  273. // 加载成功后,补充执行原本被阻塞的初始化
  274. const userStore = useUserStore();
  275. if (!userStore.token) {
  276. userStore.initUser();
  277. }
  278. applyDarkMode();
  279. initAnalytics();
  280. // #ifdef H5
  281. handleWechatOAuthCallback().then(() => checkAutoLogin());
  282. // #endif
  283. } catch (err: any) {
  284. // 留 store 内的 loadError 给 UI 显示
  285. console.error('[App] 导航配置重试失败:', err?.message || err);
  286. }
  287. }
  288. </script>
  289. <template>
  290. <view id="app">
  291. <router-view />
  292. <MiniPlayer />
  293. <CreditInsufficientModal />
  294. </view>
  295. </template>
  296. <style>
  297. /* ============================================================
  298. 全局设计系统 - Global Design System
  299. ============================================================ */
  300. /* --- CSS 设计令牌 (Design Tokens) --- */
  301. :root {
  302. /* 主色调 - Indigo */
  303. --color-primary: #4f46e5;
  304. --color-primary-400: #818cf8;
  305. --color-primary-500: #6366f1;
  306. --color-primary-600: #4f46e5;
  307. --color-primary-700: #4338ca;
  308. --color-primary-800: #3730a3;
  309. /* 强调色 - Amber/Orange */
  310. --color-accent: #f97316;
  311. --color-accent-400: #fb923c;
  312. --color-accent-500: #f97316;
  313. /* 语义色 */
  314. --color-success: #10b981;
  315. --color-success-bg: #ecfdf5;
  316. --color-warning: #f59e0b;
  317. --color-warning-bg: #fffbeb;
  318. --color-error: #ef4444;
  319. --color-error-bg: #fef2f2;
  320. --color-info: #3b82f6;
  321. --color-info-bg: #eff6ff;
  322. /* 中性色 */
  323. --color-text-primary: #111827;
  324. --color-text-secondary: #4b5563;
  325. --color-text-tertiary: #9ca3af;
  326. --color-text-placeholder: #d1d5db;
  327. --color-text-inverse: #ffffff;
  328. /* 背景色 */
  329. --color-bg-page: #f3f4f6;
  330. --color-bg-card: #ffffff;
  331. --color-bg-surface: #f9fafb;
  332. --color-bg-hover: #f3f4f6;
  333. --color-bg-divider: #e5e7eb;
  334. /* 阴影系统 */
  335. --shadow-xs: 0 1rpx 2rpx rgba(0, 0, 0, 0.04);
  336. --shadow-sm: 0 2rpx 8rpx rgba(0, 0, 0, 0.06);
  337. --shadow-md: 0 4rpx 16rpx rgba(0, 0, 0, 0.08);
  338. --shadow-lg: 0 8rpx 32rpx rgba(0, 0, 0, 0.12);
  339. --shadow-xl: 0 16rpx 48rpx rgba(0, 0, 0, 0.16);
  340. --shadow-primary: 0 4rpx 20rpx rgba(79, 70, 229, 0.25);
  341. /* 圆角系统 */
  342. --radius-xs: 6rpx;
  343. --radius-sm: 10rpx;
  344. --radius-md: 16rpx;
  345. --radius-lg: 24rpx;
  346. --radius-xl: 32rpx;
  347. --radius-full: 9999rpx;
  348. /* 间距系统 */
  349. --space-1: 4rpx;
  350. --space-2: 8rpx;
  351. --space-3: 12rpx;
  352. --space-4: 16rpx;
  353. --space-5: 20rpx;
  354. --space-6: 24rpx;
  355. --space-8: 32rpx;
  356. --space-10: 40rpx;
  357. --space-12: 48rpx;
  358. /* 字体 */
  359. --font-sans: 'PingFang SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  360. --font-mono: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
  361. /* 字体大小 */
  362. --text-xs: 20rpx;
  363. --text-sm: 24rpx;
  364. --text-base: 28rpx;
  365. --text-lg: 32rpx;
  366. --text-xl: 36rpx;
  367. --text-2xl: 44rpx;
  368. --text-3xl: 56rpx;
  369. /* 过渡 */
  370. --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  371. --transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  372. --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  373. /* 兼容旧变量名 */
  374. --primary-color: var(--color-primary);
  375. --primary-light: var(--color-primary-500);
  376. --primary-lighter: var(--color-primary-400);
  377. --accent-color: var(--color-accent);
  378. --success-color: var(--color-success);
  379. --error-color: var(--color-error);
  380. --text-primary: var(--color-text-primary);
  381. --text-secondary: var(--color-text-secondary);
  382. --bg-primary: var(--color-bg-page);
  383. --bg-card: var(--color-bg-card);
  384. }
  385. /* --- 页面基础 --- */
  386. page {
  387. background-color: var(--color-bg-page);
  388. font-family: var(--font-sans);
  389. font-size: 14px;
  390. color: var(--color-text-primary);
  391. min-height: 100vh;
  392. -webkit-font-smoothing: antialiased;
  393. -moz-osx-font-smoothing: grayscale;
  394. transition: background-color var(--transition-base), color var(--transition-base);
  395. }
  396. /* --- 页面过渡动画 --- */
  397. page {
  398. animation: pageIn 0.28s cubic-bezier(0.22, 0.61, 0.36, 1);
  399. }
  400. @keyframes pageIn {
  401. from {
  402. opacity: 0;
  403. transform: translateX(16px);
  404. }
  405. to {
  406. opacity: 1;
  407. transform: translateX(0);
  408. }
  409. }
  410. /* --- 通用入场动画 --- */
  411. @keyframes fadeInUp {
  412. from { opacity: 0; transform: translateY(24px); }
  413. to { opacity: 1; transform: translateY(0); }
  414. }
  415. @keyframes fadeIn {
  416. from { opacity: 0; }
  417. to { opacity: 1; }
  418. }
  419. @keyframes scaleIn {
  420. from { opacity: 0; transform: scale(0.92); }
  421. to { opacity: 1; transform: scale(1); }
  422. }
  423. @keyframes shimmer {
  424. 0% { background-position: -200% 0; }
  425. 100% { background-position: 200% 0; }
  426. }
  427. @keyframes pulse-ring {
  428. 0% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.4); }
  429. 70% { box-shadow: 0 0 0 12rpx rgba(79, 70, 229, 0); }
  430. 100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); }
  431. }
  432. .list-item-enter {
  433. animation: fadeInUp 0.4s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
  434. }
  435. /* --- 交互反馈 --- */
  436. button:active,
  437. .btn:active {
  438. transform: scale(0.97);
  439. transition: transform 0.12s cubic-bezier(0.4, 0, 0.2, 1);
  440. }
  441. .touch-feedback:active {
  442. transform: scale(0.97);
  443. transition: transform 0.12s cubic-bezier(0.4, 0, 0.2, 1);
  444. opacity: 0.85;
  445. }
  446. /* 通用点击态 */
  447. .tappable {
  448. transition: transform var(--transition-fast), opacity var(--transition-fast);
  449. }
  450. .tappable:active {
  451. transform: scale(0.97);
  452. opacity: 0.8;
  453. }
  454. /* --- 渐变工具类 --- */
  455. .gradient-primary {
  456. background: linear-gradient(135deg, var(--color-primary-600), var(--color-primary-700));
  457. }
  458. .gradient-accent {
  459. background: linear-gradient(135deg, var(--color-accent), var(--color-accent-400));
  460. }
  461. .gradient-success {
  462. background: linear-gradient(135deg, #059669, var(--color-success));
  463. }
  464. /* --- 毛玻璃效果 --- */
  465. .glass {
  466. background: rgba(255, 255, 255, 0.85);
  467. backdrop-filter: blur(20px);
  468. -webkit-backdrop-filter: blur(20px);
  469. }
  470. .glass-dark {
  471. background: rgba(17, 24, 39, 0.85);
  472. backdrop-filter: blur(20px);
  473. -webkit-backdrop-filter: blur(20px);
  474. }
  475. /* --- 夜间模式 --- */
  476. page.dark-mode {
  477. --color-bg-page: #0f172a;
  478. --color-bg-card: #1e293b;
  479. --color-bg-surface: #1a2332;
  480. --color-bg-hover: #334155;
  481. --color-bg-divider: #334155;
  482. --color-text-primary: #f1f5f9;
  483. --color-text-secondary: #94a3b8;
  484. --color-text-tertiary: #64748b;
  485. background-color: #0f172a;
  486. color: #f1f5f9;
  487. }
  488. /* --- 工具类 --- */
  489. .text-ellipsis {
  490. overflow: hidden;
  491. text-overflow: ellipsis;
  492. white-space: nowrap;
  493. }
  494. .text-clamp-2 {
  495. display: -webkit-box;
  496. -webkit-line-clamp: 2;
  497. -webkit-box-orient: vertical;
  498. overflow: hidden;
  499. }
  500. text {
  501. user-select: none;
  502. }
  503. .safe-area-bottom {
  504. padding-bottom: constant(safe-area-inset-bottom);
  505. padding-bottom: env(safe-area-inset-bottom);
  506. }
  507. /* ============================================================
  508. 隐藏 uni-app 内置 tab bar(由 CustomTabBar 替代)
  509. ============================================================ */
  510. uni-app .uni-tabbar,
  511. uni-app uni-tabbar,
  512. .uni-app--showtabbar .uni-tabbar {
  513. display: none !important;
  514. }
  515. /* ============================================================
  516. 启动阻塞 UI(导航未就绪时显示)
  517. 使用 div 选择器确保生效
  518. ============================================================ */
  519. .boot-splash.is-hidden {
  520. display: none !important;
  521. }
  522. .boot-splash {
  523. position: fixed !important;
  524. top: 0 !important;
  525. left: 0 !important;
  526. right: 0 !important;
  527. bottom: 0 !important;
  528. display: flex !important;
  529. flex-direction: column !important;
  530. align-items: center !important;
  531. justify-content: center !important;
  532. background: linear-gradient(160deg, #4f46e5 0%, #7c3aed 60%, #a855f7 100%) !important;
  533. color: #ffffff !important;
  534. padding: 60rpx 80rpx !important;
  535. z-index: 99999 !important;
  536. box-sizing: border-box !important;
  537. }
  538. .boot-logo {
  539. width: 160rpx;
  540. height: 160rpx;
  541. border-radius: 40rpx;
  542. background: rgba(255, 255, 255, 0.18);
  543. display: flex;
  544. align-items: center;
  545. justify-content: center;
  546. margin-bottom: 28rpx;
  547. box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.18);
  548. }
  549. .boot-logo-icon {
  550. font-size: 96rpx;
  551. line-height: 1;
  552. }
  553. .boot-app-name {
  554. font-size: 44rpx;
  555. font-weight: 700;
  556. letter-spacing: 2rpx;
  557. margin-bottom: 80rpx;
  558. text-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.15);
  559. }
  560. .boot-state {
  561. display: flex;
  562. flex-direction: column;
  563. align-items: center;
  564. width: 100%;
  565. }
  566. .boot-loading {
  567. display: flex;
  568. flex-direction: column;
  569. align-items: center;
  570. gap: 24rpx;
  571. }
  572. .boot-spinner {
  573. width: 56rpx;
  574. height: 56rpx;
  575. border-radius: 50%;
  576. border: 4rpx solid rgba(255, 255, 255, 0.25);
  577. border-top-color: #ffffff;
  578. animation: bootSpin 0.9s linear infinite;
  579. }
  580. @keyframes bootSpin {
  581. to { transform: rotate(360deg); }
  582. }
  583. .boot-loading-text {
  584. font-size: 28rpx;
  585. font-weight: 600;
  586. color: #ffffff;
  587. }
  588. .boot-loading-hint {
  589. font-size: 22rpx;
  590. color: rgba(255, 255, 255, 0.7);
  591. }
  592. .boot-error {
  593. width: 100%;
  594. max-width: 560rpx;
  595. background: rgba(255, 255, 255, 0.95);
  596. border-radius: 28rpx;
  597. padding: 48rpx 40rpx;
  598. display: flex;
  599. flex-direction: column;
  600. align-items: center;
  601. color: #111827;
  602. box-shadow: 0 16rpx 48rpx rgba(0, 0, 0, 0.18);
  603. }
  604. .boot-error-icon {
  605. font-size: 80rpx;
  606. line-height: 1;
  607. margin-bottom: 20rpx;
  608. }
  609. .boot-error-title {
  610. font-size: 32rpx;
  611. font-weight: 700;
  612. color: #111827;
  613. margin-bottom: 16rpx;
  614. }
  615. .boot-error-message {
  616. font-size: 24rpx;
  617. color: #6b7280;
  618. text-align: center;
  619. line-height: 1.5;
  620. margin-bottom: 32rpx;
  621. word-break: break-all;
  622. }
  623. .boot-retry-btn {
  624. width: 100%;
  625. height: 88rpx;
  626. line-height: 88rpx;
  627. background: linear-gradient(135deg, #4f46e5, #7c3aed);
  628. color: #ffffff;
  629. font-size: 28rpx;
  630. font-weight: 600;
  631. border-radius: 44rpx;
  632. border: none;
  633. margin-bottom: 20rpx;
  634. box-shadow: 0 4rpx 16rpx rgba(79, 70, 229, 0.4);
  635. }
  636. .boot-retry-btn::after {
  637. border: none;
  638. }
  639. .boot-error-hint {
  640. font-size: 20rpx;
  641. color: #9ca3af;
  642. text-align: center;
  643. }
  644. </style>