db3dba1e96
- 合入 weiyuan 新功能前端:分佣 V2 / 伙伴工作台、智能路由、企业资金与分析、官网设置与预约演示等, semi-ui 已全部迁移到 antd 6 / @/components/ui,不重新引入 Semi - 分佣二级菜单与页头去重、伙伴入口探测(企业伙伴走企业中心「企业分佣」)、超管侧栏入口恢复 - 适配层 DatePicker / TimePicker 统一 onChange(Date|Date[]|null, 文本) 契约;生产构建剔除调试日志 - 图片链接刷新:同任务请求复用、后台刷新不弹全局错误、离页停止批量请求 - 恢复 bun.lock(与 package-lock.json 共存);docs 规范与 CHANGELOG 更新 - 停止跟踪 .env.playwright.local(本地登录凭据,已加入 .gitignore)
467 lines
18 KiB
HTML
467 lines
18 KiB
HTML
<!doctype html>
|
||
<html lang="zh">
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<script id="wl-legacy-polyfills">
|
||
// 旧内核补丁,针对 Chromium 88~98(停更的 Edge、Win10 LTSC 自带 Edge、国产壳浏览器)。
|
||
// 打包产物里用到、而这批内核缺失的 JS API 只有下面三个;其中 mermaid 分包在加载时
|
||
// 就调用 structuredClone,登录/注册等页面静态依赖它,缺了整页报错。
|
||
// 88 以下不在兜底范围:那些内核连 :is() 选择器都不认,暗色变体等样式本身就会失效。
|
||
// 每项都只在缺失时才定义,对新浏览器没有任何影响。内联脚本不经过转译,语法须停留在
|
||
// ES5;且必须排在所有脚本之前。
|
||
// 样式侧对应的兜底见 vite-plugin-legacy-css-layers.js。
|
||
(function () {
|
||
var define = function (target, name, value) {
|
||
if (typeof target[name] === 'function') return;
|
||
Object.defineProperty(target, name, {
|
||
value: value,
|
||
writable: true,
|
||
configurable: true,
|
||
});
|
||
};
|
||
|
||
// Chromium 92
|
||
var at = function (index) {
|
||
var i = Math.trunc(index) || 0;
|
||
if (i < 0) i += this.length;
|
||
return i < 0 || i >= this.length ? undefined : this[i];
|
||
};
|
||
define(Array.prototype, 'at', at);
|
||
define(String.prototype, 'at', at);
|
||
define(Object.getPrototypeOf(Int8Array).prototype, 'at', at);
|
||
|
||
// Chromium 93
|
||
define(Object, 'hasOwn', function (object, key) {
|
||
return Object.prototype.hasOwnProperty.call(object, key);
|
||
});
|
||
|
||
// Chromium 98。按调用方实际传入的数据形态实现:普通对象/数组/Date/RegExp/Map/Set/
|
||
// 二进制缓冲,循环引用与共享引用在克隆结果里保持原有关系;函数与 symbol 按规范抛
|
||
// DataCloneError。Error、Blob 等宿主对象和 transfer 参数未实现(会被当成普通对象)。
|
||
define(window, 'structuredClone', function (value) {
|
||
var seen = new Map();
|
||
var Shared = window.SharedArrayBuffer;
|
||
var remember = function (source, copy) {
|
||
seen.set(source, copy);
|
||
return copy;
|
||
};
|
||
var clone = function (v) {
|
||
if (typeof v === 'function' || typeof v === 'symbol') {
|
||
throw new DOMException('uncloneable value', 'DataCloneError');
|
||
}
|
||
if (v === null || typeof v !== 'object') return v;
|
||
if (seen.has(v)) return seen.get(v);
|
||
if (v instanceof Date) return remember(v, new Date(v.getTime()));
|
||
if (v instanceof RegExp) {
|
||
return remember(v, new RegExp(v.source, v.flags));
|
||
}
|
||
if (v instanceof ArrayBuffer) return remember(v, v.slice(0));
|
||
// 共享内存按规范是共享而非复制;不单列的话它会落进普通对象分支变成 {}
|
||
if (Shared && v instanceof Shared) return v;
|
||
if (ArrayBuffer.isView(v)) {
|
||
// 缓冲区也走 clone:多个视图共享的缓冲区克隆后仍是同一份
|
||
var buf = clone(v.buffer);
|
||
var size = v instanceof DataView ? v.byteLength : v.length;
|
||
return remember(v, new v.constructor(buf, v.byteOffset, size));
|
||
}
|
||
var out;
|
||
if (v instanceof Map) {
|
||
out = remember(v, new Map());
|
||
v.forEach(function (item, key) {
|
||
out.set(clone(key), clone(item));
|
||
});
|
||
return out;
|
||
}
|
||
if (v instanceof Set) {
|
||
out = remember(v, new Set());
|
||
v.forEach(function (item) {
|
||
out.add(clone(item));
|
||
});
|
||
return out;
|
||
}
|
||
out = remember(v, Array.isArray(v) ? new Array(v.length) : {});
|
||
Object.keys(v).forEach(function (key) {
|
||
var copy = clone(v[key]);
|
||
if (key !== '__proto__') {
|
||
out[key] = copy;
|
||
return;
|
||
}
|
||
// 唯独这个键不能赋值:赋值改写的是原型,而不是落成自有属性
|
||
Object.defineProperty(out, key, {
|
||
value: copy,
|
||
writable: true,
|
||
enumerable: true,
|
||
configurable: true,
|
||
});
|
||
});
|
||
return out;
|
||
};
|
||
return clone(value);
|
||
});
|
||
})();
|
||
</script>
|
||
<!-- favicon: 后端启动时把 __WL_BRAND_FAVICON__ 替换为 common.Logo(未配置时为 /logo.svg);
|
||
dev 模式占位符未替换时,下面的内联脚本会重写 href 为 /logo.svg。 -->
|
||
<link id="wl-favicon" rel="icon" href="__WL_BRAND_FAVICON__" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||
<!-- 浅/暗双色 theme-color,跟随系统偏好 —— 移动端浏览器顶栏不再"亮色背景上一条白条" -->
|
||
<meta
|
||
name="theme-color"
|
||
content="#fafbfc"
|
||
media="(prefers-color-scheme: light)"
|
||
/>
|
||
<meta
|
||
name="theme-color"
|
||
content="#0f1115"
|
||
media="(prefers-color-scheme: dark)"
|
||
/>
|
||
<meta
|
||
name="description"
|
||
content="OpenAI 接口聚合管理,支持多种渠道包括 Azure,可用于二次分发管理 key,仅单可执行文件,已打包好 Docker 镜像,一键部署,开箱即用"
|
||
/>
|
||
<!-- 中性标题;内联脚本若解析到品牌名会覆盖。换品牌时 tab 不会闪老品牌字样。 -->
|
||
<title>Loading</title>
|
||
|
||
<!--
|
||
首屏白屏过渡 - 极简加载动画。
|
||
品牌(logo / 名称 / favicon)不写死:
|
||
1. 后端启动时把 __WL_BRAND_NAME__ / __WL_BRAND_LOGO__ / __WL_BRAND_FAVICON__ 替换为系统配置
|
||
2. 内联脚本再用 localStorage 缓存兜底(返回访客拿到最新值)
|
||
3. 都没有时回退到品牌名首字母字母章,绝不出现固定品牌标识
|
||
品牌色用 CSS 变量:下面的 theme-presplash 脚本会把上一次保存的主题 CSS 同步插入,
|
||
首帧就已经是品牌色;首次访问时回落到 var() 兜底。
|
||
-->
|
||
<script>
|
||
// 暗色预判:在 splash 首帧 paint 之前同步给 <html> 打上 .dark 类。
|
||
// 镜像 Theme/index.jsx 的逻辑:'dark'(默认)→ 强制暗;'auto' → 跟随系统偏好;'light' → 浅。
|
||
// 不在 <head> 里设 body[theme-mode],因为 body 还没解析;
|
||
// theme.js 的选择器是 `html.dark, body[theme-mode="dark"]` 的 OR,只设 html.dark 已足够触发暗色变量。
|
||
// ThemeProvider mount 后会把 body 属性补齐,本脚本只是把"决策时机"从 React mount 提到了 paint 之前。
|
||
(function () {
|
||
try {
|
||
var pref = localStorage.getItem('theme-mode') || 'dark';
|
||
var isDark =
|
||
pref === 'dark' ||
|
||
(pref === 'auto' &&
|
||
window.matchMedia &&
|
||
window.matchMedia('(prefers-color-scheme: dark)').matches);
|
||
if (isDark) document.documentElement.classList.add('dark');
|
||
} catch (e) {
|
||
/* 隐私模式(localStorage 不可用):与默认主题保持一致,直接落深色 */
|
||
document.documentElement.classList.add('dark');
|
||
}
|
||
})();
|
||
// 预注入上次保存的主题 CSS,消除"兜底色 → 品牌色"首帧跳变。
|
||
// 必须放在 splash <style> 之前/同步执行,才能在第一次 paint 时已就位。
|
||
(function () {
|
||
try {
|
||
var css = localStorage.getItem('theme-css-cache');
|
||
if (!css) return;
|
||
var s = document.createElement('style');
|
||
s.id = 'theme-presplash';
|
||
s.textContent = css;
|
||
document.head.appendChild(s);
|
||
} catch (e) {
|
||
/* 隐私模式 / 配额满:静默回退到兜底色 */
|
||
}
|
||
})();
|
||
</script>
|
||
<style>
|
||
.wl-loading {
|
||
display: flex;
|
||
flex-direction: column;
|
||
justify-content: center;
|
||
align-items: center;
|
||
height: 100vh;
|
||
width: 100%;
|
||
background: #fafbfc;
|
||
font-family:
|
||
-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||
user-select: none;
|
||
overflow: hidden;
|
||
position: relative;
|
||
}
|
||
/* 居中柔光 —— 跟随主题色 */
|
||
.wl-loading::before {
|
||
content: '';
|
||
position: absolute;
|
||
width: 420px;
|
||
height: 420px;
|
||
border-radius: 50%;
|
||
background: radial-gradient(
|
||
circle,
|
||
var(--brand-primary-soft, rgba(22, 104, 220, 0.1)),
|
||
transparent 70%
|
||
);
|
||
filter: blur(24px);
|
||
pointer-events: none;
|
||
}
|
||
.wl-box {
|
||
position: relative;
|
||
z-index: 1;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
animation: wl-fade 0.5s ease-out both;
|
||
}
|
||
@keyframes wl-fade {
|
||
from {
|
||
opacity: 0;
|
||
transform: translateY(12px);
|
||
}
|
||
to {
|
||
opacity: 1;
|
||
transform: translateY(0);
|
||
}
|
||
}
|
||
|
||
/* logo + 旋转环 */
|
||
.wl-logo-ring {
|
||
position: relative;
|
||
width: 84px;
|
||
height: 84px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
margin-bottom: 22px;
|
||
}
|
||
.wl-logo-ring::before {
|
||
content: '';
|
||
position: absolute;
|
||
inset: 0;
|
||
border-radius: 50%;
|
||
border: 3px solid var(--brand-primary-soft, rgba(22, 104, 220, 0.16));
|
||
border-top-color: var(--brand-primary, #1668dc);
|
||
animation: wl-spin 0.9s linear infinite;
|
||
}
|
||
@keyframes wl-spin {
|
||
to {
|
||
transform: rotate(360deg);
|
||
}
|
||
}
|
||
|
||
.wl-logo-slot {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
width: 56px;
|
||
height: 56px;
|
||
}
|
||
.wl-logo {
|
||
width: 56px;
|
||
height: 56px;
|
||
border-radius: 14px;
|
||
object-fit: cover;
|
||
display: block;
|
||
}
|
||
/* 首字母字母章兜底 */
|
||
.wl-mono {
|
||
width: 56px;
|
||
height: 56px;
|
||
border-radius: 14px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
font-size: 26px;
|
||
font-weight: 700;
|
||
color: #fff;
|
||
background: linear-gradient(
|
||
135deg,
|
||
var(--brand-gradient-from, #4096ff),
|
||
var(--brand-gradient-to, #0958d9)
|
||
);
|
||
}
|
||
|
||
.wl-brand {
|
||
font-size: 20px;
|
||
font-weight: 700;
|
||
letter-spacing: 1px;
|
||
color: var(--brand-primary, #0958d9);
|
||
margin-bottom: 14px;
|
||
min-height: 24px;
|
||
}
|
||
.wl-text {
|
||
font-size: 13px;
|
||
color: #94a3b8;
|
||
letter-spacing: 0.5px;
|
||
animation: wl-blink 1.6s ease-in-out infinite;
|
||
}
|
||
@keyframes wl-blink {
|
||
0%,
|
||
100% {
|
||
opacity: 0.45;
|
||
}
|
||
50% {
|
||
opacity: 1;
|
||
}
|
||
}
|
||
|
||
/* 暗色:系统偏好(首屏 ThemeContext 还没运行)+ 项目手动暗色 */
|
||
@media (prefers-color-scheme: dark) {
|
||
.wl-loading {
|
||
background: #0f1115;
|
||
}
|
||
.wl-text {
|
||
color: #64748b;
|
||
}
|
||
}
|
||
html.dark .wl-loading,
|
||
body[theme-mode='dark'] .wl-loading {
|
||
background: #0f1115;
|
||
}
|
||
html.dark .wl-text,
|
||
body[theme-mode='dark'] .wl-text {
|
||
color: #64748b;
|
||
}
|
||
|
||
/* 无障碍:尊重系统"减少动效"偏好 —— 关闭旋转、淡入、闪烁 */
|
||
@media (prefers-reduced-motion: reduce) {
|
||
.wl-logo-ring::before,
|
||
.wl-box,
|
||
.wl-text {
|
||
animation: none !important;
|
||
}
|
||
/* 静态指示:环改为完整一圈淡色,仍保留"正在加载"暗示 */
|
||
.wl-logo-ring::before {
|
||
border-color: var(--brand-primary, #1668dc);
|
||
opacity: 0.6;
|
||
}
|
||
.wl-text {
|
||
opacity: 0.75;
|
||
}
|
||
}
|
||
</style>
|
||
</head>
|
||
|
||
<body>
|
||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||
<div id="root">
|
||
<!-- 首屏加载动画 - React 挂载后自动替换。data-* 由后端启动时注入。 -->
|
||
<div
|
||
id="wl-splash"
|
||
class="wl-loading"
|
||
data-brand="__WL_BRAND_NAME__"
|
||
data-logo="__WL_BRAND_LOGO__"
|
||
>
|
||
<div class="wl-box">
|
||
<div class="wl-logo-ring"><span class="wl-logo-slot"></span></div>
|
||
<div class="wl-brand"></div>
|
||
<div class="wl-text"></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<script>
|
||
// 解析品牌 + 渲染 splash 文案 / logo / favicon / title。
|
||
// 优先级:后端注入的 data-* > localStorage > 终极空串。
|
||
//
|
||
// 三阶段分离 —— window.__WL_BRAND__ 是硬不变量:
|
||
// 阶段 1:解析品牌(用 localStorage 兜底)并挂到 window;
|
||
// 这一步在 splash 元素检查之前,即使 splash markup 缺失(理论不该发生),
|
||
// React 端的 getSystemName/getLogo 也已经能从 window 拿到品牌。
|
||
// 阶段 2:若 splash 元素不存在则跳过后续渲染。
|
||
// 阶段 3:渲染 splash 文案 / logo / favicon / title。失败不影响 window 已设。
|
||
(function () {
|
||
var PLACEHOLDER_PREFIX = '__WL_';
|
||
var clean = function (v) {
|
||
if (!v) return '';
|
||
if (v.indexOf(PLACEHOLDER_PREFIX) === 0) return ''; // dev 模式占位符未被后端替换
|
||
if (v === 'undefined' || v === 'null') return '';
|
||
return v;
|
||
};
|
||
|
||
// ===== 阶段 1:解析 + 挂 window =====
|
||
// 区分三种"data-* 看起来是空"的语义,避免管理员 unset Logo 后
|
||
// splash 还从 localStorage 里捞出上一版的旧 logo 闪一下:
|
||
// (a) raw === null → attribute 缺失(splash markup 被改)→ 回退 LS
|
||
// (b) raw 以 '__WL_' 开头 → dev 模式占位符未被后端替换 → 回退 LS
|
||
// (c) raw === '' 或真实值 → 后端真实注入(含管理员主动 unset)→ trust,不回退 LS
|
||
var el = document.getElementById('wl-splash');
|
||
var rawBrand = el ? el.getAttribute('data-brand') : null;
|
||
var rawLogo = el ? el.getAttribute('data-logo') : null;
|
||
var brandIsDevPH = !!(
|
||
rawBrand && rawBrand.indexOf(PLACEHOLDER_PREFIX) === 0
|
||
);
|
||
var logoIsDevPH = !!(
|
||
rawLogo && rawLogo.indexOf(PLACEHOLDER_PREFIX) === 0
|
||
);
|
||
var name = brandIsDevPH ? '' : clean(rawBrand);
|
||
var logo = logoIsDevPH ? '' : clean(rawLogo);
|
||
try {
|
||
if ((!el || brandIsDevPH) && !name)
|
||
name = clean(localStorage.getItem('system_name'));
|
||
if ((!el || logoIsDevPH) && !logo)
|
||
logo = clean(localStorage.getItem('logo'));
|
||
} catch (e) {
|
||
/* 隐私模式 localStorage 不可用:name/logo 保持空,React 端走终极兜底 */
|
||
}
|
||
// 极端环境(CSP 严格 / 扩展冻结 window)下赋值可能抛错。
|
||
// 包一层 try 防止把阶段 3 的 splash 渲染也带挂。
|
||
try {
|
||
window.__WL_BRAND__ = { name: name, logo: logo };
|
||
} catch (e) {
|
||
/* window 不可写:React 端 utils 会走终极兜底 'Weelinking'/'/logo.svg' */
|
||
}
|
||
|
||
// ===== 阶段 2:splash 缺失则跳过渲染 =====
|
||
if (!el) return;
|
||
|
||
// ===== 阶段 3:渲染 splash =====
|
||
try {
|
||
// ---- 文案:navigator.language 判定 zh / en ----
|
||
var lang = (navigator.language || 'zh').toLowerCase();
|
||
var loadingText =
|
||
lang.indexOf('zh') === 0 ? '加载中...' : 'Loading...';
|
||
var textEl = el.querySelector('.wl-text');
|
||
if (textEl) textEl.textContent = loadingText;
|
||
|
||
// ---- 品牌名 + 标题 ----
|
||
var brandEl = el.querySelector('.wl-brand');
|
||
if (brandEl && name) brandEl.textContent = name;
|
||
// 标题始终设值:有品牌名用品牌名,否则保持静态 "Loading"
|
||
if (name) document.title = name;
|
||
|
||
// ---- favicon:占位符未替换时回落 /logo.svg;有 logo URL 时覆盖 ----
|
||
var favEl = document.getElementById('wl-favicon');
|
||
if (favEl) {
|
||
var fav = favEl.getAttribute('href');
|
||
if (!fav || fav.indexOf(PLACEHOLDER_PREFIX) === 0) {
|
||
favEl.setAttribute('href', logo || '/logo.svg');
|
||
} else if (logo && fav !== logo) {
|
||
// localStorage 比后端启动注入新(管理员热改了 Logo),动态覆盖
|
||
favEl.setAttribute('href', logo);
|
||
}
|
||
}
|
||
|
||
// ---- logo / 字母章 ----
|
||
var slot = el.querySelector('.wl-logo-slot');
|
||
var monoChar = (name || '').trim();
|
||
monoChar = monoChar ? Array.from(monoChar)[0].toUpperCase() : '';
|
||
var renderMono = function () {
|
||
if (!slot) return;
|
||
slot.innerHTML = '';
|
||
// 没名字也没 logo:旋转环里留空,避免出现"空着的渐变色方块" UX 漏洞
|
||
if (!monoChar) return;
|
||
var d = document.createElement('div');
|
||
d.className = 'wl-mono';
|
||
d.textContent = monoChar;
|
||
slot.appendChild(d);
|
||
};
|
||
if (slot && logo) {
|
||
var img = document.createElement('img');
|
||
img.className = 'wl-logo';
|
||
img.alt = name || 'logo';
|
||
img.onerror = renderMono;
|
||
img.src = logo;
|
||
slot.appendChild(img);
|
||
} else {
|
||
renderMono();
|
||
}
|
||
} catch (e) {
|
||
/* splash 渲染挂了不影响 window var 已设 —— React 端仍能正确读到品牌 */
|
||
}
|
||
})();
|
||
</script>
|
||
<script type="module" src="/src/index.jsx"></script>
|
||
</body>
|
||
</html>
|