- 将原移动端页面重命名为 Mobile*,新增 22 个 Desktop* 视图与 DesktopShell 布局体系 - 路由入口改为 Wrapper 视图,通过 useViewport(≥1024px)自动切换移动/桌面端 - 新增投注单面板、盘口弹层、联赛侧栏、数据表格等桌面组件及独立样式令牌 - 扩展 betSlip store、串关筛选、冠军盘、Toast/悬浮信箱等交互与三语 i18n - 公告/消息 Hub 拆分移动与桌面实现;API 投注/钱包/充值记录支持 pageSize 分页
45 lines
1.4 KiB
JavaScript
45 lines
1.4 KiB
JavaScript
import fs from 'fs';
|
|
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
const root = path.join(__dirname, '..');
|
|
|
|
function flatten(obj, prefix = '') {
|
|
const out = {};
|
|
for (const [k, v] of Object.entries(obj)) {
|
|
const key = prefix ? `${prefix}.${k}` : k;
|
|
if (v && typeof v === 'object' && !Array.isArray(v)) Object.assign(out, flatten(v, key));
|
|
else out[key] = v;
|
|
}
|
|
return out;
|
|
}
|
|
|
|
function extractKeysFromDir(dir) {
|
|
const keys = new Set();
|
|
const re = /\bt\s*\(\s*['"`]([^'"`]+)['"`]/g;
|
|
function walk(d) {
|
|
for (const ent of fs.readdirSync(d, { withFileTypes: true })) {
|
|
const p = path.join(d, ent.name);
|
|
if (ent.isDirectory()) walk(p);
|
|
else if (ent.name.endsWith('.vue')) {
|
|
const src = fs.readFileSync(p, 'utf8');
|
|
let m;
|
|
while ((m = re.exec(src))) keys.add(m[1]);
|
|
}
|
|
}
|
|
}
|
|
walk(dir);
|
|
return keys;
|
|
}
|
|
|
|
const zhMod = await import('../src/i18n/zh-CN.ts');
|
|
const zh = flatten(zhMod.default);
|
|
const dirs = ['src/views/desktop', 'src/components/desktop'].map((d) => path.join(root, d));
|
|
const used = new Set();
|
|
for (const d of dirs) extractKeysFromDir(d).forEach((k) => used.add(k));
|
|
|
|
const missing = [...used].filter((k) => !(k in zh)).sort();
|
|
console.log(`Missing keys (${missing.length}):`);
|
|
missing.forEach((k) => console.log(` ${k}`));
|