diff --git a/admin/index.html b/admin/index.html index 11d743db2..afcd0c6ac 100755 --- a/admin/index.html +++ b/admin/index.html @@ -5,51 +5,13 @@ 后台管理系统 + + + + + + + + 甄养堂管理后台 + + + + + +
+
+ + 甄养堂管理后台 +

+ 正在打开工作台… + 加载时间较长,可继续等待或重新加载。 + 工作台未能打开,请检查网络后重试。 +

+ 重新加载 + +
+
+
+ + + diff --git a/admin/public/admin-boot.js b/admin/public/admin-boot.js new file mode 100644 index 000000000..eade65174 --- /dev/null +++ b/admin/public/admin-boot.js @@ -0,0 +1,31 @@ +// Deferred same-origin script: no remote dependency, inline handler or application API. +;(function () { + var boot = document.getElementById('admin-boot') + if (!boot) return + try { + // Only appearance keys are read. Vue/Pinia remains the owner after mount. + function readPreference(name) { + var record = JSON.parse(localStorage.getItem('like_admin_' + name) || 'null') + return record && (!record.expire || record.expire >= Date.now() / 1000) ? record.value : null + } + var appearance = readPreference('admin_ui') || document.documentElement.dataset.defaultAdminUi + var profile = appearance === 'v2' && readPreference('admin_ui_v2_setting') + var mode = appearance === 'v2' ? (profile && profile.colorMode) : localStorage.getItem('vueuse-color-scheme') + if (mode === 'dark' || mode === 'light') boot.dataset.mode = mode + } catch (_) { /* Browser privacy settings: CSS follows the system. */ } + + // A slow network is not a failure. Keep waiting unless the user chooses to reload. + var slow = setTimeout(function () { + if (boot.dataset.state === 'loading') boot.dataset.state = 'slow' + }, 12000) + function entryFailed(event) { + // Optional SDK/style/image errors must never turn a healthy app into a failure. + var script = event.target + if (script && script.tagName === 'SCRIPT' && script.type === 'module') boot.dataset.state = 'error' + } + window.addEventListener('error', entryFailed, true) + window.addEventListener('admin:mounted', function () { + clearTimeout(slow) + window.removeEventListener('error', entryFailed, true) + }, { once: true }) +})() diff --git a/admin/public/admin-loading.css b/admin/public/admin-loading.css new file mode 100644 index 000000000..befd81848 --- /dev/null +++ b/admin/public/admin-loading.css @@ -0,0 +1,50 @@ +/* Native entry, including the interval before Vue's first chunk is evaluated. */ +#admin-boot { + --boot-bg: #fafbfc; + --boot-ink: #323251; + --boot-muted: #596681; + --boot-accent: #5d87ff; + position: fixed; + inset: 0; + display: grid; + place-items: center; + background: var(--boot-bg); + color: var(--boot-ink); + text-align: center; + font: 14px/1.6 system-ui, "PingFang SC", "Microsoft YaHei", sans-serif; + pointer-events: none; +} +#admin-boot[data-mode="dark"] { + --boot-bg: #121318; --boot-ink: #e8ecf3; --boot-muted: #a8b2c7; --boot-accent: #829eff; +} +@media (prefers-color-scheme: dark) { + #admin-boot:not([data-mode="light"]) { + --boot-bg: #121318; --boot-ink: #e8ecf3; --boot-muted: #a8b2c7; --boot-accent: #829eff; + } +} +#admin-boot .boot-mark { display: block; margin: 0 auto 18px; color: var(--boot-accent); animation: boot-turn 1.6s linear infinite; } +#admin-boot strong { font-size: 18px; font-weight: 600; letter-spacing: .04em; } +#admin-boot p { margin: 5px 12px 0; color: var(--boot-muted); } +#admin-boot [data-message], #admin-boot-retry { display: none; } +#admin-boot[data-state="loading"] [data-message="loading"], +#admin-boot[data-state="slow"] [data-message="slow"], +#admin-boot[data-state="error"] [data-message="error"] { display: inline; } +#admin-boot[data-state="error"] .boot-mark { animation: none; } +#admin-boot:not([data-state="loading"]) #admin-boot-retry { + display: inline-block; margin-top: 10px; padding: 4px 12px; color: inherit; + text-decoration: underline; text-underline-offset: 3px; pointer-events: auto; +} +@keyframes boot-turn { to { transform: rotate(1turn); } } + +/* Indeterminate like the Art header. No fake percentage, overlay or scroll lock. */ +#admin-route-progress { + position: fixed; top: 0; left: 0; width: 100%; height: 3px; z-index: 2400; + background: var(--el-color-primary, #5d87ff); + pointer-events: none; transform-origin: left; transform: scaleX(.22); + animation: admin-route-advance 8s cubic-bezier(.12,.76,.22,1) forwards; +} +@keyframes admin-route-advance { to { transform: scaleX(.92); } } +@media (prefers-reduced-motion: reduce) { + #admin-boot .boot-mark, #admin-route-progress { animation: none; } + #admin-route-progress { transform: scaleX(.4); } +} diff --git a/admin/src/App.vue b/admin/src/App.vue index a4ee8644b..632c9fe5c 100755 --- a/admin/src/App.vue +++ b/admin/src/App.vue @@ -10,6 +10,7 @@ import useSettingStore, { useAdminDark } from './stores/modules/setting' import useUserStore from './stores/modules/user' import ChatNotifyToast from './components/chat-notify-toast/index.vue' import RevisitDueToast from './components/revisit-due-toast/index.vue' +import RouteLoadNotice from './components/route-load-notice/index.vue' const appStore = useAppStore() const settings = useSettingStore() @@ -58,6 +59,7 @@ watch(