feat: 完成 Passkey 能力与前后台加载优化
更新说明:\n1. 新增用户端与管理员端 Passkey 登录/注册/设备管理(最多3台,支持设备备注、删除设备)。\n2. 修复 Passkey 注册与登录流程中的浏览器/证书/CSRF相关问题,增强错误提示。\n3. 前台登录页改为独立入口,首屏仅加载必要资源,其他页面按需加载。\n4. 系统配置页改为静默获取金山文档状态,避免首屏阻塞,并优化状态展示为“检测中/已登录/未登录/异常”。\n5. 补充后端接口与页面渲染适配,修复多入口下样式依赖注入问题。\n6. 同步更新前后台构建产物与相关静态资源。
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import axios from 'axios'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
let lastToastKey = ''
|
||||
let lastToastAt = 0
|
||||
@@ -7,13 +6,76 @@ let lastToastAt = 0
|
||||
const RETRYABLE_STATUS = new Set([408, 425, 429, 500, 502, 503, 504])
|
||||
const MAX_RETRY_COUNT = 1
|
||||
const RETRY_BASE_DELAY_MS = 300
|
||||
const TOAST_STYLE_ID = 'zsglpt-lite-toast-style'
|
||||
|
||||
function ensureToastStyle() {
|
||||
if (typeof document === 'undefined') return
|
||||
if (document.getElementById(TOAST_STYLE_ID)) return
|
||||
const style = document.createElement('style')
|
||||
style.id = TOAST_STYLE_ID
|
||||
style.textContent = `
|
||||
.zsglpt-lite-toast-wrap {
|
||||
position: fixed;
|
||||
right: 16px;
|
||||
top: 16px;
|
||||
z-index: 9999;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
pointer-events: none;
|
||||
}
|
||||
.zsglpt-lite-toast {
|
||||
max-width: min(88vw, 420px);
|
||||
padding: 10px 12px;
|
||||
border-radius: 10px;
|
||||
color: #fff;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
box-shadow: 0 8px 20px rgba(15, 23, 42, 0.24);
|
||||
opacity: 0;
|
||||
transform: translateY(-6px);
|
||||
transition: all .18s ease;
|
||||
}
|
||||
.zsglpt-lite-toast.is-visible {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
.zsglpt-lite-toast.is-error {
|
||||
background: linear-gradient(135deg, #ef4444, #dc2626);
|
||||
}
|
||||
`
|
||||
document.head.appendChild(style)
|
||||
}
|
||||
|
||||
function ensureToastWrap() {
|
||||
if (typeof document === 'undefined') return null
|
||||
ensureToastStyle()
|
||||
let wrap = document.querySelector('.zsglpt-lite-toast-wrap')
|
||||
if (wrap) return wrap
|
||||
wrap = document.createElement('div')
|
||||
wrap.className = 'zsglpt-lite-toast-wrap'
|
||||
document.body.appendChild(wrap)
|
||||
return wrap
|
||||
}
|
||||
|
||||
function showLiteToast(message) {
|
||||
const wrap = ensureToastWrap()
|
||||
if (!wrap) return
|
||||
const node = document.createElement('div')
|
||||
node.className = 'zsglpt-lite-toast is-error'
|
||||
node.textContent = String(message || '请求失败')
|
||||
wrap.appendChild(node)
|
||||
requestAnimationFrame(() => node.classList.add('is-visible'))
|
||||
window.setTimeout(() => node.classList.remove('is-visible'), 2300)
|
||||
window.setTimeout(() => node.remove(), 2600)
|
||||
}
|
||||
|
||||
function toastErrorOnce(key, message, minIntervalMs = 1500) {
|
||||
const now = Date.now()
|
||||
if (key === lastToastKey && now - lastToastAt < minIntervalMs) return
|
||||
lastToastKey = key
|
||||
lastToastAt = now
|
||||
ElMessage.error(message)
|
||||
showLiteToast(message)
|
||||
}
|
||||
|
||||
function getCookie(name) {
|
||||
|
||||
Reference in New Issue
Block a user