feat(admin): 实现只读词库管理后台

- 新增 Spring Boot 3 后端:JWT 认证、六个业务模块查询接口、Caffeine 聚合缓存与只读事务约束
- 新增 Vue 3 管理前端:登录、概览、词书、词条、词根词族、近反义词与数据质量
- 补充前后端 README、环境变量示例与本地构建部署说明
- 同步 OpenSpec 变更文档与任务进度(64/65,只读数据库账号待确认)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
voidandClaude Sonnet 4.6 committed 2026-11-08 22:55:15 +08:00
1 parent 131c2b6353
commit 4e68ba3890
137 files changed
+15423 -10

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
# 默认连接真实后端;后端未就绪时可临时设为 true 使用本地同形 mock
VITE_USE_MOCK=false
VITE_API_BASE_URL=/api
VITE_COVER_BASE_URL=https://static.beingfine.cn
+74 -4
View File
@@ -1,7 +1,77 @@
# frontend — 单词管理前端
# frontend — 词库管理前端
占位目录,技术栈待定。
Vue 3 + Vite + TypeScript + Element Plus + ECharts。
用途:浏览、检索、编辑与管理由 `importer` 导入的词书、词条及其关联数据。
## 功能
后续确定技术栈与目录结构后在此实现。
- 单管理员登录、token 持久化、路由守卫与 401 自动跳转。
- 概览:六项 KPI、考试分布、词书规模排行、词性分布、质量红绿灯、跨域覆盖度,支持强制刷新聚合缓存。
- 词书:列表筛选、详情、词条清单分页与搜索、封面占位。
- 词条:搜索列表 + 右侧抽屉详情,义项/短语/例句/收录词书按 Tab 懒加载,支持空状态与分页。
- 词根词族:词素、单词卡片、词族列表与详情,词族树形族谱按节点懒加载。
- 近反义词:组规模分布图、词头列表、词头详情(分考试近义组与反义词)。
- 数据质量:指标摘要与口径提示、声明与实际差异、缺失引用明细、跨域覆盖度、实体跳转。
## 开发
```powershell
cd frontend
npm install
npm run dev
```
默认地址:http://127.0.0.1:5173。开发服务器将 `/api` 代理到 `http://127.0.0.1:8080`;如后端端口不同:
```powershell
$env:VITE_PROXY_TARGET = 'http://127.0.0.1:18080'
npm run dev
```
后端未启动时可临时使用本地 mock:
```powershell
$env:VITE_USE_MOCK = 'true'
npm run dev
```
## 构建
```powershell
npm run build
```
产物在 `dist/`。构建前会执行 `vue-tsc --noEmit` 类型检查。
## 环境变量
复制 `.env.example` 为 `.env`:
```text
VITE_USE_MOCK=false
VITE_API_BASE_URL=/api
VITE_COVER_BASE_URL=https://static.beingfine.cn
```
- `VITE_USE_MOCK`:仅在明确设为 `true` 时使用本地 mock。
- `VITE_API_BASE_URL`:接口前缀,默认 `/api`。
- `VITE_COVER_BASE_URL`:词书封面 CDN 前缀。
## 目录
```text
src/
api/ Axios 封装、各模块接口与类型
charts/ ECharts 配置
components/ DataTable、CoverImage、StatCard、SectionPanel
layouts/ AdminLayout 侧边栏布局
mocks/ 离线开发用的概览数据快照
router/ 路由与登录守卫
stores/ 认证状态
styles/ 全局基础样式
utils/ 封面地址、存储键、HTML 文本清理
views/ 登录、概览、词书、词条、词根词族、近反义词、数据质量
```
## 生产部署
`npm run build` 后将 `dist/` 交给 Nginx,并把 `/api` 反向代理到后端。示例配置见 [`../backend/README.md`](../backend/README.md) 的部署章节。
+16
View File
@@ -0,0 +1,16 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="icon"
href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='8' fill='%232563eb'/%3E%3Ctext x='16' y='22' font-size='18' font-family='Arial' font-weight='bold' fill='white' text-anchor='middle'%3EW%3C/text%3E%3C/svg%3E"
/>
<title>Word Market · 词库管理后台</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
+2202
View File
File diff suppressed because it is too large. Load diff
+27
View File
@@ -0,0 +1,27 @@
{
"name": "word-market-frontend",
"private": true,
"version": "0.1.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vue-tsc --noEmit && vite build",
"preview": "vite preview"
},
"dependencies": {
"@element-plus/icons-vue": "^2.3.1",
"axios": "^1.7.9",
"echarts": "^5.5.1",
"element-plus": "^2.8.8",
"pinia": "^2.3.0",
"vue": "^3.5.13",
"vue-router": "^4.5.0"
},
"devDependencies": {
"@types/node": "^22.10.2",
"@vitejs/plugin-vue": "^5.2.1",
"typescript": "~5.7.2",
"vite": "^6.0.5",
"vue-tsc": "^2.2.0"
}
}
+61
View File
@@ -0,0 +1,61 @@
# UI 原型(throwaway)
> **方案 A(经典后台)已选定。** 原型现已覆盖概览与五个业务模块;正式实现见 `frontend/src/`。
>
> **这是可丢弃的 UI 原型,不是生产代码。**
## 运行
在仓库根目录执行:
```powershell
python -m http.server 8090 --directory frontend/prototype
```
打开 http://127.0.0.1:8090/index.html 即可。也可以直接双击 `index.html`(依赖 CDN,需要联网)。
## 页面
| 页面 | URL | 内容 |
|---|---|---|
| 概览 | `?page=overview&variant=A` | KPI、考试分布、词性分布、词书排行、质量红绿灯;支持 A/B/C 方案切换 |
| 词书管理 | `?page=books` | 词书列表、考试/关键词/文件状态筛选、词书详情与词条清单 |
| 词书详情 | `?page=books&id=15` | SAT10000 信息卡 + 12 条词条清单 |
| 词条词典 | `?page=entries` | 词条搜索与列表 |
| 词条详情 | `?page=entries&id=26132` | 右侧抽屉展示 `cinema` 基本信息 + 义项/短语/例句/易混词/收录词书五个 Tab |
| 词根词族 | `?page=morphology` | 词素、单词卡片、词族、树形族谱四个 Tab |
| 近反义词 | `?page=synonyms` | 词头列表 |
| 近反义词详情 | `?page=synonyms&id=2411` | `gain` 义项、分考试近义组、组规模分布、反义词 |
| 数据质量 | `?page=quality` | 7 项摘要、18 本声明差异、缺失引用、跨域覆盖度 |
侧边栏可切换模块;词书与近义词列表中的“查看”进入详情页;词条列表点击行或“查看”在右侧非模态抽屉中展开详情,抽屉打开时仍可继续点击其他词条或切换模块,关闭抽屉即回到列表;词条与词根词族支持 Tab 切换;概览页底部条和键盘 `←` / `→` 切换 A/B/C。
## 数据
全部来自 MySQL `word_market` 的真实快照(2026-11-08),不是编造内容:
- 词书 10 本、词书词条 12 条
- 词条 10 条;`cinema` 含 2 个义项、3 个短语、6 条例句、5 个易混词、8 本收录词书
- 词素 12 个、卡片 6 张、词族 8 个;`behave` 含 5 个变体与 4 个小组
- 近义词头 8 个;`gain` 含 5 个义项、10 个近义组、2 组反义词
- 质量差异 18 本词书、19 个无义项近义词头
## 文件
- `index.html`:入口、CDN 依赖、页面路由与方案切换
- `data.js`:概览数据快照
- `data-modules.js`:模块数据样本
- `variant-a.js` / `variant-b.js` / `variant-c.js`:概览三方案
- `module-shell.js`:模块页共用的 A 风格侧边栏布局
- `view-books.js` / `view-entries.js` / `view-morphology.js` / `view-synonyms.js` / `view-quality.js`
- `styles.css`:概览与通用样式
- `modules.css`:模块页样式
- `screenshots/`:各页面截图
## 仍待确认
- 词条抽屉宽度是否合适,是否需要支持拖拽调整宽度。
- 词书详情是否需要展示内容版本、发布时间等目录字段。
- 词条抽屉内例句是否按例句组折叠,而不是平铺。
- 族谱是否需要支持逐层懒加载,而不是默认展开全部。
- 质量页的差异行是否需要提供“定位到词书”的钻取。
+214
View File
@@ -0,0 +1,214 @@
// PROTOTYPE ONLY — real data samples from MySQL word_market (2026-11-08).
window.MODULE_DATA = {
books: [
{ id: 15, code: 'SAT', name: 'SAT10000', exam: '未归类', declared: 10001, actual: 10001, coverPath: '/dicts/v3/img_032516463440_24_opt.png', hasFile: true },
{ id: 1170, code: 'LLYC2027', name: '2027恋练有词考研英语词汇', exam: '考研', declared: 7969, actual: 7969, coverPath: '/dicts/v3/img_122613473672_1017_opt.png', hasFile: true },
{ id: 557, code: 'LLYCKY2024', name: '2024恋练有词考研英语词汇', exam: '考研', declared: 7949, actual: 7949, coverPath: '/dicts/v3/img_032615238520_111_opt.png', hasFile: true },
{ id: 740, code: 'LLYCKY2026', name: '2026恋练有词考研英语词汇', exam: '考研', declared: 7941, actual: 7941, coverPath: '/dicts/v3/img_122414371550_51_opt.png', hasFile: true },
{ id: 630, code: 'LLYCKY2025', name: '2025恋练有词考研英语词汇', exam: '考研', declared: 7940, actual: 7940, coverPath: '/dicts/v3/img_032615097259_51_opt.png', hasFile: true },
{ id: 508, code: 'LLYCK2023N', name: '2023恋练有词考研英语词汇', exam: '考研', declared: 7919, actual: 7919, coverPath: '/dicts/v3/img_042716404904_126_opt.png', hasFile: true },
{ id: 331, code: 'LLYCKY2023', name: '2023恋练有词考研英语词汇', exam: '考研', declared: 7919, actual: 7919, coverPath: '/dicts/v3/img_032617141081_126_opt.png', hasFile: true },
{ id: 841, code: 'HZBCET6N', name: '英语六级 你还在背单词吗(新版)', exam: '六级', declared: 7799, actual: 7799, coverPath: '/dicts/v3/img_081109464902_93_opt.png', hasFile: true },
{ id: 519, code: 'PETS5', name: '全国英语等级考试第五级', exam: '未归类', declared: 7527, actual: 7527, coverPath: '/dicts/v3/img_032516041386_40_opt.png', hasFile: true },
{ id: 819, code: 'KYLX2026', name: '考研词汇 词根联想记忆法 乱序版', exam: '考研', declared: 7349, actual: 7349, coverPath: '/dicts/v3/img_071615349355_34_opt.png', hasFile: true }
],
bookEntries: [
{ displayWord: 'abandon', headword: 'abandon', pronunciation: 'əˈbændən', definition: 'vt. 放弃;抛弃;沉湎于 n. 放任,放纵', seq: 1 },
{ displayWord: 'surge', headword: 'surge', pronunciation: 'sɜːrdʒ', definition: 'vi. 涌动;激增 n. 激增;(感情的) 突发', seq: 1 },
{ displayWord: 'promotion', headword: 'promotion', pronunciation: 'prəˈmoʊʃn', definition: 'n. 晋升;促销;促进;晋级', seq: 2 },
{ displayWord: 'prompt', headword: 'prompt', pronunciation: 'prɑːmpt', definition: 'vt. 促使;引起 adj. 迅速的;准时的', seq: 2 },
{ displayWord: 'competitive', headword: 'competitive', pronunciation: 'kəmˈpetətɪv', definition: 'adj. 竞争的;有竞争力的;好胜的', seq: 3 },
{ displayWord: 'efficient', headword: 'efficient', pronunciation: 'ɪˈfɪʃnt', definition: 'adj. 效率高的', seq: 4 },
{ displayWord: 'uneasy', headword: 'uneasy', pronunciation: 'ʌnˈiːzi', definition: 'adj. 不安的,不自在的;不稳定的', seq: 4 },
{ displayWord: 'inquiry', headword: 'inquiry', pronunciation: 'ˈɪnkwəri', definition: 'n. 询问,打听;调查,探究', seq: 5 },
{ displayWord: 'stock', headword: 'stock', pronunciation: 'stɑːk', definition: 'n. 库存;储备物;股票;家畜', seq: 6 },
{ displayWord: 'exploit', headword: 'exploit', pronunciation: 'ɪkˈsplɔɪt', definition: 'vt. 剥削;利用;开采 n. 英勇的行为', seq: 7 },
{ displayWord: 'diagnose', headword: 'diagnose', pronunciation: 'ˌdaɪəɡˈnoʊs', definition: 'vt. vi. 诊断 (病症)', seq: 9 },
{ displayWord: 'advertise', headword: 'advertise', pronunciation: 'ˈædvərtaɪz', definition: 'vi. vt. 为…做广告;征聘', seq: 10 }
],
entries: [
{ id: 26132, headword: 'cinema', indexWord: 'cinema', pronunciation: 'ˈsɪnəmə', definition: 'n. 电影院;电影艺术,电影业', occurrence: 91, senses: 2 },
{ id: 2763, headword: 'China', indexWord: 'China', pronunciation: 'ˈtʃaɪnə', definition: 'n. 中国', occurrence: 50, senses: 1 },
{ id: 52254, headword: 'inhabitant', indexWord: 'inhabitant', pronunciation: 'ɪnˈhæbɪtənt', definition: 'n. 居民,栖居的动物', occurrence: 37, senses: 1 },
{ id: 96868, headword: 'vast', indexWord: 'vast', pronunciation: 'væst', definition: 'adj. 巨大的,广阔的', occurrence: 36, senses: 1 },
{ id: 54775, headword: 'kilo', indexWord: 'kilo', pronunciation: 'ˈkiːloʊ', definition: 'n. 千克,公斤', occurrence: 35, senses: 1 },
{ id: 84763, headword: 'sometimes', indexWord: 'sometimes', pronunciation: 'ˈsʌmtaɪmz', definition: 'adv. 有时', occurrence: 35, senses: 1 },
{ id: 74617, headword: 'put on', indexWord: 'put on', pronunciation: '', definition: 'phrv. 穿上,戴上;增加体重;举办,上演', occurrence: 34, senses: 3 },
{ id: 81834, headword: 'seventeen', indexWord: 'seventeen', pronunciation: 'ˌsevnˈtiːn', definition: 'num. 十七', occurrence: 33, senses: 1 },
{ id: 29516, headword: 'corresponding', indexWord: 'corresponding', pronunciation: 'ˌkɔːrəˈspɑːndɪŋ', definition: 'adj. 符合的,相应的', occurrence: 32, senses: 1 },
{ id: 63898, headword: 'neutron', indexWord: 'neutron', pronunciation: 'ˈnuːtrɑːn', definition: 'n. 中子', occurrence: 30, senses: 1 }
],
entryDetail: {
id: 26132,
headword: 'cinema',
indexWord: 'cinema',
pronunciation: 'ˈsɪnəmə',
definition: 'n. 电影院;电影艺术,电影业',
occurrence: 91,
senses: [
{ no: 1, pos: 'n.', gloss: '电影院', exams: '中考 / 高考 / 六级 / 考研 / 雅思 / 专升本' },
{ no: 2, pos: 'n.', gloss: '电影艺术,电影业', exams: '高考 / 雅思' }
],
phrases: [
{ en: 'go to the cinema', zh: '去看电影', type: 2 },
{ en: 'a local cinema', zh: '当地影院', type: 2 },
{ en: 'American cinema', zh: '美国电影界', type: 2 }
],
examples: [
{ en: "And besides, it's rude to talk in the cinema.", zh: '而且,在电影院大声喧哗是不礼貌的。' },
{ en: "I'm free this afternoon. Why don't we go to the cinema?", zh: '我今天下午有空,要不我们去看电影吧?' },
{ en: '"Loving Vincent" is set to hit cinema screens this fall.', zh: '《至爱梵高》将在今年秋季上映。' },
{ en: 'This was shown at a local cinema and made $100.', zh: '这部电影在当地一家影院上映,取得了100美元的利润。' },
{ en: 'Bruce Lee exploded onto American cinemas screen in August 1973.', zh: '1973年8月,李小龙凭借《龙争虎斗》闯入美国影坛。' },
{ en: 'A Moscow cinema has stopped screening the banned film.', zh: '莫斯科某影院已停止放映被禁影片。' }
],
confusables: [
{ word: 'ninety', gloss: 'num. 九十' },
{ word: 'china', gloss: 'n. 瓷,瓷料;瓷器' },
{ word: 'coma', gloss: 'n. 昏迷' },
{ word: 'mine', gloss: 'pron. 我的' },
{ word: 'lineup', gloss: 'n. 阵容,阵列' }
],
books: [
{ name: '外研join in六年级上', display: 'cinema', seq: 1 },
{ name: '人教PEP版六年级上', display: 'cinema', seq: 5 },
{ name: '辽师大五年级上(新版)', display: 'cinema', seq: 12 },
{ name: '鲁教版七年级上(五四学制)', display: 'cinema', seq: 14 },
{ name: '人教大同版四年级上(新版)', display: 'cinema', seq: 15 },
{ name: '外研社版四年级上(三年级起点)', display: 'cinema', seq: 15 },
{ name: '沪教版二年级上(新版)', display: 'cinema', seq: 20 },
{ name: '闽教版四年级上(新版)', display: 'cinema', seq: 21 }
]
},
morphemes: [
{ id: 1, type: 'prefix', form: 'caco-', meaningEn: 'bad', meaningZh: '坏的', note: '' },
{ id: 2, type: 'prefix', form: 'genu-', meaningEn: 'knee', meaningZh: '膝盖', note: '' },
{ id: 3, type: 'prefix', form: 'geronto-', meaningEn: 'old', meaningZh: '老的', note: '' },
{ id: 4, type: 'prefix', form: 'mega-', meaningEn: 'great', meaningZh: '巨大的', note: '' },
{ id: 215, type: 'root', form: 'duct', meaningEn: 'to lead', meaningZh: '引导', note: '' },
{ id: 216, type: 'root', form: 'duc', meaningEn: 'to lead', meaningZh: '引导', note: '' },
{ id: 217, type: 'root', form: 'du', meaningEn: 'to lead', meaningZh: '引导', note: '' },
{ id: 218, type: 'root', form: 'hom', meaningEn: 'man', meaningZh: '人类', note: '' },
{ id: 2080, type: 'suffix', form: '-aholic', meaningEn: '', meaningZh: '构成名词', note: '对…成瘾的人' },
{ id: 2081, type: 'suffix', form: '-ar', meaningEn: '', meaningZh: '构成形容词', note: '' },
{ id: 2082, type: 'suffix', form: '-ar', meaningEn: '', meaningZh: '构成名词', note: '做某事的人' },
{ id: 2083, type: 'suffix', form: '-ard', meaningEn: '', meaningZh: '构成名词', note: '常处于某种状态的人' }
],
cards: [
{ id: 3, word: 'adherence', memory: '粘在…上 → 紧紧跟随 ⇨ 坚持,遵守,遵循', example: 'strict adherence to the rules\n严格遵守规章制度' },
{ id: 6, word: 'adherent', memory: '粘在…上 → 紧紧跟随 ⇨ 追随者,拥护者', example: 'adherents of the Greek Orthodox Church\n希腊东正教的信徒' },
{ id: 1, word: 'Anglican', memory: '英国国教会的;圣公会的', example: '' },
{ id: 2, word: 'Anglo-Saxon', memory: '盎格鲁-撒克逊人的;古英语的', example: '' },
{ id: 4, word: 'Antarctic', memory: '北边的反面 ⇨ 南极地区', example: '' },
{ id: 5, word: 'Antarctica', memory: '北边的反面 ⇨ 南极地区', example: '' }
],
families: [
{ id: 585, word: 'act', interpretation: 'n. 行为;法案 v. 扮演', members: 112 },
{ id: 10126, word: 'heart', interpretation: 'n. 心脏;内心;中央', members: 97 },
{ id: 18270, word: 'sense', interpretation: 'n. 感官;意识;意思 v. 意识到', members: 74 },
{ id: 12115, word: 'light', interpretation: 'n. 光;电灯 adj. 明亮的;轻的', members: 68 },
{ id: 1501, word: 'arm', interpretation: 'n. 手臂 v. 武装,装备', members: 64 },
{ id: 12616, word: 'man', interpretation: 'n. 男人;人类,人', members: 63 },
{ id: 2146, word: 'behave', interpretation: 'v. 表现;举止得体', members: 24 },
{ id: 3664, word: 'civil', interpretation: 'adj. 公民的;有礼貌的', members: 18 }
],
familyTree: {
id: 2146,
word: 'behave',
interpretation: 'v. 表现;举止得体',
variants: ['behaviour', 'behavioural', 'behaviourism', 'behaviourist', 'misbehaviour'],
groups: [
['behave', 'behavior', 'misbehave'],
['behave', 'behavior', 'behavioral'],
['behave', 'behavior', 'behaviorism'],
['behave', 'behavior', 'behaviorist']
]
},
synonyms: [
{ id: 4990, word: 'show', senses: 10 },
{ id: 3509, word: 'mark', senses: 8 },
{ id: 2174, word: 'fall', senses: 6 },
{ id: 2245, word: 'figure', senses: 6 },
{ id: 2411, word: 'gain', senses: 6 },
{ id: 4183, word: 'position', senses: 6 },
{ id: 4191, word: 'post', senses: 6 },
{ id: 4244, word: 'present', senses: 6 }
],
synonymDetail: {
id: 2411,
word: 'gain',
senses: [
{ id: 3267, pos: 'v.', gloss: '获得' },
{ id: 3268, pos: 'v.', gloss: '增加' },
{ id: 3269, pos: 'v.', gloss: '受益' },
{ id: 3270, pos: 'n.', gloss: '增加' },
{ id: 3271, pos: 'n.', gloss: '好处' }
],
groups: [
{ senseId: 3267, exam: '中考', canonical: 'achieve', count: 2 },
{ senseId: 3267, exam: '高考', canonical: 'obtain', count: 6 },
{ senseId: 3267, exam: '四级', canonical: 'obtain', count: 6 },
{ senseId: 3267, exam: '六级', canonical: 'obtain', count: 6 },
{ senseId: 3267, exam: '考研', canonical: 'obtain', count: 6 },
{ senseId: 3267, exam: '雅思', canonical: 'obtain', count: 6 },
{ senseId: 3267, exam: '托福', canonical: 'achieve', count: 6 },
{ senseId: 3268, exam: '中考', canonical: '', count: 8 },
{ senseId: 3268, exam: '高考', canonical: '', count: 10 },
{ senseId: 3268, exam: '四级', canonical: '', count: 10 }
],
members: [
{ senseId: 3267, exam: '中考', words: ['gain', 'achieve'] },
{ senseId: 3267, exam: '高考', words: ['gain', 'obtain', 'achieve', 'acquire', 'attain', 'secure'] },
{ senseId: 3267, exam: '四级', words: ['gain', 'obtain', 'achieve', 'acquire', 'attain', 'secure'] },
{ senseId: 3267, exam: '六级', words: ['gain', 'obtain', 'achieve', 'acquire', 'attain', 'secure'] },
{ senseId: 3267, exam: '考研', words: ['gain', 'obtain', 'achieve', 'acquire', 'attain', 'secure'] },
{ senseId: 3267, exam: '雅思', words: ['gain', 'obtain', 'achieve', 'acquire', 'attain', 'secure'] }
],
antonyms: [
{ senseId: 3270, gloss: '增加', exams: ['高考', '四级', '六级', '雅思', '托福', '其他'], word: 'loss' },
{ senseId: 3271, gloss: '好处', exams: ['中考', '高考', '四级', '六级', '考研', '雅思', '专升本', '其他'], word: 'loss' }
]
},
quality: {
summary: [
{ label: '声明与实际词条数不一致', value: 18, unit: '本', level: 'warn' },
{ label: '缺失词书清单文件', value: 1, unit: '本', level: 'bad' },
{ label: '缺失 zpk 引用', value: 1, unit: '个', level: 'bad' },
{ label: '无结构化义项的词条', value: 5250, unit: '条', level: 'warn' },
{ label: '无义项的近义词头', value: 19, unit: '个', level: 'warn' },
{ label: '未设置考试的词书', value: 509, unit: '本', level: 'info' },
{ label: '无封面词书', value: 27, unit: '本', level: 'info' }
],
mismatch: [
{ name: '外研社版八年级上(新版)', code: 'WYS8S', declared: 335, actual: 256 },
{ name: '译林版牛津英语九上(新版)', code: 'YLB9S', declared: 305, actual: 368 },
{ name: '人教版七年级上(新版)', code: 'RJB7S2024', declared: 288, actual: 269 },
{ name: '沪教版三年级上(新版)', code: 'HJ3S', declared: 162, actual: 146 },
{ name: '外研社版四年级上(新版)', code: 'WYS4NJS', declared: 165, actual: 153 },
{ name: '鲁教版九年级全册(新版)', code: 'LJ9Q', declared: 482, actual: 492 },
{ name: '外研社版七年级上(新版)', code: 'WYS7S2024', declared: 298, actual: 288 },
{ name: '译林版牛津英语八上(新版)', code: 'YLB8S', declared: 440, actual: 450 },
{ name: '人教PEP版四年级上(新版)', code: 'RJPEP4S', declared: 109, actual: 117 },
{ name: '人教版八年级上(新版)', code: 'RJB8S', declared: 554, actual: 550 },
{ name: '外研社版高中选择性必修一(新)', code: 'WYSGZXZBX1', declared: 266, actual: 263 },
{ name: '科普版六年级上(新版)', code: 'KP6SN', declared: 108, actual: 109 },
{ name: '六级考前保命200词', code: 'CET6BM200', declared: 219, actual: 220 },
{ name: '闽教版五年级上(新版)', code: 'MJ5SN', declared: 135, actual: 134 },
{ name: '杭州English for Kids 2B', code: 'HZ2B', declared: 42, actual: 41 },
{ name: '人教版高中选择性必修一(新)', code: 'RJBGZXZBX1', declared: 345, actual: 344 },
{ name: '2021何凯文考研英语必考词汇', code: 'HKWKY2021', declared: 4249, actual: 4248 },
{ name: '考研考前保命200词', code: 'KYBM200', declared: 257, actual: 258 }
],
missingFile: [{ name: '全国医学博士外语统一考试大纲', code: 'KBYXKSDG' }],
synNoSense: [
'adulthood', 'at home', 'attached', 'away', 'caring', 'childhood', 'confirmed', 'debit', 'luck',
'nap', 'on a daily basis', 'purely', 'set sail', 'take a nap', 'trade union', 'unattached',
'unbroken', 'uncaring', 'unconfirmed'
],
coverage: [
{ name: '单词卡片', hit: 11662, total: 11998, pct: 97.2 },
{ name: '词族', hit: 17587, total: 22710, pct: 77.4 },
{ name: '近义词头', hit: 6231, total: 6279, pct: 99.2 }
]
}
};
+63
View File
@@ -0,0 +1,63 @@
// PROTOTYPE ONLY — throwaway UI data. Real snapshot from MySQL word_market (2026-11-08).
// Not production code; safe to delete.
window.DASHBOARD_DATA = {
kpis: [
{ key: 'books', label: '词书', value: 1025, note: '1 本无清单文件', tone: 'blue' },
{ key: 'entries', label: '词条', value: 38116, note: '38,000 个索引词', tone: 'green' },
{ key: 'links', label: '词书词条关联', value: 1228421, note: '平均每本 1,200 条', tone: 'violet' },
{ key: 'sentences', label: '例句', value: 235744, note: '含使用模式 71,964', tone: 'amber' },
{ key: 'families', label: '词族', value: 22717, note: '顶层族 5,629', tone: 'cyan' },
{ key: 'synonyms', label: '近义词头', value: 6279, note: '义项 8,383', tone: 'rose' }
],
exams: [
{ name: '考研', code: 'KY', books: 108, entries: 480091 },
{ name: '未归类', code: '—', books: 509, entries: 258233 },
{ name: '高考', code: 'GK', books: 150, entries: 154292 },
{ name: '中考', code: 'ZK', books: 156, entries: 74439 },
{ name: '四级', code: 'CET4', books: 29, entries: 69362 },
{ name: '六级', code: 'CET6', books: 22, entries: 52863 },
{ name: '专升本', code: 'ZSB', books: 19, entries: 52681 },
{ name: '专四', code: 'PRO4', books: 7, entries: 25627 },
{ name: '雅思', code: 'IELTS', books: 11, entries: 25314 },
{ name: '专八', code: 'PRO8', books: 6, entries: 19954 },
{ name: '托福', code: 'TOEFL', books: 8, entries: 15565 }
],
topBooks: [
{ id: 15, name: 'SAT10000', code: 'SAT', exam: 'SAT', declared: 10001, actual: 10001, cover: 'https://static.beingfine.cn/dicts/v3/img_032516463440_24_opt.png' },
{ id: 1170, name: '2027恋练有词考研英语词汇', code: 'LLYC2027', exam: '考研', declared: 7969, actual: 7969, cover: 'https://static.beingfine.cn/dicts/v3/img_122613473672_1017_opt.png' },
{ id: 557, name: '2024恋练有词考研英语词汇', code: 'LLYCKY2024', exam: '考研', declared: 7949, actual: 7949, cover: 'https://static.beingfine.cn/dicts/v3/img_032615238520_111_opt.png' },
{ id: 740, name: '2026恋练有词考研英语词汇', code: 'LLYCKY2026', exam: '考研', declared: 7941, actual: 7941, cover: 'https://static.beingfine.cn/dicts/v3/img_122414371550_51_opt.png' },
{ id: 630, name: '2025恋练有词考研英语词汇', code: 'LLYCKY2025', exam: '考研', declared: 7940, actual: 7940, cover: 'https://static.beingfine.cn/dicts/v3/img_032615097259_51_opt.png' },
{ id: 331, name: '2023恋练有词考研英语词汇', code: 'LLYCKY2023', exam: '考研', declared: 7919, actual: 7919, cover: 'https://static.beingfine.cn/dicts/v3/img_032617141081_126_opt.png' },
{ id: 508, name: '2023恋练有词考研英语词汇', code: 'LLYCK2023N', exam: '考研', declared: 7919, actual: 7919, cover: 'https://static.beingfine.cn/dicts/v3/img_042716404904_126_opt.png' },
{ id: 841, name: '英语六级 你还在背单词吗(新版)', code: 'HZBCET6N', exam: '六级', declared: 7799, actual: 7799, cover: 'https://static.beingfine.cn/dicts/v3/img_081109464902_93_opt.png' },
{ id: 519, name: '全国英语等级考试第五级', code: 'PETS5', exam: '未归类', declared: 7527, actual: 7527, cover: 'https://static.beingfine.cn/dicts/v3/img_032516041386_40_opt.png' },
{ id: 819, name: '考研词汇 词根联想记忆法 乱序版', code: 'KYLX2026', exam: '考研', declared: 7349, actual: 7349, cover: 'https://static.beingfine.cn/dicts/v3/img_071615349355_34_opt.png' }
],
pos: [
{ name: 'n.', value: 21313 },
{ name: 'adj.', value: 9782 },
{ name: 'phr.', value: 6922 },
{ name: 'vt.', value: 5331 },
{ name: 'adv.', value: 1996 },
{ name: 'vi.', value: 1800 },
{ name: 'phrv.', value: 1758 },
{ name: 'idm.', value: 1595 },
{ name: 'vi. vt.', value: 971 },
{ name: 'vt. vi.', value: 896 }
],
quality: [
{ key: 'mismatch', label: '声明与实际词条数不一致', value: 18, unit: '本', level: 'warn', target: '词书' },
{ key: 'nofile', label: '缺失词书清单文件', value: 1, unit: '本', level: 'bad', target: '词书' },
{ key: 'nozpk', label: '缺失 zpk 引用', value: 1, unit: '个', level: 'bad', target: '词条' },
{ key: 'nosense', label: '无结构化义项的词条', value: 5250, unit: '条', level: 'warn', target: '词条' },
{ key: 'nosyn', label: '无义项的近义词头', value: 19, unit: '个', level: 'warn', target: '近义词' },
{ key: 'noexam', label: '未设置考试的词书', value: 509, unit: '本', level: 'info', target: '词书' },
{ key: 'nocover', label: '无封面词书', value: 27, unit: '本', level: 'info', target: '词书' }
],
coverage: [
{ name: '单词卡片', hit: 11662, total: 11998, pct: 97.2 },
{ name: '词族', hit: 17587, total: 22710, pct: 77.4 },
{ name: '近义词头', hit: 6231, total: 6279, pct: 99.2 }
]
};
+167
View File
@@ -0,0 +1,167 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
rel="icon"
href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='8' fill='%232563eb'/%3E%3Ctext x='16' y='22' font-size='18' font-family='Arial' font-weight='bold' fill='white' text-anchor='middle'%3EW%3C/text%3E%3C/svg%3E"
/>
<title>词库后台 · UI 原型(throwaway)</title>
<!-- PROTOTYPE ONLY — not production. Serve with: python -m http.server 8090 --directory frontend/prototype -->
<link rel="stylesheet" href="https://registry.npmmirror.com/element-plus/2.8.8/files/dist/index.css" />
<link rel="stylesheet" href="./styles.css" />
<link rel="stylesheet" href="./modules.css" />
</head>
<body>
<div id="app"></div>
<script src="https://registry.npmmirror.com/vue/3.5.13/files/dist/vue.global.prod.js"></script>
<script src="https://registry.npmmirror.com/element-plus/2.8.8/files/dist/index.full.min.js"></script>
<script src="https://registry.npmmirror.com/echarts/5.5.1/files/dist/echarts.min.js"></script>
<script src="./data.js"></script>
<script src="./data-modules.js"></script>
<script src="./variant-a.js"></script>
<script src="./variant-b.js"></script>
<script src="./variant-c.js"></script>
<script src="./module-shell.js"></script>
<script src="./view-books.js"></script>
<script src="./view-entries.js"></script>
<script src="./view-morphology.js"></script>
<script src="./view-synonyms.js"></script>
<script src="./view-quality.js"></script>
<script>
const { createApp, ref, computed, onMounted, onBeforeUnmount } = Vue;
const VARIANTS = [
{ key: 'A', comp: window.VariantA },
{ key: 'B', comp: window.VariantB },
{ key: 'C', comp: window.VariantC }
];
const VARIANT_KEYS = VARIANTS.map((v) => v.key);
const PAGES = ['overview', 'books', 'entries', 'morphology', 'synonyms', 'quality'];
const VIEWS = {
books: window.ViewBooks,
entries: window.ViewEntries,
morphology: window.ViewMorphology,
synonyms: window.ViewSynonyms,
quality: window.ViewQuality
};
const PAGE_TITLES = {
overview: '概览',
books: '词书管理',
entries: '词条词典',
morphology: '词根词族',
synonyms: '近反义词',
quality: '数据质量'
};
const params = new URLSearchParams(location.search);
function initialPage() {
const p = params.get('page');
return PAGES.includes(p) ? p : 'overview';
}
function initialVariant() {
const v = params.get('variant');
return VARIANT_KEYS.includes(v) ? v : 'A';
}
const app = createApp({
setup() {
const page = ref(initialPage());
const variant = ref(initialVariant());
const id = ref(params.get('id') || '');
const kw = ref(params.get('kw') || '');
const isOverview = computed(() => page.value === 'overview');
const meta = computed(() => VARIANTS.find((v) => v.key === variant.value));
const label = computed(() => {
const name = meta.value.comp.name.replace(/^Variant[A-Z]\s*—\s*/, '');
return `${variant.value} — ${name}`;
});
const viewComp = computed(() => VIEWS[page.value]);
function writeUrl() {
try {
const url = new URL(location.href);
url.searchParams.set('page', page.value);
if (page.value === 'overview') {
url.searchParams.set('variant', variant.value);
url.searchParams.delete('id');
url.searchParams.delete('kw');
} else {
url.searchParams.delete('variant');
if (id.value) url.searchParams.set('id', id.value);
else url.searchParams.delete('id');
if (kw.value) url.searchParams.set('kw', kw.value);
else url.searchParams.delete('kw');
}
history.replaceState({}, '', url);
} catch (_) { /* file:// may reject history updates */ }
document.title = `词库后台 · ${PAGE_TITLES[page.value] || page.value} · UI 原型`;
}
function navigate(nextPage, nextId, nextKw) {
if (!PAGES.includes(nextPage)) return;
page.value = nextPage;
id.value = nextId === undefined || nextId === null || nextId === '' ? '' : String(nextId);
kw.value = nextKw || '';
if (nextPage !== 'overview') variant.value = 'A';
writeUrl();
window.scrollTo(0, 0);
}
function setVariant(key) {
variant.value = key;
page.value = 'overview';
writeUrl();
}
function cycle(dir) {
const i = VARIANT_KEYS.indexOf(variant.value);
setVariant(VARIANT_KEYS[(i + dir + VARIANT_KEYS.length) % VARIANT_KEYS.length]);
}
function onKey(e) {
const t = e.target;
if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;
if (!isOverview.value) return;
if (e.key === 'ArrowLeft') { e.preventDefault(); cycle(-1); }
if (e.key === 'ArrowRight') { e.preventDefault(); cycle(1); }
}
window.protoNavigate = navigate;
onMounted(() => {
window.addEventListener('keydown', onKey);
writeUrl();
});
onBeforeUnmount(() => window.removeEventListener('keydown', onKey));
return { page, variant, id, kw, isOverview, label, viewComp, cycle, navigate, keys: VARIANT_KEYS };
},
template: `
<component v-if="isOverview" :is="'Variant' + variant" :key="variant" />
<component v-else :is="viewComp" :id="id" :kw="kw" :key="page" />
<div class="proto-badge">UI PROTOTYPE · 仅预览</div>
<div v-if="isOverview" class="proto-switcher">
<button @click="cycle(-1)" aria-label="上一个方案">‹</button>
<div class="label"><b>{{ label }}</b><span class="hint">← → 切换 · ?variant={{ variant }}</span></div>
<button @click="cycle(1)" aria-label="下一个方案">›</button>
</div>
`
});
VARIANTS.forEach((v) => app.component('Variant' + v.key, v.comp));
app.use(ElementPlus);
Object.entries(VIEWS).forEach(([name, comp]) => {
app.component('View' + name.charAt(0).toUpperCase() + name.slice(1), comp);
});
app.component('ModuleShell', window.ModuleShell);
app.mount('#app');
</script>
</body>
</html>
+42
View File
@@ -0,0 +1,42 @@
// PROTOTYPE ONLY — shared A-style shell for module pages.
window.ModuleShell = {
name: 'ModuleShell',
props: { active: String, title: String },
methods: {
go(page) {
window.protoNavigate(page);
}
},
template: `
<div class="a-root">
<div class="a-shell">
<aside class="a-sidebar">
<div class="a-brand" style="cursor:pointer" @click="go('overview')">
<div class="a-brand-mark">W</div>
<div><div class="a-brand-name">Word Market</div><div class="a-brand-sub">词库管理后台</div></div>
</div>
<nav class="a-nav">
<div class="a-nav-item" :class="{ active: active === 'overview' }" @click="go('overview')"><span class="dot"></span>概览</div>
<div class="a-nav-item" :class="{ active: active === 'books' }" @click="go('books')"><span class="dot"></span>词书管理</div>
<div class="a-nav-item" :class="{ active: active === 'entries' }" @click="go('entries')"><span class="dot"></span>词条词典</div>
<div class="a-nav-item" :class="{ active: active === 'morphology' }" @click="go('morphology')"><span class="dot"></span>词根词族</div>
<div class="a-nav-item" :class="{ active: active === 'synonyms' }" @click="go('synonyms')"><span class="dot"></span>近反义词</div>
<div class="a-nav-gap"></div>
<div class="a-nav-item" :class="{ active: active === 'quality' }" @click="go('quality')"><span class="dot"></span>数据质量</div>
</nav>
<div class="a-side-foot">只读模式 · 数据快照 2026-11-08</div>
</aside>
<main class="a-main">
<div class="a-topbar">
<div class="a-crumb">后台 / <b>{{ title }}</b></div>
<div class="a-top-actions">
<div class="a-search">搜索词书、词条…</div>
<div class="a-avatar">AD</div>
</div>
</div>
<slot />
</main>
</div>
</div>`
};
+893
View File
@@ -0,0 +1,893 @@
/* PROTOTYPE ONLY — module pages (books / entries / morphology / synonyms / quality). */
.m-page-head {
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 16px;
margin-bottom: 18px;
}
.m-page-head h1 {
margin: 0 0 4px;
font-size: 22px;
letter-spacing: -0.01em;
}
.m-page-head p {
margin: 0;
font-size: 13px;
color: #6b7280;
}
.m-page-meta {
font-size: 11.5px;
color: #9ca3af;
}
.m-toolbar {
display: flex;
align-items: flex-end;
gap: 14px;
flex-wrap: wrap;
background: #fff;
border: 1px solid #e8ebf0;
border-radius: 10px;
padding: 14px 16px;
margin-bottom: 16px;
}
.m-toolbar-inline {
background: transparent;
border: 0;
padding: 0;
margin: 0 0 12px;
}
.m-field {
display: flex;
flex-direction: column;
gap: 4px;
min-width: 140px;
}
.m-field-grow {
flex: 1;
min-width: 220px;
}
.m-field label {
font-size: 11px;
color: #9ca3af;
}
.m-field input,
.m-field select {
height: 34px;
border: 1px solid #e5e7eb;
border-radius: 7px;
background: #fff;
padding: 0 10px;
font: inherit;
font-size: 13px;
color: #374151;
outline: none;
}
.m-field input:focus,
.m-field select:focus {
border-color: #93c5fd;
box-shadow: 0 0 0 3px #eff6ff;
}
.m-toolbar-note {
margin-left: auto;
font-size: 11px;
color: #9ca3af;
padding-bottom: 9px;
}
.m-table {
width: 100%;
border-collapse: collapse;
font-size: 13px;
}
.m-table th {
text-align: left;
font-weight: 500;
font-size: 11.5px;
color: #9ca3af;
padding: 7px 8px;
border-bottom: 1px solid #eef0f3;
white-space: nowrap;
}
.m-table td {
padding: 9px 8px;
border-bottom: 1px solid #f3f4f6;
vertical-align: middle;
}
.m-table tbody tr:hover {
background: #fafbfc;
}
.m-table tbody tr:last-child td {
border-bottom: 0;
}
.m-num {
text-align: right;
font-variant-numeric: tabular-nums;
}
.m-cell-title {
font-weight: 500;
color: #1f2937;
}
.m-cell-sub {
font-size: 11px;
color: #9ca3af;
}
.m-book-cell {
display: flex;
align-items: center;
gap: 10px;
min-width: 0;
}
.m-cover {
width: 30px;
height: 40px;
border-radius: 4px;
object-fit: cover;
background: #eef2f7;
flex: none;
}
.m-cover-lg {
width: 96px;
height: 132px;
border-radius: 8px;
object-fit: cover;
background: #eef2f7;
flex: none;
}
.m-word {
font-weight: 600;
color: #111827;
}
.m-phonetic {
font-size: 12px;
color: #6b7280;
}
.m-def {
font-size: 12.5px;
color: #4b5563;
line-height: 1.65;
}
.m-tag {
display: inline-block;
padding: 1px 7px;
border-radius: 999px;
background: #f1f5f9;
color: #475569;
font-size: 11px;
white-space: nowrap;
}
.m-tag-prefix {
background: #eef2ff;
color: #4338ca;
}
.m-tag-root {
background: #ecfdf5;
color: #047857;
}
.m-tag-suffix {
background: #fffbeb;
color: #b45309;
}
.m-dot {
display: inline-block;
width: 7px;
height: 7px;
border-radius: 50%;
margin-right: 6px;
vertical-align: middle;
}
.m-dot.ok {
background: #16a34a;
}
.m-dot.bad {
background: #ef4444;
}
.m-dot.warn {
background: #f59e0b;
}
.m-dot.info {
background: #3b82f6;
}
.m-link {
color: #2563eb;
cursor: pointer;
white-space: nowrap;
}
.m-link:hover {
text-decoration: underline;
}
.m-ok {
color: #16a34a;
}
.m-warn-text {
color: #d97706;
}
.m-bad-text {
color: #dc2626;
}
.m-empty {
padding: 42px 16px;
text-align: center;
color: #9ca3af;
font-size: 13px;
}
.m-back {
display: inline-flex;
align-items: center;
gap: 4px;
margin-bottom: 12px;
font-size: 13px;
color: #6b7280;
cursor: pointer;
}
.m-back:hover {
color: #2563eb;
}
.m-detail-head {
display: flex;
align-items: center;
gap: 22px;
padding: 20px;
}
.m-detail-main {
flex: 1;
min-width: 0;
}
.m-detail-kicker {
font-size: 11px;
letter-spacing: 0.12em;
color: #9ca3af;
}
.m-detail-title {
margin: 4px 0 8px;
font-size: 26px;
letter-spacing: -0.01em;
}
.m-detail-meta {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
}
.m-stat-row {
display: flex;
gap: 28px;
margin-left: auto;
}
.m-stat {
text-align: right;
}
.m-stat b {
display: block;
font-size: 22px;
font-weight: 700;
font-variant-numeric: tabular-nums;
}
.m-stat span {
font-size: 11px;
color: #9ca3af;
}
.m-tabs {
display: flex;
gap: 4px;
border-bottom: 1px solid #e5e7eb;
margin: 18px 0 0;
}
.m-tab {
padding: 9px 14px;
font-size: 13.5px;
color: #6b7280;
cursor: pointer;
border-bottom: 2px solid transparent;
margin-bottom: -1px;
}
.m-tab:hover {
color: #374151;
}
.m-tab.active {
color: #4338ca;
border-color: #4338ca;
font-weight: 600;
}
.m-tab-panel {
margin-top: 0;
border-radius: 0 0 10px 10px;
padding: 16px 18px;
}
.m-note {
font-size: 11.5px;
color: #9ca3af;
line-height: 1.7;
}
.m-example-list {
display: flex;
flex-direction: column;
}
.m-example {
display: grid;
grid-template-columns: 36px minmax(0, 1fr);
gap: 12px;
padding: 12px 0;
border-bottom: 1px dashed #eef0f3;
}
.m-example:last-child {
border-bottom: 0;
}
.m-example-no {
font-size: 11px;
color: #9ca3af;
padding-top: 2px;
}
.m-example-en {
font-size: 13px;
color: #1f2937;
line-height: 1.7;
}
.m-example-zh {
font-size: 12px;
color: #6b7280;
margin-top: 4px;
line-height: 1.6;
}
.m-chip-row {
display: flex;
gap: 8px;
margin-bottom: 14px;
}
.m-chip {
display: inline-block;
padding: 3px 9px;
border-radius: 999px;
background: #f1f5f9;
color: #475569;
font-size: 11.5px;
border: 1px solid transparent;
}
.m-chip-row .m-chip {
cursor: pointer;
}
.m-chip.active {
background: #eef2ff;
color: #4338ca;
border-color: #c7d2fe;
}
.m-chips {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin-top: 6px;
}
.m-card-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
gap: 14px;
}
.m-memo-card {
background: #fff;
border: 1px solid #e8ebf0;
border-radius: 10px;
padding: 16px;
}
.m-memo-word {
font-size: 18px;
font-weight: 700;
}
.m-memo-note {
margin-top: 8px;
font-size: 12.5px;
color: #4b5563;
line-height: 1.7;
}
.m-memo-example {
margin-top: 10px;
padding-top: 10px;
border-top: 1px dashed #eef0f3;
font-size: 12px;
color: #6b7280;
white-space: pre-line;
line-height: 1.7;
}
.m-tree-layout {
display: grid;
grid-template-columns: 250px minmax(0, 1fr);
gap: 16px;
}
.m-family-list {
padding: 12px;
max-height: 600px;
overflow-y: auto;
}
.m-family-item {
padding: 9px 10px;
border-radius: 8px;
cursor: pointer;
}
.m-family-item:hover {
background: #f8fafc;
}
.m-family-item.active {
background: #eef2ff;
}
.m-family-item.active .m-family-word {
color: #4338ca;
}
.m-family-word {
font-size: 13.5px;
font-weight: 600;
}
.m-family-meta {
font-size: 11px;
color: #9ca3af;
}
.m-tree-panel {
padding: 16px 18px;
}
.m-tree-panel .el-tree {
background: transparent;
--el-tree-node-hover-bg-color: #f8fafc;
}
.m-tree-panel .el-tree-node__content {
height: 32px;
border-radius: 6px;
}
.m-tree-node {
display: flex;
align-items: center;
gap: 8px;
font-size: 13px;
}
.m-tree-type {
font-size: 9.5px;
color: #9ca3af;
letter-spacing: 0.06em;
text-transform: uppercase;
}
.m-tree-root {
font-weight: 700;
}
.m-tree-branch {
font-weight: 600;
color: #4b5563;
}
.m-tree-variant {
color: #7c3aed;
}
.m-tree-group {
color: #0891b2;
}
.m-two-col {
display: grid;
grid-template-columns: 1.35fr minmax(0, 1fr);
gap: 16px;
align-items: start;
}
.m-side-stack {
display: flex;
flex-direction: column;
gap: 16px;
min-width: 0;
}
.m-sense {
padding: 14px 0;
border-bottom: 1px dashed #eef0f3;
}
.m-sense:first-child {
padding-top: 0;
}
.m-sense:last-child {
border-bottom: 0;
padding-bottom: 0;
}
.m-sense-head {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 10px;
}
.m-sense-no {
font-size: 11px;
color: #9ca3af;
min-width: 26px;
}
.m-sense-gloss {
font-size: 13.5px;
font-weight: 600;
}
.m-group-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
gap: 10px;
}
.m-group {
border: 1px solid #eef0f3;
border-radius: 8px;
padding: 10px 12px;
background: #fcfcfd;
}
.m-group-top {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
margin-bottom: 6px;
}
.m-group-canon {
font-size: 12px;
color: #6b7280;
margin-bottom: 2px;
}
.m-group-empty {
font-size: 11.5px;
color: #9ca3af;
padding: 4px 0;
}
.m-bar-row {
display: grid;
grid-template-columns: 82px minmax(0, 1fr) 54px;
gap: 10px;
align-items: center;
margin-bottom: 9px;
}
.m-bar-label {
font-size: 11.5px;
color: #6b7280;
}
.m-bar-track {
display: block;
height: 6px;
background: #eef0f3;
border-radius: 3px;
overflow: hidden;
}
.m-bar-fill {
display: block;
height: 100%;
background: linear-gradient(90deg, #2563eb, #7c3aed);
}
.m-bar-value {
text-align: right;
font-size: 11.5px;
color: #6b7280;
font-variant-numeric: tabular-nums;
}
.m-antonym {
padding: 10px 0;
border-bottom: 1px dashed #eef0f3;
}
.m-antonym:last-child {
border-bottom: 0;
padding-bottom: 0;
}
.m-antonym-head {
display: flex;
align-items: center;
gap: 8px;
}
.m-antonym-word {
margin-left: auto;
color: #111827;
}
.m-metric-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
gap: 12px;
}
.m-metric {
background: #fff;
border: 1px solid #e8ebf0;
border-radius: 10px;
padding: 14px;
}
.m-metric-top {
display: flex;
align-items: center;
gap: 8px;
font-size: 12px;
color: #6b7280;
}
.m-metric-value {
margin-top: 8px;
font-size: 24px;
font-weight: 700;
font-variant-numeric: tabular-nums;
}
.m-metric-value span {
margin-left: 3px;
font-size: 10px;
color: #9ca3af;
font-weight: 400;
}
.m-issue {
padding: 12px 0;
border-bottom: 1px dashed #eef0f3;
}
.m-issue:last-child {
border-bottom: 0;
padding-bottom: 0;
}
.m-issue-head {
display: flex;
align-items: center;
gap: 8px;
font-size: 13px;
margin-bottom: 6px;
}
.m-issue-body {
font-size: 12.5px;
color: #4b5563;
line-height: 1.7;
}
.m-cov {
margin-bottom: 14px;
}
.m-cov-top {
display: flex;
justify-content: space-between;
gap: 12px;
font-size: 12px;
color: #6b7280;
margin-bottom: 4px;
}
.m-cov-top b {
color: #374151;
font-variant-numeric: tabular-nums;
}
.m-cov-track {
display: block;
height: 5px;
background: #eef0f3;
border-radius: 3px;
overflow: hidden;
}
.m-cov-fill {
display: block;
height: 100%;
background: linear-gradient(90deg, #2563eb, #7c3aed);
}
.m-cov-note {
margin-top: 3px;
font-size: 11px;
color: #9ca3af;
}
/* ---------- entry drawer ---------- */
/* Element Plus 在 modal=false 时仍保留全屏定位层,放行点击到页面,仅抽屉本身可交互 */
body > div:has(> .entry-drawer) {
pointer-events: none;
}
.entry-drawer {
pointer-events: auto;
}
.entry-drawer .el-drawer__body {
padding: 0;
overflow-y: auto;
}
.entry-drawer .el-drawer__header {
display: none;
}
.drawer-body {
min-height: 100%;
}
.drawer-head {
position: relative;
display: flex;
align-items: flex-end;
gap: 22px;
padding: 22px 54px 16px 24px;
border-bottom: 1px solid #eef0f3;
}
.drawer-title {
margin: 4px 0 8px;
font-size: 28px;
letter-spacing: -0.01em;
}
.drawer-close {
position: absolute;
top: 16px;
right: 18px;
width: 30px;
height: 30px;
border-radius: 50%;
border: 1px solid #e5e7eb;
background: #fff;
color: #6b7280;
font-size: 18px;
line-height: 1;
cursor: pointer;
display: grid;
place-items: center;
}
.drawer-close:hover {
background: #f3f4f6;
color: #111827;
}
.drawer-note {
margin: 12px 24px 0;
}
.drawer-tabs {
margin: 0;
padding: 0 24px;
}
.drawer-tab-panel {
padding: 16px 24px 28px;
}
@media (max-width: 800px) {
.entry-drawer {
width: 92% !important;
}
.drawer-head {
flex-wrap: wrap;
}
.drawer-head .m-stat-row {
margin-left: 0;
}
}
@media (max-width: 1100px) {
.m-two-col {
grid-template-columns: minmax(0, 1fr);
}
.m-tree-layout {
grid-template-columns: 220px minmax(0, 1fr);
}
.m-detail-head {
flex-wrap: wrap;
}
.m-stat-row {
margin-left: 0;
}
}
@media (max-width: 780px) {
.m-tree-layout {
grid-template-columns: minmax(0, 1fr);
}
.m-metric-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

+202
View File
@@ -0,0 +1,202 @@
/* PROTOTYPE ONLY — throwaway styling for UI variants. */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; cursor: pointer; }
img { display: block; }
.proto-badge {
position: fixed; top: 14px; right: 14px; z-index: 1500;
background: #111827; color: #f9fafb; border: 1px solid #374151;
padding: 5px 10px; border-radius: 999px; font-size: 11px; letter-spacing: .08em;
opacity: .82; pointer-events: none;
}
/* ---------- shared switcher ---------- */
.proto-switcher {
position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
z-index: 9999; display: flex; align-items: center; gap: 10px;
background: #0f172a; color: #e2e8f0; border: 1px solid #334155;
padding: 8px 10px; border-radius: 999px;
box-shadow: 0 10px 30px rgba(2, 6, 23, .45);
font-size: 13px; user-select: none;
}
.proto-switcher button {
width: 30px; height: 30px; border-radius: 50%;
border: 1px solid #475569; background: #1e293b; color: #e2e8f0;
display: grid; place-items: center; font-size: 15px; line-height: 1;
}
.proto-switcher button:hover { background: #334155; }
.proto-switcher .label { min-width: 210px; text-align: center; letter-spacing: .02em; }
.proto-switcher .label b { color: #fff; }
.proto-switcher .hint { color: #94a3b8; font-size: 11px; margin-left: 4px; }
/* =========================================================
VARIANT A — 经典后台:白色侧栏 + KPI 卡 + 图表网格
========================================================= */
.a-root { min-height: 100vh; background: #f3f5f8; color: #1f2937; }
.a-shell { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.a-sidebar { background: #fff; border-right: 1px solid #e5e7eb; padding: 22px 16px; display: flex; flex-direction: column; }
.a-brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 22px; }
.a-brand-mark { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff; display: grid; place-items: center; font-weight: 700; }
.a-brand-name { font-size: 15px; font-weight: 700; }
.a-brand-sub { font-size: 11px; color: #9ca3af; }
.a-nav { display: flex; flex-direction: column; gap: 2px; }
.a-nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: #4b5563; font-size: 13.5px; cursor: pointer; }
.a-nav-item.active { background: #eef2ff; color: #4338ca; font-weight: 600; }
.a-nav-item .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .55; }
.a-nav-gap { height: 14px; }
.a-side-foot { margin-top: auto; border-top: 1px solid #eef0f3; padding-top: 14px; font-size: 12px; color: #9ca3af; }
.a-main { padding: 0 26px 90px; }
.a-topbar { height: 62px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #e5e7eb; margin-bottom: 22px; }
.a-crumb { font-size: 13px; color: #6b7280; }
.a-crumb b { color: #111827; }
.a-top-actions { display: flex; align-items: center; gap: 10px; }
.a-search { width: 240px; height: 34px; border: 1px solid #e5e7eb; background: #fff; border-radius: 8px; padding: 0 12px; font-size: 13px; color: #6b7280; display: flex; align-items: center; }
.a-avatar { width: 32px; height: 32px; border-radius: 50%; background: #e0e7ff; color: #4338ca; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.a-heading { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; }
.a-heading h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.01em; }
.a-heading p { margin: 0; font-size: 13px; color: #6b7280; }
.a-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.a-kpi { background: #fff; border: 1px solid #e8ebf0; border-radius: 10px; padding: 14px; position: relative; overflow: hidden; }
.a-kpi::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--tone, #2563eb); }
.a-kpi-label { font-size: 12px; color: #6b7280; }
.a-kpi-value { font-size: 23px; font-weight: 700; margin: 7px 0 3px; font-variant-numeric: tabular-nums; }
.a-kpi-note { font-size: 11px; color: #9ca3af; }
.a-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; }
.a-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.a-panel { background: #fff; border: 1px solid #e8ebf0; border-radius: 10px; padding: 16px 18px; }
.a-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.a-panel-title { font-size: 14px; font-weight: 600; }
.a-panel-sub { font-size: 11.5px; color: #9ca3af; }
.a-chart { height: 300px; width: 100%; }
.a-chart-sm { height: 240px; width: 100%; }
.a-ranking { width: 100%; border-collapse: collapse; font-size: 13px; }
.a-ranking th { text-align: left; font-weight: 500; color: #9ca3af; font-size: 11.5px; padding: 6px 8px; border-bottom: 1px solid #eef0f3; }
.a-ranking td { padding: 8px; border-bottom: 1px solid #f3f4f6; }
.a-ranking tr:last-child td { border-bottom: 0; }
.a-book { display: flex; align-items: center; gap: 10px; }
.a-cover { width: 30px; height: 40px; border-radius: 4px; object-fit: cover; background: #eef2f7; }
.a-cover-ph { width: 30px; height: 40px; border-radius: 4px; background: linear-gradient(135deg, #e5e7eb, #d1d5db); display: grid; place-items: center; font-size: 9px; color: #6b7280; }
.a-mono { font-variant-numeric: tabular-nums; color: #374151; }
.a-quality { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.a-q-item { border: 1px solid #eef0f3; border-radius: 8px; padding: 10px 12px; }
.a-q-top { display: flex; align-items: center; gap: 7px; font-size: 12px; color: #6b7280; }
.a-led { width: 8px; height: 8px; border-radius: 50%; }
.a-led.bad { background: #ef4444; box-shadow: 0 0 0 3px #fee2e2; }
.a-led.warn { background: #f59e0b; box-shadow: 0 0 0 3px #fef3c7; }
.a-led.info { background: #3b82f6; box-shadow: 0 0 0 3px #dbeafe; }
.a-q-value { font-size: 18px; font-weight: 700; margin-top: 6px; }
.a-q-value span { font-size: 11px; color: #9ca3af; font-weight: 400; margin-left: 3px; }
/* =========================================================
VARIANT B — 指挥中心:深色全宽 + 巨型数字 + 横向条形
========================================================= */
.b-root { min-height: 100vh; background: #080f1e; color: #dbe4f0; font-family: "DIN Alternate", "Bahnschrift", "Segoe UI", sans-serif; }
.b-grid-bg { position: fixed; inset: 0; background-image: linear-gradient(rgba(56,189,248,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(56,189,248,.045) 1px, transparent 1px); background-size: 42px 42px; pointer-events: none; }
.b-shell { position: relative; padding: 0 30px 90px; }
.b-top { height: 66px; display: flex; align-items: center; gap: 26px; border-bottom: 1px solid rgba(148,163,184,.16); }
.b-brand { font-size: 15px; letter-spacing: .16em; color: #7dd3fc; font-weight: 700; white-space: nowrap; }
.b-nav { display: flex; gap: 20px; font-size: 12.5px; color: #64748b; letter-spacing: .04em; }
.b-nav .active { color: #e0f2fe; border-bottom: 2px solid #38bdf8; padding-bottom: 4px; }
.b-top-right { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 11px; color: #64748b; letter-spacing: .08em; }
.b-live { display: inline-flex; align-items: center; gap: 6px; color: #4ade80; }
.b-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 8px #4ade80; }
.b-title-row { display: flex; align-items: baseline; justify-content: space-between; padding: 26px 0 18px; }
.b-title-row h1 { margin: 0; font-size: 24px; letter-spacing: .1em; font-weight: 600; color: #f0f9ff; }
.b-title-row .sub { font-size: 11px; color: #64748b; letter-spacing: .12em; }
.b-kpi-band { display: grid; grid-template-columns: repeat(6, 1fr); border-top: 1px solid rgba(148,163,184,.16); border-bottom: 1px solid rgba(148,163,184,.16); }
.b-kpi { padding: 18px 20px 16px; border-right: 1px solid rgba(148,163,184,.12); }
.b-kpi:last-child { border-right: 0; }
.b-kpi-label { font-size: 10.5px; color: #64748b; letter-spacing: .14em; }
.b-kpi-value { font-size: 38px; font-weight: 700; color: #f8fafc; line-height: 1.12; margin: 8px 0 4px; font-variant-numeric: tabular-nums; }
.b-kpi-note { font-size: 10.5px; color: #475569; letter-spacing: .04em; }
.b-body { display: grid; grid-template-columns: 1.5fr 1fr; gap: 30px; margin-top: 26px; }
.b-section-title { font-size: 11px; color: #7dd3fc; letter-spacing: .18em; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.b-section-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(56,189,248,.35), transparent); }
.b-bars { display: flex; flex-direction: column; gap: 11px; }
.b-bar-row { display: grid; grid-template-columns: 74px 1fr 92px; align-items: center; gap: 12px; font-size: 12.5px; }
.b-bar-name { color: #cbd5e1; }
.b-bar-track { height: 9px; background: rgba(148,163,184,.1); border-radius: 2px; overflow: hidden; }
.b-bar-fill { height: 100%; border-radius: 2px; background: linear-gradient(90deg, #0ea5e9, #38bdf8); }
.b-bar-row.unclassified .b-bar-fill { background: linear-gradient(90deg, #475569, #64748b); }
.b-bar-value { text-align: right; color: #94a3b8; font-variant-numeric: tabular-nums; font-size: 12px; }
.b-bar-value b { color: #e2e8f0; }
.b-chart { height: 230px; }
.b-side { display: flex; flex-direction: column; gap: 26px; }
.b-quality { display: flex; flex-direction: column; }
.b-q-row { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px dashed rgba(148,163,184,.14); font-size: 12.5px; }
.b-q-row:last-child { border-bottom: 0; }
.b-q-led { width: 7px; height: 7px; border-radius: 50%; }
.b-q-led.bad { background: #f87171; box-shadow: 0 0 7px #f87171; }
.b-q-led.warn { background: #fbbf24; box-shadow: 0 0 7px #fbbf24; }
.b-q-led.info { background: #60a5fa; box-shadow: 0 0 7px #60a5fa; }
.b-q-label { color: #94a3b8; }
.b-q-value { color: #f1f5f9; font-variant-numeric: tabular-nums; font-size: 15px; }
.b-coverage { display: flex; flex-direction: column; gap: 13px; }
.b-cov-row { font-size: 12px; }
.b-cov-top { display: flex; justify-content: space-between; color: #94a3b8; margin-bottom: 5px; }
.b-cov-top b { color: #e2e8f0; font-variant-numeric: tabular-nums; }
.b-cov-track { height: 4px; background: rgba(148,163,184,.12); }
.b-cov-fill { height: 100%; background: linear-gradient(90deg, #22d3ee, #818cf8); }
.b-rank { display: flex; flex-direction: column; }
.b-rank-row { display: grid; grid-template-columns: 26px 1fr 88px 74px; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid rgba(148,163,184,.08); font-size: 12px; }
.b-rank-no { color: #38bdf8; font-variant-numeric: tabular-nums; }
.b-rank-name { color: #cbd5e1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-rank-actual { text-align: right; color: #f8fafc; font-variant-numeric: tabular-nums; }
.b-rank-diff { text-align: right; color: #64748b; font-size: 11px; }
/* =========================================================
VARIANT C — 编辑部:纸面 + 编号目录 + 编辑式排版
========================================================= */
.c-root { min-height: 100vh; background: #f7f3ea; color: #26221c; font-family: "Songti SC", "Noto Serif SC", Georgia, serif; }
.c-shell { display: grid; grid-template-columns: 74px minmax(0, 1fr); max-width: 1240px; margin: 0 auto; padding: 0 28px 100px; }
.c-rail { padding-top: 46px; position: sticky; top: 0; align-self: start; display: flex; flex-direction: column; gap: 18px; align-items: center; }
.c-rail-num { width: 30px; height: 30px; border: 1px solid #d6cdbb; border-radius: 50%; display: grid; place-items: center; font-size: 11px; color: #8a8172; font-family: "Segoe UI", sans-serif; }
.c-rail-num.active { background: #26221c; color: #f7f3ea; border-color: #26221c; }
.c-main { padding-top: 44px; min-width: 0; }
.c-masthead { display: flex; align-items: flex-end; justify-content: space-between; border-bottom: 2px solid #26221c; padding-bottom: 14px; }
.c-masthead h1 { margin: 0; font-size: 34px; font-weight: 600; letter-spacing: .02em; }
.c-masthead .kicker { font-family: "Segoe UI", sans-serif; font-size: 10.5px; letter-spacing: .22em; color: #8a8172; text-transform: uppercase; margin-bottom: 8px; }
.c-masthead .date { font-family: "Segoe UI", sans-serif; font-size: 11.5px; color: #8a8172; text-align: right; line-height: 1.7; }
.c-lede { max-width: 780px; font-size: 15px; line-height: 1.85; color: #4a443a; margin: 24px 0 34px; }
.c-lede b { color: #26221c; }
.c-section { padding: 22px 0; border-top: 1px solid #d9d1c1; }
.c-section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; }
.c-section-head h2 { margin: 0; font-size: 19px; font-weight: 600; }
.c-section-head h2 span { font-family: "Segoe UI", sans-serif; font-size: 11px; color: #9a917f; letter-spacing: .1em; margin-right: 10px; }
.c-section-head .aside { font-family: "Segoe UI", sans-serif; font-size: 11px; color: #9a917f; }
.c-stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0; border-top: 1px solid #d9d1c1; }
.c-stat { padding: 16px 14px 16px 0; border-right: 1px solid #e2dacb; }
.c-stat:last-child { border-right: 0; }
.c-stat .n { font-size: 30px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.c-stat .l { font-family: "Segoe UI", sans-serif; font-size: 11px; color: #8a8172; margin-top: 6px; letter-spacing: .04em; }
.c-cols { display: grid; grid-template-columns: 1.35fr 1fr; gap: 44px; }
.c-chart { height: 270px; }
.c-list { margin: 0; padding: 0; list-style: none; counter-reset: item; }
.c-list li { counter-increment: item; display: grid; grid-template-columns: 26px 34px 1fr auto; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px dotted #d9d1c1; font-family: "Segoe UI", sans-serif; font-size: 12.5px; }
.c-list li::before { content: counter(item, decimal-leading-zero); color: #9a917f; font-size: 10.5px; }
.c-list .thumb { width: 26px; height: 34px; border-radius: 2px; object-fit: cover; background: #e6dece; }
.c-list .title { color: #33302a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-list .num { color: #6e6556; font-variant-numeric: tabular-nums; }
.c-quality-cols { column-count: 2; column-gap: 40px; }
.c-q { break-inside: avoid; display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 10px 0; border-bottom: 1px dotted #d9d1c1; font-family: "Segoe UI", sans-serif; font-size: 12.5px; }
.c-q .k { color: #5d5547; }
.c-q .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.c-q .v.bad { color: #a33a2b; }
.c-q .v.warn { color: #9a6a12; }
.c-q .v.info { color: #3d6b8a; }
.c-cov { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.c-cov-row { font-family: "Segoe UI", sans-serif; font-size: 12px; display: grid; grid-template-columns: 82px 1fr 72px; gap: 12px; align-items: center; }
.c-cov-track { display: block; height: 2px; background: #ded5c5; position: relative; }
.c-cov-fill { position: absolute; inset: 0 auto 0 0; background: #26221c; }
.c-cov-val { text-align: right; color: #5d5547; font-variant-numeric: tabular-nums; }
.c-footnote { margin-top: 26px; padding-top: 14px; border-top: 1px solid #d9d1c1; font-family: "Segoe UI", sans-serif; font-size: 11px; color: #9a917f; line-height: 1.8; }
@media (max-width: 1180px) {
.a-kpis { grid-template-columns: repeat(3, 1fr); }
.b-kpi-band { grid-template-columns: repeat(3, 1fr); }
.b-kpi:nth-child(3n) { border-right: 0; }
.c-stats { grid-template-columns: repeat(3, 1fr); }
.c-stat:nth-child(3n) { border-right: 0; }
}
+194
View File
@@ -0,0 +1,194 @@
// PROTOTYPE ONLY — Variant A: classic admin (white sidebar, KPI cards, chart grid).
(function () {
const { ref, onMounted, onBeforeUnmount, nextTick } = Vue;
const D = window.DASHBOARD_DATA;
const PH = 'data:image/svg+xml;utf8,' + encodeURIComponent(
'<svg xmlns="http://www.w3.org/2000/svg" width="60" height="80"><rect width="60" height="80" fill="#e5e7eb"/><text x="30" y="44" font-size="10" fill="#9ca3af" text-anchor="middle">N/A</text></svg>'
);
const fmt = (n) => n.toLocaleString('en-US');
const short = (n) => n >= 10000 ? (n / 1000).toFixed(1) + 'k' : String(n);
const tone = { blue: '#2563eb', green: '#16a34a', violet: '#7c3aed', amber: '#d97706', cyan: '#0891b2', rose: '#e11d48' };
window.VariantA = {
name: 'VariantA — 经典后台',
setup() {
const examEl = ref(null);
const posEl = ref(null);
let charts = [];
const resize = () => charts.forEach((c) => c.resize());
onMounted(async () => {
await nextTick();
const exam = echarts.init(examEl.value);
const rows = D.exams;
exam.setOption({
grid: { left: 8, right: 54, top: 6, bottom: 6, containLabel: true },
tooltip: {
trigger: 'axis', axisPointer: { type: 'shadow' },
formatter: (p) => {
const r = rows[rows.length - 1 - p[0].dataIndex];
return `<b>${r.name}</b><br/>关联词条 ${fmt(r.entries)}<br/>词书 ${r.books} 本`;
}
},
xAxis: { type: 'value', splitLine: { lineStyle: { color: '#f1f3f6' } }, axisLabel: { color: '#9ca3af', fontSize: 10, formatter: short } },
yAxis: { type: 'category', data: rows.map((r) => r.name).reverse(), axisTick: { show: false }, axisLine: { show: false }, axisLabel: { color: '#4b5563', fontSize: 11.5 } },
series: [{
type: 'bar', barWidth: 13,
data: rows.map((r) => ({ value: r.entries, itemStyle: { color: r.code === '—' ? '#cbd5e1' : '#3b82f6', borderRadius: [0, 3, 3, 0] } })).reverse(),
label: { show: true, position: 'right', color: '#6b7280', fontSize: 10.5, formatter: (p) => short(p.value) }
}]
});
const pos = echarts.init(posEl.value);
pos.setOption({
tooltip: { trigger: 'item', formatter: '{b}: {c} ({d}%)' },
legend: { right: 0, top: 'center', orient: 'vertical', itemWidth: 8, itemHeight: 8, textStyle: { color: '#6b7280', fontSize: 11 } },
series: [{
type: 'pie', radius: ['46%', '70%'], center: ['34%', '50%'],
itemStyle: { borderColor: '#fff', borderWidth: 2 },
label: { show: false },
data: D.pos.map((p, i) => ({ name: p.name, value: p.value, itemStyle: { color: ['#2563eb', '#3b82f6', '#60a5fa', '#93c5fd', '#a5b4fc', '#c7d2fe', '#818cf8', '#6366f1', '#4f46e5', '#cbd5e1'][i] } }))
}]
});
charts = [exam, pos];
window.addEventListener('resize', resize);
});
onBeforeUnmount(() => {
window.removeEventListener('resize', resize);
charts.forEach((c) => c.dispose());
charts = [];
});
return { D, fmt, short, tone, PH, examEl, posEl, go };
function go(page) {
window.protoNavigate(page);
}
},
template: `
<div class="a-root">
<div class="a-shell">
<aside class="a-sidebar">
<div class="a-brand">
<div class="a-brand-mark">W</div>
<div><div class="a-brand-name">Word Market</div><div class="a-brand-sub">词库管理后台</div></div>
</div>
<nav class="a-nav">
<div class="a-nav-item active" @click="go('overview')"><span class="dot"></span>概览</div>
<div class="a-nav-item" @click="go('books')"><span class="dot"></span>词书管理</div>
<div class="a-nav-item" @click="go('entries')"><span class="dot"></span>词条词典</div>
<div class="a-nav-item" @click="go('morphology')"><span class="dot"></span>词根词族</div>
<div class="a-nav-item" @click="go('synonyms')"><span class="dot"></span>近反义词</div>
<div class="a-nav-gap"></div>
<div class="a-nav-item" @click="go('quality')"><span class="dot"></span>数据质量</div>
</nav>
<div class="a-side-foot">只读模式 · 数据快照 2026-11-08</div>
</aside>
<main class="a-main">
<div class="a-topbar">
<div class="a-crumb">后台 / <b>概览</b></div>
<div class="a-top-actions">
<div class="a-search">搜索词书、词条…</div>
<div class="a-avatar">AD</div>
</div>
</div>
<div class="a-heading">
<div>
<h1>数据概览</h1>
<p>四个业务域的整体规模、分布与健康度</p>
</div>
<div class="a-panel-sub">共 36 张表 · 约 364 万行</div>
</div>
<div class="a-kpis">
<div class="a-kpi" v-for="k in D.kpis" :key="k.key" :style="{ '--tone': tone[k.tone] }">
<div class="a-kpi-label">{{ k.label }}</div>
<div class="a-kpi-value">{{ fmt(k.value) }}</div>
<div class="a-kpi-note">{{ k.note }}</div>
</div>
</div>
<div class="a-grid">
<section class="a-panel">
<div class="a-panel-head">
<div class="a-panel-title">考试维度 · 关联词条量</div>
<div class="a-panel-sub">按 book.exam_id 汇总</div>
</div>
<div class="a-chart" ref="examEl"></div>
</section>
<section class="a-panel">
<div class="a-panel-head">
<div class="a-panel-title">词性分布</div>
<div class="a-panel-sub">word_sense · Top 10</div>
</div>
<div class="a-chart" ref="posEl"></div>
</section>
</div>
<div class="a-grid-2" style="grid-template-columns: 1.45fr 1fr;">
<section class="a-panel">
<div class="a-panel-head">
<div class="a-panel-title">词书规模排行</div>
<div class="a-panel-sub">实际词条数 Top 10</div>
</div>
<table class="a-ranking">
<thead><tr><th style="width:44%">词书</th><th>考试</th><th style="text-align:right">实际</th><th style="text-align:right">声明</th><th style="text-align:right">差异</th></tr></thead>
<tbody>
<tr v-for="b in D.topBooks" :key="b.id">
<td>
<div class="a-book">
<img class="a-cover" :src="b.cover" @error="e => e.target.src = PH" alt="" />
<div>
<div style="font-weight:500;max-width:250px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">{{ b.name }}</div>
<div style="font-size:11px;color:#9ca3af;">{{ b.code }}</div>
</div>
</div>
</td>
<td style="color:#6b7280;font-size:12px;">{{ b.exam }}</td>
<td class="a-mono" style="text-align:right;">{{ fmt(b.actual) }}</td>
<td class="a-mono" style="text-align:right;color:#9ca3af;">{{ fmt(b.declared) }}</td>
<td :style="{ textAlign: 'right', color: b.actual === b.declared ? '#16a34a' : '#d97706', fontSize: '12px' }">{{ b.actual === b.declared ? '一致' : (b.actual - b.declared) }}</td>
</tr>
</tbody>
</table>
</section>
<div style="display:flex;flex-direction:column;gap:16px;">
<section class="a-panel">
<div class="a-panel-head">
<div class="a-panel-title">质量红绿灯</div>
<div class="a-panel-sub">点击进入数据质量</div>
</div>
<div style="display:flex;flex-direction:column;">
<div v-for="q in D.quality" :key="q.key" style="display:grid;grid-template-columns:10px 1fr auto;gap:10px;align-items:center;padding:7px 0;border-bottom:1px dashed #f1f3f6;">
<span class="a-led" :class="q.level"></span>
<span style="font-size:12.5px;color:#4b5563;">{{ q.label }}</span>
<span style="font-size:13px;font-weight:600;color:#111827;">{{ fmt(q.value) }}<span style="font-size:10px;color:#9ca3af;font-weight:400;"> {{ q.unit }}</span></span>
</div>
</div>
</section>
<section class="a-panel">
<div class="a-panel-head">
<div class="a-panel-title">跨域文本覆盖度</div>
<div class="a-panel-sub">与词条索引词交集</div>
</div>
<div v-for="c in D.coverage" :key="c.name" style="margin-bottom:11px;">
<div style="display:flex;justify-content:space-between;font-size:12px;color:#6b7280;margin-bottom:4px;">
<span>{{ c.name }}</span><b style="color:#374151;">{{ c.pct }}% · {{ fmt(c.hit) }}/{{ fmt(c.total) }}</b>
</div>
<div style="height:5px;background:#eef0f3;border-radius:3px;overflow:hidden;">
<div :style="{ width: c.pct + '%', height: '100%', background: 'linear-gradient(90deg,#2563eb,#7c3aed)' }"></div>
</div>
</div>
</section>
</div>
</div>
</main>
</div>
</div>`
};
})();
+121
View File
@@ -0,0 +1,121 @@
// PROTOTYPE ONLY — Variant B: dark operations console (full-width bands, dense data, no cards).
(function () {
const D = window.DASHBOARD_DATA;
const fmt = (n) => n.toLocaleString('en-US');
const short = (n) => n >= 10000 ? (n / 1000).toFixed(1) + 'k' : String(n);
const maxEntries = Math.max(...D.exams.map((e) => e.entries));
const maxPos = Math.max(...D.pos.map((p) => p.value));
window.VariantB = {
name: 'VariantB — 指挥中心',
setup() {
return { D, fmt, short, maxEntries, maxPos };
},
template: `
<div class="b-root">
<div class="b-grid-bg"></div>
<div class="b-shell">
<header class="b-top">
<div class="b-brand">WORD · MARKET</div>
<nav class="b-nav">
<span class="active">OVERVIEW</span><span>BOOKS</span><span>ENTRIES</span><span>MORPHOLOGY</span><span>SYNONYMS</span><span>QUALITY</span>
</nav>
<div class="b-top-right">
<span class="b-live">SYNCED</span>
<span>SNAPSHOT 2026-11-08</span>
</div>
</header>
<div class="b-title-row">
<h1>词库运行概览</h1>
<div class="sub">36 TABLES / 3.64M ROWS / READ-ONLY</div>
</div>
<div class="b-kpi-band">
<div class="b-kpi" v-for="k in D.kpis" :key="k.key">
<div class="b-kpi-label">{{ k.label }}</div>
<div class="b-kpi-value">{{ fmt(k.value) }}</div>
<div class="b-kpi-note">{{ k.note }}</div>
</div>
</div>
<div class="b-body">
<div>
<div class="b-section-title">考试维度 / 关联词条量</div>
<div class="b-bars">
<div class="b-bar-row" :class="{ unclassified: e.code === '—' }" v-for="e in D.exams" :key="e.name">
<div class="b-bar-name">{{ e.name }}</div>
<div class="b-bar-track"><div class="b-bar-fill" :style="{ width: (e.entries / maxEntries * 100) + '%' }"></div></div>
<div class="b-bar-value"><b>{{ short(e.entries) }}</b> / {{ e.books }}本</div>
</div>
</div>
<div class="b-section-title" style="margin-top:30px;">词书规模 / TOP 10</div>
<div class="b-rank">
<div class="b-rank-row" v-for="(b, i) in D.topBooks" :key="b.id">
<div class="b-rank-no">{{ String(i + 1).padStart(2, '0') }}</div>
<div class="b-rank-name">{{ b.name }}</div>
<div class="b-rank-actual">{{ fmt(b.actual) }}</div>
<div class="b-rank-diff">{{ b.actual === b.declared ? 'MATCH' : 'Δ ' + (b.actual - b.declared) }}</div>
</div>
</div>
<div class="b-section-title" style="margin-top:30px;">词性分布 / WORD SENSE</div>
<div style="display:flex;align-items:flex-end;gap:14px;height:150px;padding:6px 4px 0;border-bottom:1px solid rgba(148,163,184,.2);">
<div v-for="p in D.pos" :key="p.name" style="flex:1;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;height:100%;gap:6px;">
<div style="font-size:10px;color:#94a3b8;font-variant-numeric:tabular-nums;">{{ short(p.value) }}</div>
<div :style="{ width: '100%', height: Math.max(3, p.value / maxPos * 105) + 'px', background: 'linear-gradient(180deg,#38bdf8,#0ea5e9)', opacity: .85 }"></div>
<div style="font-size:10.5px;color:#64748b;white-space:nowrap;">{{ p.name }}</div>
</div>
</div>
</div>
<div class="b-side">
<section>
<div class="b-section-title">质量状态 / DATA HEALTH</div>
<div class="b-quality">
<div class="b-q-row" v-for="q in D.quality" :key="q.key">
<span class="b-q-led" :class="q.level"></span>
<span class="b-q-label">{{ q.label }}</span>
<span class="b-q-value">{{ fmt(q.value) }}<span style="font-size:10px;color:#64748b;font-weight:400;"> {{ q.unit }}</span></span>
</div>
</div>
</section>
<section>
<div class="b-section-title">跨域覆盖 / WEAK LINK</div>
<div class="b-coverage">
<div class="b-cov-row" v-for="c in D.coverage" :key="c.name">
<div class="b-cov-top"><span>{{ c.name }}</span><b>{{ c.pct }}% · {{ fmt(c.hit) }}/{{ fmt(c.total) }}</b></div>
<div class="b-cov-track"><div class="b-cov-fill" :style="{ width: c.pct + '%' }"></div></div>
</div>
</div>
</section>
<section>
<div class="b-section-title">数据快照 / SNAPSHOT</div>
<div style="display:grid;grid-template-columns:1fr 1fr;gap:14px;">
<div style="border-left:2px solid #38bdf8;padding-left:12px;">
<div style="font-size:10px;color:#64748b;letter-spacing:.12em;">EXAM VIEWS</div>
<div style="font-size:24px;color:#f8fafc;margin-top:4px;">16</div>
</div>
<div style="border-left:2px solid #818cf8;padding-left:12px;">
<div style="font-size:10px;color:#64748b;letter-spacing:.12em;">TOP FAMILIES</div>
<div style="font-size:24px;color:#f8fafc;margin-top:4px;">5,629</div>
</div>
<div style="border-left:2px solid #22d3ee;padding-left:12px;">
<div style="font-size:10px;color:#64748b;letter-spacing:.12em;">SENTENCES</div>
<div style="font-size:24px;color:#f8fafc;margin-top:4px;">235,744</div>
</div>
<div style="border-left:2px solid #f472b6;padding-left:12px;">
<div style="font-size:10px;color:#64748b;letter-spacing:.12em;">CONFUSABLES</div>
<div style="font-size:24px;color:#f8fafc;margin-top:4px;">158,870</div>
</div>
</div>
</section>
</div>
</div>
</div>
</div>`
};
})();
+169
View File
@@ -0,0 +1,169 @@
// PROTOTYPE ONLY — Variant C: editorial paper layout (numbered rail, prose, lists instead of cards).
(function () {
const { ref, onMounted, onBeforeUnmount, nextTick } = Vue;
const D = window.DASHBOARD_DATA;
const PH = 'data:image/svg+xml;utf8,' + encodeURIComponent(
'<svg xmlns="http://www.w3.org/2000/svg" width="60" height="80"><rect width="60" height="80" fill="#e6dece"/><text x="30" y="44" font-size="9" fill="#9a917f" text-anchor="middle">N/A</text></svg>'
);
const fmt = (n) => n.toLocaleString('en-US');
const maxPos = Math.max(...D.pos.map((p) => p.value));
const maxEntries = Math.max(...D.exams.map((e) => e.entries));
window.VariantC = {
name: 'VariantC — 编辑部',
setup() {
const examEl = ref(null);
let chart = null;
const resize = () => chart && chart.resize();
onMounted(async () => {
await nextTick();
chart = echarts.init(examEl.value);
const rows = D.exams;
chart.setOption({
grid: { left: 6, right: 46, top: 8, bottom: 4, containLabel: true },
tooltip: {
trigger: 'axis', axisPointer: { type: 'shadow' },
backgroundColor: '#26221c', borderWidth: 0,
textStyle: { color: '#f7f3ea', fontSize: 12 },
formatter: (p) => {
const r = rows[rows.length - 1 - p[0].dataIndex];
return `${r.name} 关联 ${fmt(r.entries)} 词书 ${r.books} 本`;
}
},
xAxis: { type: 'value', splitLine: { show: false }, axisLabel: { show: false }, axisLine: { show: false }, axisTick: { show: false } },
yAxis: { type: 'category', data: rows.map((r) => r.name).reverse(), axisLine: { show: false }, axisTick: { show: false }, axisLabel: { color: '#4a443a', fontSize: 11.5, fontFamily: 'Segoe UI' } },
series: [{
type: 'bar', barWidth: 9,
data: rows.map((r) => ({ value: r.entries, itemStyle: { color: r.code === '—' ? '#b9ae9a' : '#26221c' } })).reverse(),
label: { show: true, position: 'right', color: '#6e6556', fontSize: 10.5, fontFamily: 'Segoe UI', formatter: (p) => fmt(p.value) }
}]
});
window.addEventListener('resize', resize);
});
onBeforeUnmount(() => {
window.removeEventListener('resize', resize);
if (chart) chart.dispose();
chart = null;
});
return { D, fmt, PH, examEl, maxPos, maxEntries };
},
template: `
<div class="c-root">
<div class="c-shell">
<aside class="c-rail">
<div class="c-rail-num active">01</div>
<div class="c-rail-num">02</div>
<div class="c-rail-num">03</div>
<div class="c-rail-num">04</div>
</aside>
<main class="c-main">
<header class="c-masthead">
<div>
<div class="kicker">Word Market · Data Report</div>
<h1>词库概览</h1>
</div>
<div class="date">2026 年 11 月 8 日<br/>只读快照 · 36 张表</div>
</header>
<p class="c-lede">
当前词库收录 <b>1,025 本词书</b>、<b>38,116 个词条</b>,词书与词条之间形成
<b>1,228,421 条</b>关联;配套沉淀了 235,744 条例句、22,717 个词族与 6,279 个近义词头。
四个业务域之间以单词文本弱关联,覆盖度存在差异,阅读时应把“未归类”与弱关联一并考虑。
</p>
<section class="c-section" style="border-top:0;padding-top:0;">
<div class="c-section-head">
<h2><span>01</span>规模</h2>
<div class="aside">SNAPSHOT · 2026-11-08</div>
</div>
<div class="c-stats">
<div class="c-stat" v-for="k in D.kpis" :key="k.key">
<div class="n">{{ fmt(k.value) }}</div>
<div class="l">{{ k.label }}</div>
</div>
</div>
</section>
<section class="c-section">
<div class="c-section-head">
<h2><span>02</span>分布</h2>
<div class="aside">按考试关联词条量 / 词性义项数</div>
</div>
<div class="c-cols">
<div>
<div class="c-chart" ref="examEl"></div>
</div>
<div>
<div v-for="p in D.pos" :key="p.name" style="display:grid;grid-template-columns:62px 1fr 58px;gap:10px;align-items:center;padding:5px 0;font-family:'Segoe UI',sans-serif;font-size:12px;">
<span style="color:#5d5547;">{{ p.name }}</span>
<span style="display:inline-block;height:3px;background:#e2dacb;position:relative;"><span :style="{ position: 'absolute', inset: '0 auto 0 0', width: (p.value / maxPos * 100) + '%', background: '#26221c' }"></span></span>
<span style="text-align:right;color:#6e6556;font-variant-numeric:tabular-nums;">{{ fmt(p.value) }}</span>
</div>
<div style="font-family:'Segoe UI',sans-serif;font-size:11px;color:#9a917f;margin-top:12px;line-height:1.7;">
名词义项占绝对多数;短语类(phr.)义项 6,922 条,提示词条中存在大量短语条目。
</div>
</div>
</div>
</section>
<section class="c-section">
<div class="c-section-head">
<h2><span>03</span>词书排行</h2>
<div class="aside">实际词条数 TOP 10</div>
</div>
<div class="c-cols" style="grid-template-columns:1fr 1fr;gap:48px;">
<ol class="c-list">
<li v-for="b in D.topBooks.slice(0, 5)" :key="b.id">
<img class="thumb" :src="b.cover" @error="e => e.target.src = PH" alt="" />
<span class="title">{{ b.name }}</span>
<span class="num">{{ fmt(b.actual) }}</span>
</li>
</ol>
<ol class="c-list" style="counter-reset:item 5;">
<li v-for="b in D.topBooks.slice(5)" :key="b.id">
<img class="thumb" :src="b.cover" @error="e => e.target.src = PH" alt="" />
<span class="title">{{ b.name }}</span>
<span class="num">{{ fmt(b.actual) }}</span>
</li>
</ol>
</div>
</section>
<section class="c-section">
<div class="c-section-head">
<h2><span>04</span>质量注脚</h2>
<div class="aside">异常项与弱关联覆盖度</div>
</div>
<div class="c-cols">
<div class="c-quality-cols">
<div class="c-q" v-for="q in D.quality" :key="q.key">
<span class="k">{{ q.label }}</span>
<span class="v" :class="q.level">{{ fmt(q.value) }} {{ q.unit }}</span>
</div>
</div>
<div>
<div style="font-family:'Segoe UI',sans-serif;font-size:11px;letter-spacing:.12em;color:#9a917f;margin-bottom:12px;">CROSS-DOMAIN COVERAGE</div>
<div class="c-cov">
<div class="c-cov-row" v-for="c in D.coverage" :key="c.name">
<span>{{ c.name }}</span>
<span class="c-cov-track"><span class="c-cov-fill" :style="{ width: c.pct + '%' }"></span></span>
<span class="c-cov-val">{{ c.pct }}%</span>
</div>
</div>
</div>
</div>
</section>
<div class="c-footnote">
口径说明:考试维度按 book.exam_id 汇总,未设置考试的词书单列为“未归类”;跨域覆盖度以词条索引词(index_word)为基准,属于文本弱关联,不作为外键约束。<br/>
数据来源:MySQL word_market · 只读快照。
</div>
</main>
</div>
</div>`
};
})();
+153
View File
@@ -0,0 +1,153 @@
// PROTOTYPE ONLY — 词书列表与详情。
(function () {
const D = window.MODULE_DATA;
const PH = 'data:image/svg+xml;utf8,' + encodeURIComponent(
'<svg xmlns="http://www.w3.org/2000/svg" width="60" height="80"><rect width="60" height="80" fill="#e5e7eb"/><text x="30" y="44" font-size="10" fill="#9ca3af" text-anchor="middle">N/A</text></svg>'
);
const fmt = (n) => n.toLocaleString('en-US');
window.ViewBooks = {
name: 'ViewBooks',
props: { id: String, kw: String },
setup(props) {
const { ref, computed } = Vue;
const keyword = ref(props.kw || '');
const exam = ref('全部');
const file = ref('全部');
const exams = computed(() => ['全部', ...new Set(D.books.map((b) => b.exam))]);
const filtered = computed(() => D.books.filter((b) => {
const kw = keyword.value.trim().toLowerCase();
const matchKw = !kw || b.name.toLowerCase().includes(kw) || b.code.toLowerCase().includes(kw);
const matchExam = exam.value === '全部' || b.exam === exam.value;
const matchFile = file.value === '全部'
|| (file.value === '有文件' && b.hasFile)
|| (file.value === '无文件' && !b.hasFile);
return matchKw && matchExam && matchFile;
}));
const selected = computed(() => D.books.find((b) => String(b.id) === props.id) || null);
function openBook(id) { window.protoNavigate('books', id); }
function openEntry() { window.protoNavigate('entries', 26132); }
function back() { window.protoNavigate('books'); }
function cover(path) { return path ? 'https://static.beingfine.cn' + path : PH; }
return { D, PH, fmt, keyword, exam, file, exams, filtered, selected, openBook, openEntry, back, cover };
},
template: `
<module-shell active="books" :title="selected ? '词书详情' : '词书管理'">
<template v-if="!selected">
<div class="m-page-head">
<div>
<h1>词书管理</h1>
<p>浏览词书目录、考试归属与词条规模,只读</p>
</div>
<div class="m-page-meta">1,025 本词书 · 1,228,421 条关联</div>
</div>
<div class="m-toolbar">
<div class="m-field m-field-grow">
<label>关键词</label>
<input v-model="keyword" placeholder="搜索词书名称或编码" />
</div>
<div class="m-field">
<label>考试</label>
<select v-model="exam">
<option v-for="e in exams" :key="e">{{ e }}</option>
</select>
</div>
<div class="m-field">
<label>清单文件</label>
<select v-model="file">
<option>全部</option><option>有文件</option><option>无文件</option>
</select>
</div>
<div class="m-toolbar-note">仅展示 10 本样本</div>
</div>
<div class="a-panel">
<table class="m-table">
<thead>
<tr>
<th style="width:38%">词书</th>
<th>考试</th>
<th class="m-num">声明词条</th>
<th class="m-num">实际词条</th>
<th class="m-num">差异</th>
<th>清单文件</th>
<th class="m-num">操作</th>
</tr>
</thead>
<tbody>
<tr v-for="b in filtered" :key="b.id">
<td>
<div class="m-book-cell">
<img class="m-cover" :src="cover(b.coverPath)" @error="e => e.target.src = PH" alt="" />
<div style="min-width:0">
<div class="m-cell-title">{{ b.name }}</div>
<div class="m-cell-sub">{{ b.code }}</div>
</div>
</div>
</td>
<td><span class="m-tag">{{ b.exam }}</span></td>
<td class="m-num">{{ fmt(b.declared) }}</td>
<td class="m-num">{{ fmt(b.actual) }}</td>
<td class="m-num" :class="b.actual === b.declared ? 'm-ok' : 'm-warn-text'">
{{ b.actual === b.declared ? '一致' : (b.actual - b.declared) }}
</td>
<td><span class="m-dot" :class="b.hasFile ? 'ok' : 'bad'"></span>{{ b.hasFile ? '有' : '无' }}</td>
<td class="m-num"><a class="m-link" @click="openBook(b.id)">查看</a></td>
</tr>
<tr v-if="!filtered.length">
<td colspan="7"><div class="m-empty">没有匹配的词书</div></td>
</tr>
</tbody>
</table>
</div>
</template>
<template v-else>
<div class="m-back" @click="back">← 返回词书列表</div>
<div class="a-panel m-detail-head">
<img class="m-cover-lg" :src="cover(selected.coverPath)" @error="e => e.target.src = PH" alt="" />
<div class="m-detail-main">
<div class="m-detail-kicker">{{ selected.code }}</div>
<h1 class="m-detail-title">{{ selected.name }}</h1>
<div class="m-detail-meta">
<span class="m-tag">{{ selected.exam }}</span>
<span class="m-tag">{{ selected.hasFile ? '清单文件存在' : '清单文件缺失' }}</span>
</div>
</div>
<div class="m-stat-row">
<div class="m-stat"><b>{{ fmt(selected.actual) }}</b><span>实际词条</span></div>
<div class="m-stat"><b>{{ fmt(selected.declared) }}</b><span>声明词条</span></div>
<div class="m-stat"><b :class="selected.actual === selected.declared ? 'm-ok' : 'm-warn-text'">{{ selected.actual === selected.declared ? '一致' : (selected.actual - selected.declared) }}</b><span>差异</span></div>
</div>
</div>
<div class="a-panel" style="margin-top:16px">
<div class="a-panel-head">
<div class="a-panel-title">词条清单</div>
<div class="a-panel-sub">按 seq_book 排序 · 原型样本</div>
</div>
<table class="m-table">
<thead>
<tr><th style="width:64px">顺序</th><th>展示词</th><th>音标</th><th style="width:44%">释义</th><th class="m-num">操作</th></tr>
</thead>
<tbody>
<tr v-for="e in D.bookEntries" :key="e.seq + e.displayWord">
<td class="m-num">{{ e.seq }}</td>
<td><span class="m-word">{{ e.displayWord }}</span></td>
<td class="m-phonetic">{{ e.pronunciation }}</td>
<td class="m-def">{{ e.definition }}</td>
<td class="m-num"><a class="m-link" @click="openEntry">查看词条</a></td>
</tr>
</tbody>
</table>
<div v-if="selected.id !== 15" class="m-note">该词书的词条清单在原型中统一使用 SAT10000 的样本数据。</div>
</div>
</template>
</module-shell>`
};
})();
+195
View File
@@ -0,0 +1,195 @@
// PROTOTYPE ONLY — 词条列表;详情以右侧抽屉展示。
(function () {
const D = window.MODULE_DATA;
const fmt = (n) => n.toLocaleString('en-US');
window.ViewEntries = {
name: 'ViewEntries',
props: { id: String, kw: String },
setup(props) {
const { ref, computed, watch } = Vue;
const keyword = ref('');
const tab = ref('senses');
const drawerOpen = ref(!!props.id);
const filtered = computed(() => {
const kw = keyword.value.trim().toLowerCase();
if (!kw) return D.entries;
return D.entries.filter((e) => e.headword.toLowerCase().includes(kw) || e.definition.toLowerCase().includes(kw));
});
const selected = computed(() => D.entries.find((e) => String(e.id) === props.id) || null);
const rich = computed(() => !!selected.value && String(selected.value.id) === String(D.entryDetail.id));
watch(() => props.id, () => {
drawerOpen.value = !!selected.value;
tab.value = 'senses';
});
function openEntry(id) { window.protoNavigate('entries', id); }
function closeDrawer() { drawerOpen.value = false; }
function handleDrawerClose() {
const page = new URLSearchParams(location.search).get('page');
if (props.id && page === 'entries') window.protoNavigate('entries');
}
function setTab(name) { tab.value = name; }
return {
D, fmt, keyword, tab, drawerOpen, filtered, selected, rich,
openEntry, closeDrawer, handleDrawerClose, setTab
};
},
template: `
<module-shell active="entries" title="词条词典">
<div class="m-page-head">
<div>
<h1>词条词典</h1>
<p>搜索词条,点击行内“查看”在右侧抽屉中展开详情</p>
</div>
<div class="m-page-meta">38,116 个词条 · 5,250 条无结构化义项</div>
</div>
<div class="m-toolbar">
<div class="m-field m-field-grow">
<label>搜索</label>
<input v-model="keyword" placeholder="输入单词或释义关键词" />
</div>
<div class="m-toolbar-note">仅展示 10 条样本 · cinema 含完整详情</div>
</div>
<div class="a-panel">
<table class="m-table">
<thead>
<tr><th style="width:22%">词条</th><th>释义</th><th class="m-num">义项</th><th class="m-num">收录词书</th><th class="m-num">操作</th></tr>
</thead>
<tbody>
<tr v-for="e in filtered" :key="e.id" style="cursor:pointer" @click="openEntry(e.id)">
<td>
<div class="m-word">{{ e.headword }}</div>
<div class="m-phonetic">{{ e.pronunciation || '—' }}</div>
</td>
<td class="m-def">{{ e.definition }}</td>
<td class="m-num">{{ e.senses }}</td>
<td class="m-num">{{ e.occurrence }}</td>
<td class="m-num"><a class="m-link" @click.stop="openEntry(e.id)">查看</a></td>
</tr>
<tr v-if="!filtered.length"><td colspan="5"><div class="m-empty">没有匹配的词条</div></td></tr>
</tbody>
</table>
</div>
<el-drawer
v-model="drawerOpen"
:with-header="false"
:modal="false"
:lock-scroll="false"
append-to-body
size="760px"
direction="rtl"
class="entry-drawer"
@close="handleDrawerClose"
>
<div v-if="selected" class="drawer-body">
<div class="drawer-head">
<div class="m-detail-main">
<div class="m-detail-kicker">{{ selected.indexWord }}</div>
<h2 class="drawer-title">{{ selected.headword }}</h2>
<div class="m-detail-meta">
<span class="m-tag">{{ selected.pronunciation || '无音标' }}</span>
<span class="m-def" style="font-size:13px">{{ selected.definition }}</span>
</div>
</div>
<div class="m-stat-row">
<div class="m-stat"><b>{{ fmt(selected.occurrence) }}</b><span>收录词书</span></div>
<div class="m-stat"><b>{{ selected.senses }}</b><span>结构化义项</span></div>
<div class="m-stat"><b>{{ rich ? 6 : 0 }}</b><span>例句(样本)</span></div>
</div>
<button class="drawer-close" aria-label="关闭" @click="closeDrawer">×</button>
</div>
<div v-if="!rich" class="m-note drawer-note">
原型仅展开 cinema(entry_id=26132)的完整子资源;当前词条展示基本信息与空状态。
</div>
<div class="m-tabs drawer-tabs">
<div class="m-tab" :class="{ active: tab === 'senses' }" @click="setTab('senses')">义项</div>
<div class="m-tab" :class="{ active: tab === 'phrases' }" @click="setTab('phrases')">短语</div>
<div class="m-tab" :class="{ active: tab === 'examples' }" @click="setTab('examples')">例句</div>
<div class="m-tab" :class="{ active: tab === 'confusables' }" @click="setTab('confusables')">易混词</div>
<div class="m-tab" :class="{ active: tab === 'books' }" @click="setTab('books')">收录词书</div>
</div>
<div class="drawer-tab-panel">
<template v-if="tab === 'senses'">
<table v-if="rich" class="m-table">
<thead><tr><th style="width:56px">#</th><th style="width:80px">词性</th><th>释义</th><th>关联考试</th></tr></thead>
<tbody>
<tr v-for="s in D.entryDetail.senses" :key="s.no">
<td class="m-num">{{ s.no }}</td>
<td><span class="m-tag">{{ s.pos }}</span></td>
<td class="m-def">{{ s.gloss }}</td>
<td class="m-cell-sub">{{ s.exams }}</td>
</tr>
</tbody>
</table>
<div v-else class="m-empty">该词条在原型中未展开结构化义项</div>
</template>
<template v-else-if="tab === 'phrases'">
<table v-if="rich" class="m-table">
<thead><tr><th style="width:38%">短语</th><th>中文</th><th class="m-num">分组</th></tr></thead>
<tbody>
<tr v-for="p in D.entryDetail.phrases" :key="p.en">
<td class="m-word">{{ p.en }}</td>
<td class="m-def">{{ p.zh }}</td>
<td class="m-num">{{ p.type }}</td>
</tr>
</tbody>
</table>
<div v-else class="m-empty">该词条在原型中未展开短语</div>
</template>
<template v-else-if="tab === 'examples'">
<div v-if="rich" class="m-example-list">
<div v-for="(ex, i) in D.entryDetail.examples" :key="i" class="m-example">
<div class="m-example-no">{{ String(i + 1).padStart(2, '0') }}</div>
<div>
<div class="m-example-en">{{ ex.en }}</div>
<div class="m-example-zh">{{ ex.zh }}</div>
</div>
</div>
</div>
<div v-else class="m-empty">该词条在原型中未展开例句</div>
</template>
<template v-else-if="tab === 'confusables'">
<table v-if="rich" class="m-table">
<thead><tr><th style="width:30%">易混词</th><th>释义</th></tr></thead>
<tbody>
<tr v-for="c in D.entryDetail.confusables" :key="c.word">
<td class="m-word">{{ c.word }}</td>
<td class="m-def">{{ c.gloss }}</td>
</tr>
</tbody>
</table>
<div v-else class="m-empty">该词条在原型中未展开易混词</div>
</template>
<template v-else>
<table v-if="rich" class="m-table">
<thead><tr><th style="width:46%">词书</th><th>展示词</th><th class="m-num">词书内顺序</th></tr></thead>
<tbody>
<tr v-for="b in D.entryDetail.books" :key="b.name">
<td class="m-cell-title">{{ b.name }}</td>
<td class="m-def">{{ b.display }}</td>
<td class="m-num">{{ b.seq }}</td>
</tr>
</tbody>
</table>
<div v-else class="m-empty">该词条在原型中未展开收录词书</div>
</template>
</div>
</div>
</el-drawer>
</module-shell>`
};
})();
+154
View File
@@ -0,0 +1,154 @@
// PROTOTYPE ONLY — 词根词缀与词族,含树形族谱。
(function () {
const D = window.MODULE_DATA;
window.ViewMorphology = {
name: 'ViewMorphology',
props: { id: String, kw: String },
setup() {
const { ref, computed } = Vue;
const tab = ref('morphemes');
const morphemeType = ref('all');
const selectedFamily = ref(D.families.find((f) => f.word === 'behave') || D.families[0]);
const typeLabel = (t) => ({ prefix: '前缀', root: '词根', suffix: '后缀' }[t] || t);
const filteredMorphemes = computed(() => (
morphemeType.value === 'all'
? D.morphemes
: D.morphemes.filter((m) => m.type === morphemeType.value)
));
const treeData = computed(() => [{
label: `${D.familyTree.word} · ${D.familyTree.interpretation}`,
type: 'root',
children: [
{
label: `变体 · ${D.familyTree.variants.length}`,
type: 'branch',
children: D.familyTree.variants.map((word) => ({ label: word, type: 'variant' }))
},
{
label: `小组 · ${D.familyTree.groups.length}`,
type: 'branch',
children: D.familyTree.groups.map((group) => ({
label: group.join(' / '),
type: 'group',
children: group.map((word) => ({ label: word, type: 'member' }))
}))
}
]
}]);
const treeProps = { children: 'children', label: 'label' };
function setTab(name) { tab.value = name; }
function setType(type) { morphemeType.value = type; }
function selectFamily(family) { selectedFamily.value = family; }
function openTree(family) {
selectedFamily.value = family;
tab.value = 'tree';
}
return {
D, tab, morphemeType, selectedFamily, typeLabel, filteredMorphemes,
treeData, treeProps, setTab, setType, selectFamily, openTree
};
},
template: `
<module-shell active="morphology" title="词根词族">
<div class="m-page-head">
<div>
<h1>词根词族</h1>
<p>词素、单词卡片与词族层级关系,支持树形族谱</p>
</div>
<div class="m-page-meta">2,235 个词素 · 12,003 张卡片 · 22,717 个词族</div>
</div>
<div class="m-tabs" style="margin-top:0">
<div class="m-tab" :class="{ active: tab === 'morphemes' }" @click="setTab('morphemes')">词素</div>
<div class="m-tab" :class="{ active: tab === 'cards' }" @click="setTab('cards')">单词卡片</div>
<div class="m-tab" :class="{ active: tab === 'families' }" @click="setTab('families')">词族</div>
<div class="m-tab" :class="{ active: tab === 'tree' }" @click="setTab('tree')">树形族谱</div>
</div>
<div v-if="tab === 'morphemes'" class="a-panel">
<div class="m-chip-row">
<span class="m-chip" :class="{ active: morphemeType === 'all' }" @click="setType('all')">全部</span>
<span class="m-chip" :class="{ active: morphemeType === 'prefix' }" @click="setType('prefix')">前缀</span>
<span class="m-chip" :class="{ active: morphemeType === 'root' }" @click="setType('root')">词根</span>
<span class="m-chip" :class="{ active: morphemeType === 'suffix' }" @click="setType('suffix')">后缀</span>
</div>
<table class="m-table">
<thead><tr><th style="width:120px">类型</th><th style="width:22%">词形</th><th>英文释义</th><th>中文释义</th><th>备注</th></tr></thead>
<tbody>
<tr v-for="m in filteredMorphemes" :key="m.id">
<td><span class="m-tag" :class="'m-tag-' + m.type">{{ typeLabel(m.type) }}</span></td>
<td class="m-word">{{ m.form }}</td>
<td class="m-def">{{ m.meaningEn || '—' }}</td>
<td class="m-def">{{ m.meaningZh || '—' }}</td>
<td class="m-cell-sub">{{ m.note || '—' }}</td>
</tr>
</tbody>
</table>
</div>
<div v-else-if="tab === 'cards'" class="m-card-grid">
<div class="m-memo-card" v-for="c in D.cards" :key="c.id">
<div class="m-memo-word">{{ c.word }}</div>
<div class="m-memo-note">{{ c.memory }}</div>
<div v-if="c.example" class="m-memo-example">{{ c.example }}</div>
</div>
</div>
<div v-else-if="tab === 'families'" class="a-panel">
<table class="m-table">
<thead><tr><th style="width:22%">词族</th><th>释义</th><th class="m-num">成员数</th><th class="m-num">操作</th></tr></thead>
<tbody>
<tr v-for="f in D.families" :key="f.id">
<td class="m-word">{{ f.word }}</td>
<td class="m-def">{{ f.interpretation }}</td>
<td class="m-num">{{ f.members }}</td>
<td class="m-num"><a class="m-link" @click="openTree(f)">查看族谱</a></td>
</tr>
</tbody>
</table>
</div>
<div v-else class="m-tree-layout">
<div class="a-panel m-family-list">
<div class="a-panel-head"><div class="a-panel-title">顶层词族</div><div class="a-panel-sub">5,629 个</div></div>
<div
v-for="f in D.families"
:key="f.id"
class="m-family-item"
:class="{ active: selectedFamily.id === f.id }"
@click="selectFamily(f)"
>
<div class="m-family-word">{{ f.word }}</div>
<div class="m-family-meta">{{ f.members }} 个成员</div>
</div>
</div>
<div class="a-panel m-tree-panel">
<div class="a-panel-head">
<div class="a-panel-title">{{ selectedFamily.word }} · 族谱</div>
<div class="a-panel-sub">变体 + 小组 + 成员</div>
</div>
<template v-if="selectedFamily.word === 'behave'">
<el-tree :data="treeData" :props="treeProps" node-key="label" default-expand-all :expand-on-click-node="false">
<template #default="{ data }">
<span class="m-tree-node" :class="'m-tree-' + data.type">
<span>{{ data.label }}</span>
<span v-if="data.type !== 'member'" class="m-tree-type">{{ data.type }}</span>
</span>
</template>
</el-tree>
<div class="m-note" style="margin-top:14px">
注意:变体使用英式拼写 behaviour,小组内使用美式拼写 behavior,源数据存在拼写不一致。
</div>
</template>
<div v-else class="m-empty">该词族的族谱在原型中未展开,仅 behave 提供完整示例。</div>
</div>
</div>
</module-shell>`
};
})();
+124
View File
@@ -0,0 +1,124 @@
// PROTOTYPE ONLY — 数据质量摘要、差异明细与覆盖度。
(function () {
const D = window.MODULE_DATA;
const fmt = (n) => n.toLocaleString('en-US');
window.ViewQuality = {
name: 'ViewQuality',
props: { id: String, kw: String },
setup() {
const { ref, computed } = Vue;
const keyword = ref('');
const mismatch = computed(() => {
const kw = keyword.value.trim().toLowerCase();
if (!kw) return D.quality.mismatch;
return D.quality.mismatch.filter((b) => b.name.toLowerCase().includes(kw) || b.code.toLowerCase().includes(kw));
});
return { D, fmt, keyword, mismatch };
},
template: `
<module-shell active="quality" title="数据质量">
<div class="m-page-head">
<div>
<h1>数据质量</h1>
<p>汇总异常指标,定位声明不符、缺失引用与跨域弱关联</p>
</div>
<div class="m-page-meta">只读快照 · 2026-11-08</div>
</div>
<div class="m-metric-grid">
<div class="m-metric" v-for="q in D.quality.summary" :key="q.label">
<div class="m-metric-top">
<span class="m-dot" :class="q.level"></span>
<span>{{ q.label }}</span>
</div>
<div class="m-metric-value">{{ fmt(q.value) }}<span>{{ q.unit }}</span></div>
</div>
</div>
<div class="a-panel" style="margin-top:16px">
<div class="a-panel-head">
<div class="a-panel-title">声明与实际词条数差异</div>
<div class="a-panel-sub">{{ D.quality.mismatch.length }} 本词书不一致</div>
</div>
<div class="m-toolbar m-toolbar-inline">
<div class="m-field m-field-grow">
<label>筛选</label>
<input v-model="keyword" placeholder="搜索词书名称或编码" />
</div>
</div>
<table class="m-table">
<thead><tr><th style="width:44%">词书</th><th>编码</th><th class="m-num">声明</th><th class="m-num">实际</th><th class="m-num">差异</th></tr></thead>
<tbody>
<tr v-for="b in mismatch" :key="b.code">
<td class="m-cell-title">{{ b.name }}</td>
<td class="m-cell-sub">{{ b.code }}</td>
<td class="m-num">{{ fmt(b.declared) }}</td>
<td class="m-num">{{ fmt(b.actual) }}</td>
<td class="m-num" :class="b.actual > b.declared ? 'm-warn-text' : 'm-bad-text'">
{{ b.actual - b.declared > 0 ? '+' : '' }}{{ b.actual - b.declared }}
</td>
</tr>
<tr v-if="!mismatch.length"><td colspan="5"><div class="m-empty">没有匹配的词书</div></td></tr>
</tbody>
</table>
</div>
<div class="m-two-col" style="margin-top:16px">
<div class="a-panel">
<div class="a-panel-head"><div class="a-panel-title">缺失引用与文件</div><div class="a-panel-sub">需人工核查</div></div>
<div class="m-issue">
<div class="m-issue-head">
<span class="m-dot bad"></span>
<b>缺失词书清单文件</b>
<span class="m-tag">{{ D.quality.missingFile.length }} 本</span>
</div>
<div class="m-issue-body">
<span v-for="b in D.quality.missingFile" :key="b.code">{{ b.name }}({{ b.code }})</span>
</div>
</div>
<div class="m-issue">
<div class="m-issue-head">
<span class="m-dot bad"></span>
<b>缺失 zpk 引用</b>
<span class="m-tag">1 个</span>
</div>
<div class="m-issue-body">源文件引用的 zpk 在解密目录中缺失,无法定位到具体词条。</div>
</div>
<div class="m-issue">
<div class="m-issue-head">
<span class="m-dot warn"></span>
<b>无义项的近义词头</b>
<span class="m-tag">{{ D.quality.synNoSense.length }} 个</span>
</div>
<div class="m-chips">
<span class="m-chip" v-for="w in D.quality.synNoSense" :key="w">{{ w }}</span>
</div>
</div>
</div>
<div class="a-panel">
<div class="a-panel-head"><div class="a-panel-title">跨域文本覆盖度</div><div class="a-panel-sub">与词条索引词交集</div></div>
<div class="m-cov" v-for="c in D.quality.coverage" :key="c.name">
<div class="m-cov-top">
<span>{{ c.name }}</span>
<b>{{ c.pct }}% · {{ fmt(c.hit) }}/{{ fmt(c.total) }}</b>
</div>
<div class="m-cov-track"><div class="m-cov-fill" :style="{ width: c.pct + '%' }"></div></div>
<div class="m-cov-note">未覆盖 {{ fmt(c.total - c.hit) }} 个</div>
</div>
<div class="m-note" style="margin-top:14px">
跨域关联基于单词文本(归一化小写),不是数据库外键;词族覆盖度明显低于其他两域。
</div>
</div>
</div>
<div class="m-note" style="margin-top:16px">
口径说明:声明与实际差异按 book.declared_entry_count 与 book_entry 实际行数比较;“未设置考试”单列为“未归类”,不计入异常;无结构化义项指 word_entry 在 word_sense 中没有任何记录。
</div>
</module-shell>`
};
})();
+153
View File
@@ -0,0 +1,153 @@
// PROTOTYPE ONLY — 近义词头、义项、分考试近义组与反义词。
(function () {
const D = window.MODULE_DATA;
window.ViewSynonyms = {
name: 'ViewSynonyms',
props: { id: String, kw: String },
setup(props) {
const { ref, computed } = Vue;
const keyword = ref('');
const selected = computed(() => D.synonyms.find((s) => String(s.id) === props.id) || null);
const rich = computed(() => !!selected.value && selected.value.id === D.synonymDetail.id);
const filtered = computed(() => {
const kw = keyword.value.trim().toLowerCase();
return kw ? D.synonyms.filter((s) => s.word.toLowerCase().includes(kw)) : D.synonyms;
});
const groupsFor = (senseId) => D.synonymDetail.groups.filter((g) => g.senseId === senseId);
const membersFor = (group) => {
const found = D.synonymDetail.members.find((m) => m.senseId === group.senseId && m.exam === group.exam);
return found ? found.words : [];
};
const dist = computed(() => {
const buckets = {};
D.synonymDetail.groups.forEach((g) => { buckets[g.count] = (buckets[g.count] || 0) + 1; });
const keys = Object.keys(buckets).map(Number).sort((a, b) => a - b);
const max = Math.max(...Object.values(buckets), 1);
return keys.map((k) => ({ label: `${k} 个成员`, count: buckets[k], pct: Math.round((buckets[k] / max) * 100) }));
});
function openWord(id) { window.protoNavigate('synonyms', id); }
function back() { window.protoNavigate('synonyms'); }
return { D, keyword, filtered, selected, rich, groupsFor, membersFor, dist, openWord, back };
},
template: `
<module-shell active="synonyms" :title="selected ? '近反义词详情' : '近反义词'">
<template v-if="!selected">
<div class="m-page-head">
<div>
<h1>近反义词</h1>
<p>按义项与考试浏览近义组、规范词和反义词</p>
</div>
<div class="m-page-meta">6,279 个词头 · 8,383 个义项 · 188,003 个组成员</div>
</div>
<div class="m-toolbar">
<div class="m-field m-field-grow">
<label>搜索</label>
<input v-model="keyword" placeholder="输入近义词头" />
</div>
<div class="m-toolbar-note">仅展示 8 个样本 · gain 含完整详情</div>
</div>
<div class="a-panel">
<table class="m-table">
<thead><tr><th style="width:32%">词头</th><th class="m-num">义项数</th><th class="m-num">操作</th></tr></thead>
<tbody>
<tr v-for="s in filtered" :key="s.id">
<td class="m-word">{{ s.word }}</td>
<td class="m-num">{{ s.senses }}</td>
<td class="m-num"><a class="m-link" @click="openWord(s.id)">查看</a></td>
</tr>
<tr v-if="!filtered.length"><td colspan="3"><div class="m-empty">没有匹配的词头</div></td></tr>
</tbody>
</table>
</div>
</template>
<template v-else>
<div class="m-back" @click="back">← 返回词头列表</div>
<div class="a-panel m-detail-head">
<div class="m-detail-main">
<div class="m-detail-kicker">SYNONYM</div>
<h1 class="m-detail-title">{{ selected.word }}</h1>
<div class="m-detail-meta">
<span class="m-tag">{{ selected.senses }} 个义项</span>
<span v-if="rich" class="m-tag">267 个组成员</span>
<span v-if="rich" class="m-tag">22 条反义关系</span>
</div>
</div>
<div v-if="rich" class="m-stat-row">
<div class="m-stat"><b>{{ selected.senses }}</b><span>义项</span></div>
<div class="m-stat"><b>267</b><span>组成员</span></div>
<div class="m-stat"><b>22</b><span>反义关系</span></div>
</div>
</div>
<div v-if="!rich" class="m-note" style="margin-top:12px">
原型仅展开 gain(word_id=2411)的完整近反义数据;当前词头展示基本信息与空状态。
</div>
<template v-if="rich">
<div class="m-two-col" style="margin-top:16px">
<div class="a-panel">
<div class="a-panel-head"><div class="a-panel-title">义项与近义组</div><div class="a-panel-sub">按考试分组</div></div>
<div class="m-sense" v-for="s in D.synonymDetail.senses" :key="s.id">
<div class="m-sense-head">
<span class="m-sense-no">{{ s.id }}</span>
<span class="m-tag">{{ s.pos }}</span>
<span class="m-sense-gloss">{{ s.gloss }}</span>
</div>
<div v-if="groupsFor(s.id).length" class="m-group-grid">
<div class="m-group" v-for="g in groupsFor(s.id)" :key="g.exam">
<div class="m-group-top">
<span class="m-tag">{{ g.exam }}</span>
<span class="m-cell-sub">{{ g.count }} 个成员</span>
</div>
<div class="m-group-canon" v-if="g.canonical">规范词:<b>{{ g.canonical }}</b></div>
<div class="m-chips" v-if="membersFor(g).length">
<span class="m-chip" v-for="w in membersFor(g)" :key="w">{{ w }}</span>
</div>
<div v-else class="m-group-empty">成员未在原型中展开</div>
</div>
</div>
<div v-else class="m-group-empty">该义项在原型中没有考试分组数据</div>
</div>
</div>
<div class="m-side-stack">
<div class="a-panel">
<div class="a-panel-head"><div class="a-panel-title">组规模分布</div><div class="a-panel-sub">按成员数量分桶</div></div>
<div class="m-bar-row" v-for="d in dist" :key="d.label">
<span class="m-bar-label">{{ d.label }}</span>
<span class="m-bar-track"><span class="m-bar-fill" :style="{ width: d.pct + '%' }"></span></span>
<span class="m-bar-value">{{ d.count }} 组</span>
</div>
</div>
<div class="a-panel">
<div class="a-panel-head"><div class="a-panel-title">反义词</div><div class="a-panel-sub">按义项与考试</div></div>
<div class="m-antonym" v-for="a in D.synonymDetail.antonyms" :key="a.senseId">
<div class="m-antonym-head">
<span class="m-tag">义项</span>
<span class="m-sense-gloss">{{ a.gloss }}</span>
<b class="m-antonym-word">{{ a.word }}</b>
</div>
<div class="m-chips">
<span class="m-chip" v-for="e in a.exams" :key="e">{{ e }}</span>
</div>
</div>
</div>
</div>
</div>
</template>
<div v-else class="a-panel m-tab-panel" style="margin-top:16px">
<div class="m-empty">该词头的义项、近义组与反义词在原型中未展开</div>
</div>
</template>
</module-shell>`
};
})();
+3
View File
@@ -0,0 +1,3 @@
<template>
<router-view />
</template>
+7
View File
@@ -0,0 +1,7 @@
import http from './http'
import type { ApiResponse, LoginResponse } from './types'
export async function login(username: string, password: string): Promise<LoginResponse> {
const { data } = await http.post<ApiResponse<LoginResponse>>('/auth/login', { username, password })
return data.data
}
+49
View File
@@ -0,0 +1,49 @@
import http from './http'
import type {
ApiResponse,
BookDetail,
BookEntryItem,
BookListItem,
ExamOption,
Items,
PageResult
} from './types'
export interface BookQuery {
page?: number
size?: number
examId?: string | null
keyword?: string
hasFile?: boolean | null
}
export interface BookEntryQuery {
page?: number
size?: number
keyword?: string
}
export async function getBooks(params: BookQuery): Promise<PageResult<BookListItem>> {
const { data } = await http.get<ApiResponse<PageResult<BookListItem>>>('/books', { params })
return data.data
}
export async function getBook(id: string): Promise<BookDetail> {
const { data } = await http.get<ApiResponse<BookDetail>>(`/books/${id}`)
return data.data
}
export async function getBookEntries(
id: string,
params: BookEntryQuery
): Promise<PageResult<BookEntryItem>> {
const { data } = await http.get<ApiResponse<PageResult<BookEntryItem>>>(`/books/${id}/entries`, {
params
})
return data.data
}
export async function getExams(): Promise<ExamOption[]> {
const { data } = await http.get<ApiResponse<Items<ExamOption>>>('/exams')
return data.data.items
}
+61
View File
@@ -0,0 +1,61 @@
import http from './http'
import type {
ApiResponse,
DashboardSummary,
ExamStat,
Items,
PosStat,
TopBook
} from './types'
import {
mockCoverage,
mockExams,
mockKpis,
mockPos,
mockQuality,
mockTopBooks
} from '@/mocks/dashboard'
const useMock = import.meta.env.VITE_USE_MOCK === 'true'
function delay<T>(data: T): Promise<T> {
return new Promise((resolve) => setTimeout(() => resolve(data), 220))
}
function refreshParams(refresh: boolean) {
return refresh ? { refresh: true } : undefined
}
export async function getDashboardSummary(refresh = false): Promise<DashboardSummary> {
if (useMock) {
return delay({ kpis: mockKpis, quality: mockQuality, coverage: mockCoverage })
}
const { data } = await http.get<ApiResponse<DashboardSummary>>('/dashboard/summary', {
params: refreshParams(refresh)
})
return data.data
}
export async function getExamDistribution(refresh = false): Promise<ExamStat[]> {
if (useMock) return delay(mockExams)
const { data } = await http.get<ApiResponse<Items<ExamStat>>>('/dashboard/exam-distribution', {
params: refreshParams(refresh)
})
return data.data.items
}
export async function getTopBooks(refresh = false): Promise<TopBook[]> {
if (useMock) return delay(mockTopBooks)
const { data } = await http.get<ApiResponse<Items<TopBook>>>('/dashboard/book-size-top', {
params: refreshParams(refresh)
})
return data.data.items
}
export async function getPosDistribution(refresh = false): Promise<PosStat[]> {
if (useMock) return delay(mockPos)
const { data } = await http.get<ApiResponse<Items<PosStat>>>('/dashboard/pos-distribution', {
params: refreshParams(refresh)
})
return data.data.items
}
+78
View File
@@ -0,0 +1,78 @@
import http from './http'
import type {
ApiResponse,
ConfusableItem,
EntryBookItem,
EntryDetail,
EntryListItem,
ExampleGroupItem,
Items,
PageResult,
PhraseItem,
SenseItem,
SpellingVariantItem
} from './types'
export interface EntryQuery {
page?: number
size?: number
keyword?: string
}
export async function getEntries(params: EntryQuery): Promise<PageResult<EntryListItem>> {
const { data } = await http.get<ApiResponse<PageResult<EntryListItem>>>('/entries', { params })
return data.data
}
export async function getEntry(id: string): Promise<EntryDetail> {
const { data } = await http.get<ApiResponse<EntryDetail>>(`/entries/${id}`)
return data.data
}
export async function getEntrySenses(id: string): Promise<SenseItem[]> {
const { data } = await http.get<ApiResponse<Items<SenseItem>>>(`/entries/${id}/senses`)
return data.data.items
}
export async function getEntryPhrases(
id: string,
page: number,
size: number
): Promise<PageResult<PhraseItem>> {
const { data } = await http.get<ApiResponse<PageResult<PhraseItem>>>(`/entries/${id}/phrases`, {
params: { page, size }
})
return data.data
}
export async function getEntryExamples(
id: string,
page: number,
size: number
): Promise<PageResult<ExampleGroupItem>> {
const { data } = await http.get<ApiResponse<PageResult<ExampleGroupItem>>>(`/entries/${id}/examples`, {
params: { page, size }
})
return data.data
}
export async function getEntryConfusables(id: string): Promise<ConfusableItem[]> {
const { data } = await http.get<ApiResponse<Items<ConfusableItem>>>(`/entries/${id}/confusables`)
return data.data.items
}
export async function getEntryVariants(id: string): Promise<SpellingVariantItem[]> {
const { data } = await http.get<ApiResponse<Items<SpellingVariantItem>>>(`/entries/${id}/variants`)
return data.data.items
}
export async function getEntryBooks(
id: string,
page: number,
size: number
): Promise<PageResult<EntryBookItem>> {
const { data } = await http.get<ApiResponse<PageResult<EntryBookItem>>>(`/entries/${id}/books`, {
params: { page, size }
})
return data.data
}
+35
View File
@@ -0,0 +1,35 @@
import axios from 'axios'
import { clearAuthStorage, TOKEN_KEY } from '@/utils/storage'
const http = axios.create({
baseURL: import.meta.env.VITE_API_BASE_URL ?? '/api',
timeout: 20000
})
http.interceptors.request.use((config) => {
const token = localStorage.getItem(TOKEN_KEY)
if (token) {
config.headers.Authorization = `Bearer ${token}`
}
return config
})
http.interceptors.response.use(
(response) => response,
(error) => {
const status = error.response?.status
const url: string = error.config?.url ?? ''
const message: string =
error.response?.data?.message ?? error.message ?? '请求失败'
if (status === 401 && !url.includes('/auth/login')) {
clearAuthStorage()
if (window.location.pathname !== '/login') {
const redirect = encodeURIComponent(window.location.pathname + window.location.search)
window.location.assign(`/login?redirect=${redirect}`)
}
}
return Promise.reject(new Error(message))
}
)
export default http
+62
View File
@@ -0,0 +1,62 @@
import http from './http'
import type {
ApiResponse,
CardDetail,
CardItem,
FamilyDetail,
FamilyItem,
MorphemeDetail,
MorphemeItem,
PageResult,
TreePage
} from './types'
export interface PagedQuery {
page?: number
size?: number
keyword?: string
}
export async function getMorphemes(
params: PagedQuery & { type?: string }
): Promise<PageResult<MorphemeItem>> {
const { data } = await http.get<ApiResponse<PageResult<MorphemeItem>>>('/morphemes', { params })
return data.data
}
export async function getMorpheme(id: string): Promise<MorphemeDetail> {
const { data } = await http.get<ApiResponse<MorphemeDetail>>(`/morphemes/${id}`)
return data.data
}
export async function getCards(params: PagedQuery): Promise<PageResult<CardItem>> {
const { data } = await http.get<ApiResponse<PageResult<CardItem>>>('/cards', { params })
return data.data
}
export async function getCard(id: string): Promise<CardDetail> {
const { data } = await http.get<ApiResponse<CardDetail>>(`/cards/${id}`)
return data.data
}
export async function getFamilies(params: PagedQuery): Promise<PageResult<FamilyItem>> {
const { data } = await http.get<ApiResponse<PageResult<FamilyItem>>>('/families', { params })
return data.data
}
export async function getFamily(id: string): Promise<FamilyDetail> {
const { data } = await http.get<ApiResponse<FamilyDetail>>(`/families/${id}`)
return data.data
}
export async function getFamilyTree(
id: string,
nodeType: string,
page = 1,
size = 50
): Promise<TreePage> {
const { data } = await http.get<ApiResponse<TreePage>>(`/families/${id}/tree`, {
params: { nodeType, page, size }
})
return data.data
}
+39
View File
@@ -0,0 +1,39 @@
import http from './http'
import type {
ApiResponse,
DeclaredDiff,
Items,
MissingReference,
QualityCoverage,
QualitySummary
} from './types'
export async function getQualitySummary(refresh = false): Promise<QualitySummary> {
const { data } = await http.get<ApiResponse<QualitySummary>>('/quality/summary', {
params: refresh ? { refresh: true } : undefined
})
return data.data
}
export async function getDeclaredDiff(refresh = false): Promise<DeclaredDiff[]> {
const { data } = await http.get<ApiResponse<Items<DeclaredDiff>>>('/quality/declared-vs-actual', {
params: refresh ? { refresh: true } : undefined
})
return data.data.items
}
export async function getMissingReferences(refresh = false): Promise<MissingReference[]> {
const { data } = await http.get<ApiResponse<Items<MissingReference>>>(
'/quality/missing-references',
{ params: refresh ? { refresh: true } : undefined }
)
return data.data.items
}
export async function getQualityCoverage(refresh = false): Promise<QualityCoverage[]> {
const { data } = await http.get<ApiResponse<Items<QualityCoverage>>>(
'/quality/cross-domain-coverage',
{ params: refresh ? { refresh: true } : undefined }
)
return data.data.items
}
+30
View File
@@ -0,0 +1,30 @@
import http from './http'
import type {
ApiResponse,
Items,
PageResult,
SizeBucket,
SynonymDetail,
SynonymWordItem
} from './types'
export interface SynonymQuery {
page?: number
size?: number
keyword?: string
}
export async function getSynonyms(params: SynonymQuery): Promise<PageResult<SynonymWordItem>> {
const { data } = await http.get<ApiResponse<PageResult<SynonymWordItem>>>('/synonyms', { params })
return data.data
}
export async function getSynonym(wordId: string): Promise<SynonymDetail> {
const { data } = await http.get<ApiResponse<SynonymDetail>>(`/synonyms/${wordId}`)
return data.data
}
export async function getSynonymDistribution(): Promise<SizeBucket[]> {
const { data } = await http.get<ApiResponse<Items<SizeBucket>>>('/synonyms/group-size-distribution')
return data.data.items
}
+443
View File
@@ -0,0 +1,443 @@
export type Tone = 'blue' | 'green' | 'violet' | 'amber' | 'cyan' | 'rose'
export interface ApiResponse<T> {
code: number
message: string
data: T
}
export interface Items<T> {
items: T[]
}
export interface PageResult<T> {
items: T[]
total: number
page: number
size: number
}
export interface ExamOption {
id: string
code: string
name: string
}
export interface ExamRef {
id: string
code: string | null
name: string
}
/* ---------- 概览 ---------- */
export interface Kpi {
key: string
label: string
value: number
note: string
tone: Tone
}
export interface ExamStat {
name: string
code: string | null
books: number
entries: number
}
export interface TopBook {
id: string
name: string
code: string
exam: string | null
declared: number | null
actual: number
coverPath: string | null
}
export interface PosStat {
name: string
value: number
}
export type QualityLevel = 'bad' | 'warn' | 'info'
export interface QualityItem {
key: string
label: string
value: number
unit: string
level: QualityLevel
target: string
}
export interface CoverageItem {
name: string
hit: number
total: number
pct: number
}
export interface DashboardSummary {
kpis: Kpi[]
quality: QualityItem[]
coverage: CoverageItem[]
}
/* ---------- 词书 ---------- */
export interface BookListItem {
id: string
code: string
name: string
examId: string | null
examName: string | null
declared: number | null
actual: number
hasFile: boolean
coverPath: string | null
}
export interface BookDetail extends BookListItem {
description: string | null
contentVersion: number | null
schemaVersion: number | null
packageUrl: string | null
sortAt: number | null
labels: string | null
mismatch: boolean
}
export interface BookEntryItem {
entryId: string
displayWord: string
headwordText: string | null
seqBook: number | null
seqAz: number | null
seqFreq: number | null
headword: string | null
indexWord: string | null
}
/* ---------- 词条 ---------- */
export interface EntryListItem {
id: string
headword: string
indexWord: string
pronunciation: string | null
definition: string | null
senseCount: number
bookCount: number
}
export interface EntryDetail {
id: string
headword: string
indexWord: string
usPronunciation: string | null
ukPronunciation: string | null
definitionText: string | null
dataVersion: string | null
bookExamId: string | null
bookExamName: string | null
occurrenceCount: number | null
hasListeningExamples: boolean
sourceZpkKey: string | null
}
export interface SenseRelation {
type: string
position: number | null
targetMeaningId: string | null
targetEntryId: string | null
}
export interface SenseItem {
senseId: string
senseNo: number | null
partOfSpeech: string | null
glossZh: string | null
exams: ExamRef[]
relations: SenseRelation[]
}
export interface PhraseOrder {
examId: string
examName: string
groupType: number | null
position: number | null
}
export interface PhraseItem {
id: string
textEn: string
textZh: string | null
groupType: number | null
meaningId: string | null
exams: ExamRef[]
orders: PhraseOrder[]
}
export interface ExampleSentenceItem {
id: string
textEn: string
textZh: string | null
sourceTitle: string | null
audioUrl: string | null
listening: boolean
}
export interface ExampleUsageItem {
id: string
patternId: string | null
patternText: string | null
position: number | null
sentences: ExampleSentenceItem[]
}
export interface ExampleGroupItem {
id: string
groupKind: number
partOfSpeech: string | null
entryKindCode: string | null
headForm: string | null
definitionEn: string | null
definitionZh: string | null
exams: ExamRef[]
usages: ExampleUsageItem[]
directSentences: ExampleSentenceItem[]
sentenceCount: number
}
export interface ConfusableItem {
id: string
wordText: string
glossZh: string | null
posCode: number | null
spellingFlag: string | null
position: number | null
}
export interface SpellingVariantItem {
position: number | null
variant: string
}
export interface EntryBookItem {
bookId: string
bookName: string
bookCode: string
displayWord: string
seqBook: number | null
}
/* ---------- 词根词族 ---------- */
export interface MorphemeItem {
id: string
type: 'prefix' | 'root' | 'suffix'
form: string | null
displayText: string
meaningEn: string | null
meaningZh: string | null
note: string | null
}
export interface CardBrief {
id: string
word: string
memoryNote: string | null
exampleText: string | null
}
export interface MorphemeDetail extends MorphemeItem {
cards: CardBrief[]
cardCount: number
}
export interface CardItem {
id: string
word: string
memoryNote: string | null
highlightedWord: string | null
exams: ExamRef[]
}
export interface CardFamilyLink {
linkId: string
groupNo: number
familyRef: string | null
hidden: boolean
}
export interface CardDetail {
id: string
word: string
highlightedWord: string | null
memoryNote: string | null
exampleText: string | null
hidden: boolean
prefixMorphemeId: string | null
prefixForm: string | null
rootMorphemeId: string | null
rootForm: string | null
suffixMorphemeId: string | null
suffixForm: string | null
defaultFamilyRef: string | null
exams: ExamRef[]
familyLinks: CardFamilyLink[]
}
export interface FamilyItem {
id: string
word: string
topFamilyId: string
topWord: string
interpretation: string | null
groupLevel1: number | null
groupLevel2: number | null
groupLevel3: number | null
exams: ExamRef[]
}
export interface FamilyVariantItem {
id: string
variantWord: string
interpretation: string | null
memberCount: number
}
export interface FamilyMemberItem {
familyEntryId: string
word: string
position: number | null
}
export interface MiniGroupItem {
id: string
size: number
members: FamilyMemberItem[]
}
export interface FamilyDetail extends FamilyItem {
variants: FamilyVariantItem[]
miniGroups: MiniGroupItem[]
}
export interface TreeNode {
nodeType: 'top' | 'variant' | 'miniGroup' | 'member' | 'info'
id: string
label: string
subtitle: string
memberCount: number
leaf: boolean
}
export interface TreePage {
nodes: TreeNode[]
total: number
page: number
size: number
}
/* ---------- 近反义词 ---------- */
export interface SynonymWordItem {
wordId: string
word: string
senseCount: number
hasRelation: boolean
}
export interface SynonymMember {
wordId: string
word: string
position: number | null
}
export interface SynonymGroup {
examId: string
examName: string
canonicalWordId: string | null
canonicalWord: string | null
memberCount: number
members: SynonymMember[]
truncated: boolean
}
export interface AntonymGroup {
examId: string
examName: string
words: SynonymMember[]
}
export interface SynonymSense {
senseId: string
partOfSpeech: string | null
glossZh: string | null
groups: SynonymGroup[]
antonyms: AntonymGroup[]
}
export interface SynonymDetail {
wordId: string
word: string
senses: SynonymSense[]
}
export interface SizeBucket {
label: string
count: number
pct: number
}
/* ---------- 数据质量 ---------- */
export interface QualitySummaryItem {
key: string
label: string
value: number
unit: string
level: QualityLevel
description: string
}
export interface QualitySummary {
items: QualitySummaryItem[]
}
export interface DeclaredDiff {
bookId: string
bookName: string
bookCode: string
examName: string | null
declared: number
actual: number
diff: number
}
export interface MissingReference {
type: string
identifier: string
source: string
detail: string
bookId: string | null
}
export interface QualityCoverage {
key: string
name: string
hit: number
total: number
pct: number
}
/* ---------- 认证 ---------- */
export interface LoginResponse {
token: string
expiresAt: string
username: string
}
+92
View File
@@ -0,0 +1,92 @@
import type { EChartsOption } from 'echarts'
import type { ExamStat, PosStat } from '@/api/types'
const POS_COLORS = [
'#2563eb',
'#3b82f6',
'#60a5fa',
'#93c5fd',
'#a5b4fc',
'#c7d2fe',
'#818cf8',
'#6366f1',
'#4f46e5',
'#cbd5e1'
]
function short(n: number): string {
return n >= 10000 ? `${(n / 1000).toFixed(1)}k` : String(n)
}
export function examChartOption(rows: ExamStat[]): EChartsOption {
const reversed = [...rows].reverse()
return {
grid: { left: 8, right: 56, top: 6, bottom: 6, containLabel: true },
tooltip: {
trigger: 'axis',
axisPointer: { type: 'shadow' },
formatter: '{b}<br/>关联词条 {c}'
},
xAxis: {
type: 'value',
splitLine: { lineStyle: { color: '#f1f3f6' } },
axisLabel: {
color: '#9ca3af',
fontSize: 10,
formatter: (value: string | number) => short(Number(value))
}
},
yAxis: {
type: 'category',
data: reversed.map((row) => row.name),
axisTick: { show: false },
axisLine: { show: false },
axisLabel: { color: '#4b5563', fontSize: 11.5 }
},
series: [
{
type: 'bar',
barWidth: 13,
data: reversed.map((row) => ({
value: row.entries,
itemStyle: { color: row.code === null ? '#cbd5e1' : '#3b82f6', borderRadius: [0, 3, 3, 0] }
})),
label: {
show: true,
position: 'right',
color: '#6b7280',
fontSize: 10.5,
formatter: '{c}'
}
}
]
}
}
export function posChartOption(rows: PosStat[]): EChartsOption {
return {
tooltip: { trigger: 'item', formatter: '{b}: {c} ({d}%)' },
legend: {
right: 0,
top: 'center',
orient: 'vertical',
itemWidth: 8,
itemHeight: 8,
textStyle: { color: '#6b7280', fontSize: 11 }
},
series: [
{
type: 'pie',
radius: ['46%', '70%'],
center: ['34%', '50%'],
itemStyle: { borderColor: '#fff', borderWidth: 2 },
label: { show: false },
data: rows.map((row, index) => ({
name: row.name,
value: row.value,
itemStyle: { color: POS_COLORS[index % POS_COLORS.length] }
}))
}
]
}
}
+44
View File
@@ -0,0 +1,44 @@
import type { EChartsOption } from 'echarts'
import type { QualityCoverage } from '@/api/types'
export function coverageOption(rows: QualityCoverage[]): EChartsOption {
return {
grid: { left: 8, right: 48, top: 8, bottom: 8, containLabel: true },
tooltip: {
trigger: 'axis',
axisPointer: { type: 'shadow' },
formatter: (params: unknown) => {
const item = (params as { name: string; value: number }[])[0]
return `${item.name}<br/>覆盖率 ${item.value}%`
}
},
xAxis: {
type: 'value',
max: 100,
splitLine: { lineStyle: { color: '#f1f3f6' } },
axisLabel: { color: '#9ca3af', fontSize: 10, formatter: '{value}%' }
},
yAxis: {
type: 'category',
data: rows.map((row) => row.name),
axisTick: { show: false },
axisLine: { show: false },
axisLabel: { color: '#4b5563', fontSize: 11.5 }
},
series: [
{
type: 'bar',
barWidth: 16,
itemStyle: { color: '#0891b2', borderRadius: [0, 4, 4, 0] },
label: {
show: true,
position: 'right',
color: '#6b7280',
fontSize: 10.5,
formatter: '{c}%'
},
data: rows.map((row) => row.pct)
}
]
}
}
+43
View File
@@ -0,0 +1,43 @@
import type { EChartsOption } from 'echarts'
import type { SizeBucket } from '@/api/types'
export function synonymDistributionOption(rows: SizeBucket[]): EChartsOption {
return {
grid: { left: 8, right: 24, top: 16, bottom: 8, containLabel: true },
tooltip: {
trigger: 'axis',
axisPointer: { type: 'shadow' },
formatter: (params: unknown) => {
const item = (params as { name: string; value: number }[])[0]
return `${item.name} 个成员<br/>组数 ${item.value.toLocaleString('en-US')}`
}
},
xAxis: {
type: 'category',
data: rows.map((row) => row.label),
axisTick: { show: false },
axisLine: { lineStyle: { color: '#e5e7eb' } },
axisLabel: { color: '#6b7280', fontSize: 11 }
},
yAxis: {
type: 'value',
splitLine: { lineStyle: { color: '#f1f3f6' } },
axisLabel: { color: '#9ca3af', fontSize: 10 }
},
series: [
{
type: 'bar',
barWidth: 22,
itemStyle: { color: '#6366f1', borderRadius: [4, 4, 0, 0] },
label: {
show: true,
position: 'top',
color: '#6b7280',
fontSize: 10,
formatter: '{c}'
},
data: rows.map((row) => row.count)
}
]
}
}
+33
View File
@@ -0,0 +1,33 @@
<script setup lang="ts">
import { computed } from 'vue'
import { coverUrl, onCoverError } from '@/utils/cover'
const props = withDefaults(
defineProps<{
path: string | null
width?: number
height?: number
radius?: number
}>(),
{ width: 30, height: 40, radius: 4 }
)
const style = computed(() => ({
width: `${props.width}px`,
height: `${props.height}px`,
borderRadius: `${props.radius}px`
}))
</script>
<template>
<img class="cover-image" :src="coverUrl(props.path)" :style="style" alt="" @error="onCoverError" />
</template>
<style scoped>
.cover-image {
object-fit: cover;
background: #eef2f7;
flex: none;
display: block;
}
</style>
+104
View File
@@ -0,0 +1,104 @@
<script setup lang="ts">
withDefaults(
defineProps<{
data: any[]
loading: boolean
error?: string
total: number
page: number
size: number
emptyText?: string
rowKey?: string
}>(),
{ error: '', emptyText: '暂无数据', rowKey: undefined }
)
const emit = defineEmits<{
(event: 'update:page', value: number): void
(event: 'update:size', value: number): void
(event: 'row-click', row: unknown): void
}>()
</script>
<template>
<div class="data-table">
<el-alert
v-if="error"
:title="error"
type="error"
show-icon
:closable="false"
class="table-error"
/>
<template v-else>
<el-table
v-loading="loading"
:data="data"
:row-key="rowKey"
size="small"
class="table"
@row-click="(row: unknown) => emit('row-click', row)"
>
<slot />
<template #empty>
<el-empty :description="emptyText" :image-size="70" />
</template>
</el-table>
<div v-if="total > 0" class="pager">
<span class="total">共 {{ total.toLocaleString('en-US') }} 条</span>
<el-pagination
background
layout="sizes, prev, pager, next"
:total="total"
:current-page="page"
:page-size="size"
:page-sizes="[20, 50, 100]"
@current-change="(value: number) => emit('update:page', value)"
@size-change="(value: number) => emit('update:size', value)"
/>
</div>
</template>
</div>
</template>
<style scoped>
.data-table {
min-width: 0;
}
.table {
width: 100%;
}
.table :deep(.el-table__header th) {
font-size: 11.5px;
color: #9ca3af;
font-weight: 500;
}
.table :deep(.el-table__cell) {
padding: 8px 0;
}
.table :deep(.el-table__row) {
cursor: pointer;
}
.pager {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
margin-top: 14px;
flex-wrap: wrap;
}
.total {
font-size: 12px;
color: #9ca3af;
}
.table-error {
margin-bottom: 12px;
}
</style>
+44
View File
@@ -0,0 +1,44 @@
<script setup lang="ts">
defineProps<{
title: string
subtitle?: string
}>()
</script>
<template>
<section class="panel">
<header class="panel-head">
<div class="panel-title">{{ title }}</div>
<div v-if="subtitle" class="panel-sub">{{ subtitle }}</div>
</header>
<slot />
</section>
</template>
<style scoped>
.panel {
background: #fff;
border: 1px solid #e8ebf0;
border-radius: 10px;
padding: 16px 18px;
min-width: 0;
}
.panel-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-bottom: 12px;
}
.panel-title {
font-size: 14px;
font-weight: 600;
}
.panel-sub {
font-size: 11.5px;
color: #9ca3af;
}
</style>
+56
View File
@@ -0,0 +1,56 @@
<script setup lang="ts">
import type { Tone } from '@/api/types'
const props = defineProps<{
label: string
value: number
note: string
tone: Tone
}>()
const toneColor: Record<Tone, string> = {
blue: '#2563eb',
green: '#16a34a',
violet: '#7c3aed',
amber: '#d97706',
cyan: '#0891b2',
rose: '#e11d48'
}
const fmt = (n: number) => n.toLocaleString('en-US')
</script>
<template>
<div class="stat-card" :style="{ borderLeftColor: toneColor[props.tone] }">
<div class="stat-label">{{ props.label }}</div>
<div class="stat-value">{{ fmt(props.value) }}</div>
<div class="stat-note">{{ props.note }}</div>
</div>
</template>
<style scoped>
.stat-card {
background: #fff;
border: 1px solid #e8ebf0;
border-left-width: 3px;
border-radius: 10px;
padding: 14px;
}
.stat-label {
font-size: 12px;
color: #6b7280;
}
.stat-value {
font-size: 23px;
font-weight: 700;
margin: 7px 0 3px;
font-variant-numeric: tabular-nums;
}
.stat-note {
font-size: 11px;
color: #9ca3af;
}
</style>
+11
View File
@@ -0,0 +1,11 @@
/// <reference types="vite/client" />
interface ImportMetaEnv {
readonly VITE_USE_MOCK?: string
readonly VITE_API_BASE_URL?: string
readonly VITE_COVER_BASE_URL?: string
}
interface ImportMeta {
readonly env: ImportMetaEnv
}
+214
View File
@@ -0,0 +1,214 @@
<script setup lang="ts">
import { computed } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import {
Collection,
Connection,
DataAnalysis,
Reading,
Switch,
Warning
} from '@element-plus/icons-vue'
import { useAuthStore } from '@/stores/auth'
const route = useRoute()
const router = useRouter()
const auth = useAuthStore()
const activeMenu = computed(() => {
if (route.path === '/') return '/'
return `/${route.path.split('/')[1]}`
})
const pageTitle = computed(() => String(route.meta.title ?? '概览'))
const initials = computed(() => (auth.username || 'AD').slice(0, 2).toUpperCase())
function logout(): void {
auth.logout()
void router.replace({ name: 'login' })
}
</script>
<template>
<div class="admin-shell">
<aside class="sidebar">
<div class="brand">
<div class="brand-mark">W</div>
<div>
<div class="brand-name">Word Market</div>
<div class="brand-sub">词库管理后台</div>
</div>
</div>
<el-menu :default-active="activeMenu" router class="nav">
<el-menu-item index="/">
<el-icon><DataAnalysis /></el-icon>
<span>概览</span>
</el-menu-item>
<el-menu-item index="/books">
<el-icon><Reading /></el-icon>
<span>词书管理</span>
</el-menu-item>
<el-menu-item index="/entries">
<el-icon><Collection /></el-icon>
<span>词条词典</span>
</el-menu-item>
<el-menu-item index="/morphology">
<el-icon><Connection /></el-icon>
<span>词根词族</span>
</el-menu-item>
<el-menu-item index="/synonyms">
<el-icon><Switch /></el-icon>
<span>近反义词</span>
</el-menu-item>
<el-menu-item index="/quality">
<el-icon><Warning /></el-icon>
<span>数据质量</span>
</el-menu-item>
</el-menu>
<div class="side-foot">只读模式 · 数据快照 2026-11-08</div>
</aside>
<main class="main">
<header class="topbar">
<div class="crumb">后台 / <b>{{ pageTitle }}</b></div>
<div class="top-actions">
<el-tag type="info" effect="plain" round>只读模式</el-tag>
<span class="user-name">{{ auth.username || 'admin' }}</span>
<div class="avatar">{{ initials }}</div>
<el-button link type="primary" size="small" @click="logout">退出</el-button>
</div>
</header>
<router-view />
</main>
</div>
</template>
<style scoped>
.admin-shell {
display: grid;
grid-template-columns: 228px minmax(0, 1fr);
min-height: 100vh;
background: #f3f5f8;
}
.sidebar {
position: sticky;
top: 0;
align-self: start;
height: 100vh;
display: flex;
flex-direction: column;
padding: 22px 16px;
background: #fff;
border-right: 1px solid #e5e7eb;
overflow-y: auto;
}
.brand {
display: flex;
align-items: center;
gap: 10px;
padding: 0 6px 22px;
}
.brand-mark {
width: 34px;
height: 34px;
border-radius: 9px;
background: linear-gradient(135deg, #2563eb, #7c3aed);
color: #fff;
display: grid;
place-items: center;
font-weight: 700;
}
.brand-name {
font-size: 15px;
font-weight: 700;
}
.brand-sub {
font-size: 11px;
color: #9ca3af;
}
.nav {
border-right: 0;
}
.nav :deep(.el-menu-item) {
height: 40px;
line-height: 40px;
margin: 2px 0;
border-radius: 8px;
color: #4b5563;
font-size: 13.5px;
}
.nav :deep(.el-menu-item.is-active) {
background: #eef2ff;
color: #4338ca;
font-weight: 600;
}
.nav :deep(.el-menu-item:hover) {
background: #f5f7fa;
}
.side-foot {
margin-top: auto;
border-top: 1px solid #eef0f3;
padding-top: 14px;
font-size: 12px;
color: #9ca3af;
}
.main {
min-width: 0;
padding: 0 26px 60px;
}
.topbar {
height: 62px;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid #e5e7eb;
margin-bottom: 22px;
}
.crumb {
font-size: 13px;
color: #6b7280;
}
.crumb b {
color: #111827;
}
.top-actions {
display: flex;
align-items: center;
gap: 10px;
}
.avatar {
width: 32px;
height: 32px;
border-radius: 50%;
background: #e0e7ff;
color: #4338ca;
display: grid;
place-items: center;
font-size: 12px;
font-weight: 700;
}
.user-name {
font-size: 12.5px;
color: #4b5563;
}
</style>
+14
View File
@@ -0,0 +1,14 @@
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import 'element-plus/dist/index.css'
import App from './App.vue'
import router from './router'
import './styles/main.css'
createApp(App)
.use(createPinia())
.use(router)
.use(ElementPlus, { locale: zhCn })
.mount('#app')
+74
View File
@@ -0,0 +1,74 @@
import type {
CoverageItem,
ExamStat,
Kpi,
PosStat,
QualityItem,
TopBook
} from '@/api/types'
// 真实快照:MySQL word_market,2026-11-08。后端就绪后由 API 替换。
export const mockKpis: Kpi[] = [
{ key: 'books', label: '词书', value: 1025, note: '1 本无清单文件', tone: 'blue' },
{ key: 'entries', label: '词条', value: 38116, note: '38,000 个索引词', tone: 'green' },
{ key: 'links', label: '词书词条关联', value: 1228421, note: '平均每本 1,200 条', tone: 'violet' },
{ key: 'sentences', label: '例句', value: 235744, note: '含使用模式 71,964', tone: 'amber' },
{ key: 'families', label: '词族', value: 22717, note: '顶层族 5,629', tone: 'cyan' },
{ key: 'synonyms', label: '近义词头', value: 6279, note: '义项 8,383', tone: 'rose' }
]
export const mockExams: ExamStat[] = [
{ name: '考研', code: 'KY', books: 108, entries: 480091 },
{ name: '未归类', code: null, books: 509, entries: 258233 },
{ name: '高考', code: 'GK', books: 150, entries: 154292 },
{ name: '中考', code: 'ZK', books: 156, entries: 74439 },
{ name: '四级', code: 'CET4', books: 29, entries: 69362 },
{ name: '六级', code: 'CET6', books: 22, entries: 52863 },
{ name: '专升本', code: 'ZSB', books: 19, entries: 52681 },
{ name: '专四', code: 'PRO4', books: 7, entries: 25627 },
{ name: '雅思', code: 'IELTS', books: 11, entries: 25314 },
{ name: '专八', code: 'PRO8', books: 6, entries: 19954 },
{ name: '托福', code: 'TOEFL', books: 8, entries: 15565 }
]
export const mockTopBooks: TopBook[] = [
{ id: '15', name: 'SAT10000', code: 'SAT', exam: 'SAT', declared: 10001, actual: 10001, coverPath: '/dicts/v3/img_032516463440_24_opt.png' },
{ id: '1170', name: '2027恋练有词考研英语词汇', code: 'LLYC2027', exam: '考研', declared: 7969, actual: 7969, coverPath: '/dicts/v3/img_122613473672_1017_opt.png' },
{ id: '557', name: '2024恋练有词考研英语词汇', code: 'LLYCKY2024', exam: '考研', declared: 7949, actual: 7949, coverPath: '/dicts/v3/img_032615238520_111_opt.png' },
{ id: '740', name: '2026恋练有词考研英语词汇', code: 'LLYCKY2026', exam: '考研', declared: 7941, actual: 7941, coverPath: '/dicts/v3/img_122414371550_51_opt.png' },
{ id: '630', name: '2025恋练有词考研英语词汇', code: 'LLYCKY2025', exam: '考研', declared: 7940, actual: 7940, coverPath: '/dicts/v3/img_032615097259_51_opt.png' },
{ id: '331', name: '2023恋练有词考研英语词汇', code: 'LLYCKY2023', exam: '考研', declared: 7919, actual: 7919, coverPath: '/dicts/v3/img_032617141081_126_opt.png' },
{ id: '508', name: '2023恋练有词考研英语词汇', code: 'LLYCK2023N', exam: '考研', declared: 7919, actual: 7919, coverPath: '/dicts/v3/img_042716404904_126_opt.png' },
{ id: '841', name: '英语六级 你还在背单词吗(新版)', code: 'HZBCET6N', exam: '六级', declared: 7799, actual: 7799, coverPath: '/dicts/v3/img_081109464902_93_opt.png' },
{ id: '519', name: '全国英语等级考试第五级', code: 'PETS5', exam: '未归类', declared: 7527, actual: 7527, coverPath: '/dicts/v3/img_032516041386_40_opt.png' },
{ id: '819', name: '考研词汇 词根联想记忆法 乱序版', code: 'KYLX2026', exam: '考研', declared: 7349, actual: 7349, coverPath: '/dicts/v3/img_071615349355_34_opt.png' }
]
export const mockPos: PosStat[] = [
{ name: 'n.', value: 21313 },
{ name: 'adj.', value: 9782 },
{ name: 'phr.', value: 6922 },
{ name: 'vt.', value: 5331 },
{ name: 'adv.', value: 1996 },
{ name: 'vi.', value: 1800 },
{ name: 'phrv.', value: 1758 },
{ name: 'idm.', value: 1595 },
{ name: 'vi. vt.', value: 971 },
{ name: 'vt. vi.', value: 896 }
]
export const mockQuality: QualityItem[] = [
{ key: 'mismatch', label: '声明与实际词条数不一致', value: 18, unit: '本', level: 'warn', target: '词书' },
{ key: 'nofile', label: '缺失词书清单文件', value: 1, unit: '本', level: 'bad', target: '词书' },
{ key: 'nozpk', label: '缺失 zpk 引用', value: 1, unit: '个', level: 'bad', target: '词条' },
{ key: 'nosense', label: '无结构化义项的词条', value: 5250, unit: '条', level: 'warn', target: '词条' },
{ key: 'nosyn', label: '无义项的近义词头', value: 19, unit: '个', level: 'warn', target: '近义词' },
{ key: 'noexam', label: '未设置考试的词书', value: 509, unit: '本', level: 'info', target: '词书' },
{ key: 'nocover', label: '无封面词书', value: 27, unit: '本', level: 'info', target: '词书' }
]
export const mockCoverage: CoverageItem[] = [
{ name: '单词卡片', hit: 11662, total: 11998, pct: 97.2 },
{ name: '词族', hit: 17587, total: 22710, pct: 77.4 },
{ name: '近义词头', hit: 6231, total: 6279, pct: 99.2 }
]
+91
View File
@@ -0,0 +1,91 @@
import { createRouter, createWebHistory } from 'vue-router'
import AdminLayout from '@/layouts/AdminLayout.vue'
import { TOKEN_KEY } from '@/utils/storage'
const router = createRouter({
history: createWebHistory(),
routes: [
{
path: '/login',
name: 'login',
component: () => import('@/views/LoginView.vue'),
meta: { title: '登录', public: true }
},
{
path: '/',
component: AdminLayout,
children: [
{
path: '',
name: 'overview',
component: () => import('@/views/OverviewView.vue'),
meta: { title: '概览' }
},
{
path: 'books',
name: 'books',
component: () => import('@/views/BooksView.vue'),
meta: { title: '词书管理' }
},
{
path: 'books/:id',
name: 'book-detail',
component: () => import('@/views/BookDetailView.vue'),
meta: { title: '词书详情' }
},
{
path: 'entries',
name: 'entries',
component: () => import('@/views/EntriesView.vue'),
meta: { title: '词条词典' }
},
{
path: 'morphology',
name: 'morphology',
component: () => import('@/views/MorphologyView.vue'),
meta: { title: '词根词族' }
},
{
path: 'synonyms',
name: 'synonyms',
component: () => import('@/views/SynonymsView.vue'),
meta: { title: '近反义词' }
},
{
path: 'synonyms/:id',
name: 'synonym-detail',
component: () => import('@/views/SynonymDetailView.vue'),
meta: { title: '近义词详情' }
},
{
path: 'quality',
name: 'quality',
component: () => import('@/views/QualityView.vue'),
meta: { title: '数据质量' }
}
]
},
{ path: '/:pathMatch(.*)*', redirect: '/' }
]
})
router.beforeEach((to) => {
const token = localStorage.getItem(TOKEN_KEY)
if (to.meta.public) {
if (token && to.name === 'login') {
return { name: 'overview' }
}
return true
}
if (!token) {
return { name: 'login', query: { redirect: to.fullPath } }
}
return true
})
router.afterEach((to) => {
const title = String(to.meta.title ?? '')
document.title = title ? `${title} · Word Market` : 'Word Market · 词库管理后台'
})
export default router
+31
View File
@@ -0,0 +1,31 @@
import { computed, ref } from 'vue'
import { defineStore } from 'pinia'
import { login as loginApi } from '@/api/auth'
import { clearAuthStorage, EXPIRES_KEY, TOKEN_KEY, USER_KEY } from '@/utils/storage'
export const useAuthStore = defineStore('auth', () => {
const token = ref(localStorage.getItem(TOKEN_KEY) ?? '')
const username = ref(localStorage.getItem(USER_KEY) ?? '')
const expiresAt = ref(localStorage.getItem(EXPIRES_KEY) ?? '')
const isAuthenticated = computed(() => Boolean(token.value))
async function login(user: string, password: string): Promise<void> {
const result = await loginApi(user, password)
token.value = result.token
username.value = result.username
expiresAt.value = result.expiresAt
localStorage.setItem(TOKEN_KEY, result.token)
localStorage.setItem(USER_KEY, result.username)
localStorage.setItem(EXPIRES_KEY, result.expiresAt)
}
function logout(): void {
token.value = ''
username.value = ''
expiresAt.value = ''
clearAuthStorage()
}
return { token, username, expiresAt, isAuthenticated, login, logout }
})
+28
View File
@@ -0,0 +1,28 @@
*,
*::before,
*::after {
box-sizing: border-box;
}
html,
body,
#app {
margin: 0;
min-height: 100%;
}
body {
font-family: 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', system-ui, sans-serif;
color: #1f2937;
background: #f3f5f8;
-webkit-font-smoothing: antialiased;
}
a {
color: inherit;
text-decoration: none;
}
img {
display: block;
}
+16
View File
@@ -0,0 +1,16 @@
const COVER_BASE = import.meta.env.VITE_COVER_BASE_URL || 'https://static.beingfine.cn'
export const PLACEHOLDER_COVER =
'data:image/svg+xml;utf8,' +
encodeURIComponent(
'<svg xmlns="http://www.w3.org/2000/svg" width="60" height="80"><rect width="60" height="80" fill="#e5e7eb"/><text x="30" y="44" font-size="10" fill="#9ca3af" text-anchor="middle">N/A</text></svg>'
)
export function coverUrl(path: string | null): string {
return path ? `${COVER_BASE}${path}` : PLACEHOLDER_COVER
}
export function onCoverError(event: Event): void {
const img = event.target as HTMLImageElement
if (img.src !== PLACEHOLDER_COVER) img.src = PLACEHOLDER_COVER
}
+9
View File
@@ -0,0 +1,9 @@
export const TOKEN_KEY = 'word-market-token'
export const USER_KEY = 'word-market-user'
export const EXPIRES_KEY = 'word-market-expires'
export function clearAuthStorage(): void {
localStorage.removeItem(TOKEN_KEY)
localStorage.removeItem(USER_KEY)
localStorage.removeItem(EXPIRES_KEY)
}
+4
View File
@@ -0,0 +1,4 @@
export function plainText(value: string | null | undefined): string {
if (!value) return ''
return value.replace(/<[^>]*>/g, '')
}
+323
View File
@@ -0,0 +1,323 @@
<script setup lang="ts">
import { onMounted, reactive, ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import DataTable from '@/components/DataTable.vue'
import CoverImage from '@/components/CoverImage.vue'
import { getBook, getBookEntries } from '@/api/books'
import type { BookDetail, BookEntryItem } from '@/api/types'
const route = useRoute()
const router = useRouter()
const bookId = String(route.params.id)
const book = ref<BookDetail | null>(null)
const bookLoading = ref(true)
const bookError = ref('')
const entries = ref<BookEntryItem[]>([])
const total = ref(0)
const loading = ref(false)
const error = ref('')
const query = reactive({ page: 1, size: 20, keyword: '' })
async function loadBook(): Promise<void> {
bookLoading.value = true
bookError.value = ''
try {
book.value = await getBook(bookId)
} catch (err) {
bookError.value = err instanceof Error ? err.message : '词书加载失败'
book.value = null
} finally {
bookLoading.value = false
}
}
async function loadEntries(): Promise<void> {
loading.value = true
error.value = ''
try {
const result = await getBookEntries(bookId, {
page: query.page,
size: query.size,
keyword: query.keyword.trim() || undefined
})
entries.value = result.items
total.value = result.total
} catch (err) {
error.value = err instanceof Error ? err.message : '词条清单加载失败'
entries.value = []
total.value = 0
} finally {
loading.value = false
}
}
function search(): void {
query.page = 1
void loadEntries()
}
function openEntry(row: unknown): void {
const entry = row as BookEntryItem
void router.push({ path: '/entries', query: { id: entry.entryId } })
}
onMounted(() => {
void loadBook()
void loadEntries()
})
</script>
<template>
<div class="book-detail">
<div class="page-heading">
<div class="heading-left">
<el-button link type="primary" @click="router.push('/books')">← 返回词书列表</el-button>
<h1>{{ book?.name ?? '词书详情' }}</h1>
</div>
<div v-if="book" class="heading-meta">{{ book.code }}</div>
</div>
<el-alert
v-if="bookError"
:title="bookError"
type="error"
show-icon
:closable="false"
class="block-gap"
/>
<template v-else>
<section v-loading="bookLoading" class="panel info-panel">
<div v-if="book" class="info-grid">
<CoverImage :path="book.coverPath" :width="120" :height="160" :radius="8" />
<div class="info-main">
<div class="title-row">
<h2>{{ book.name }}</h2>
<el-tag v-if="book.examName" size="small">{{ book.examName }}</el-tag>
<el-tag v-else size="small" type="info">未归类</el-tag>
<el-tag v-if="!book.hasFile" size="small" type="danger">缺少清单文件</el-tag>
</div>
<p class="description">{{ book.description || '暂无描述' }}</p>
<div class="facts">
<div class="fact">
<span class="fact-label">业务编码</span>
<span class="fact-value">{{ book.code }}</span>
</div>
<div class="fact">
<span class="fact-label">声明词条</span>
<span class="fact-value">{{ (book.declared ?? 0).toLocaleString('en-US') }}</span>
</div>
<div class="fact">
<span class="fact-label">实际词条</span>
<span class="fact-value">{{ book.actual.toLocaleString('en-US') }}</span>
</div>
<div class="fact">
<span class="fact-label">规模一致性</span>
<el-tag :type="book.mismatch ? 'warning' : 'success'" size="small">
{{ book.mismatch ? `差 ${book.actual - (book.declared ?? 0)}` : '一致' }}
</el-tag>
</div>
<div class="fact">
<span class="fact-label">内容版本</span>
<span class="fact-value">{{ book.contentVersion ?? '—' }}</span>
</div>
<div class="fact">
<span class="fact-label">目录版本</span>
<span class="fact-value">{{ book.schemaVersion ?? '—' }}</span>
</div>
</div>
</div>
</div>
<el-empty v-else-if="!bookLoading" description="词书不存在" />
</section>
<section class="panel entries-panel">
<header class="panel-head">
<div>
<div class="panel-title">词条清单</div>
<div class="panel-sub">按词书内顺序(seq_book)排列</div>
</div>
<div class="entry-search">
<el-input
v-model="query.keyword"
placeholder="按展示词搜索"
clearable
style="width: 220px"
@keyup.enter="search"
/>
<el-button type="primary" @click="search">查询</el-button>
</div>
</header>
<DataTable
:data="entries"
:loading="loading"
:error="error"
:total="total"
:page="query.page"
:size="query.size"
empty-text="该词书没有词条"
@update:page="(value: number) => { query.page = value; loadEntries() }"
@update:size="(value: number) => { query.size = value; query.page = 1; loadEntries() }"
@row-click="openEntry"
>
<el-table-column label="展示词" min-width="220">
<template #default="{ row }">
<span class="word">{{ row.displayWord }}</span>
</template>
</el-table-column>
<el-table-column label="主词" width="180">
<template #default="{ row }">
<span class="muted">{{ row.headwordText || row.headword || '—' }}</span>
</template>
</el-table-column>
<el-table-column label="顺序" width="90" align="right">
<template #default="{ row }">{{ row.seqBook ?? '—' }}</template>
</el-table-column>
<el-table-column label="字母序" width="90" align="right">
<template #default="{ row }">{{ row.seqAz ?? '—' }}</template>
</el-table-column>
<el-table-column label="词频" width="90" align="right">
<template #default="{ row }">{{ row.seqFreq || '—' }}</template>
</el-table-column>
</DataTable>
</section>
</template>
</div>
</template>
<style scoped>
.page-heading {
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 16px;
margin-bottom: 18px;
}
.heading-left {
display: flex;
flex-direction: column;
gap: 4px;
}
.page-heading h1 {
margin: 0;
font-size: 22px;
letter-spacing: -0.01em;
}
.heading-meta {
font-size: 12px;
color: #9ca3af;
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.panel {
background: #fff;
border: 1px solid #e8ebf0;
border-radius: 10px;
padding: 18px;
}
.block-gap {
margin-bottom: 16px;
}
.info-panel {
margin-bottom: 16px;
}
.info-grid {
display: flex;
gap: 22px;
}
.info-main {
flex: 1;
min-width: 0;
}
.title-row {
display: flex;
align-items: center;
gap: 10px;
flex-wrap: wrap;
}
.title-row h2 {
margin: 0;
font-size: 20px;
}
.description {
margin: 10px 0 16px;
color: #6b7280;
font-size: 13px;
line-height: 1.7;
}
.facts {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 12px 20px;
max-width: 760px;
}
.fact {
display: flex;
flex-direction: column;
gap: 3px;
}
.fact-label {
font-size: 11.5px;
color: #9ca3af;
}
.fact-value {
font-size: 13.5px;
font-weight: 600;
color: #374151;
font-variant-numeric: tabular-nums;
}
.entries-panel {
padding: 16px 18px;
}
.panel-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
margin-bottom: 14px;
flex-wrap: wrap;
}
.panel-title {
font-size: 14px;
font-weight: 600;
}
.panel-sub {
font-size: 11.5px;
color: #9ca3af;
margin-top: 3px;
}
.entry-search {
display: flex;
gap: 8px;
}
.word {
font-weight: 500;
}
.muted {
color: #9ca3af;
}
</style>
+242
View File
@@ -0,0 +1,242 @@
<script setup lang="ts">
import { onMounted, reactive, ref } from 'vue'
import { useRouter } from 'vue-router'
import DataTable from '@/components/DataTable.vue'
import CoverImage from '@/components/CoverImage.vue'
import { getBooks, getExams } from '@/api/books'
import type { BookListItem, ExamOption } from '@/api/types'
const router = useRouter()
const exams = ref<ExamOption[]>([])
const rows = ref<BookListItem[]>([])
const total = ref(0)
const loading = ref(false)
const error = ref('')
const query = reactive({
page: 1,
size: 20,
examId: '',
keyword: '',
hasFile: '' as '' | 'true' | 'false'
})
async function load(): Promise<void> {
loading.value = true
error.value = ''
try {
const result = await getBooks({
page: query.page,
size: query.size,
examId: query.examId || null,
keyword: query.keyword.trim() || undefined,
hasFile: query.hasFile === '' ? null : query.hasFile === 'true'
})
rows.value = result.items
total.value = result.total
} catch (err) {
error.value = err instanceof Error ? err.message : '词书加载失败'
rows.value = []
total.value = 0
} finally {
loading.value = false
}
}
function search(): void {
query.page = 1
void load()
}
function reset(): void {
query.examId = ''
query.keyword = ''
query.hasFile = ''
query.page = 1
void load()
}
function openBook(row: unknown): void {
const book = row as BookListItem
void router.push(`/books/${book.id}`)
}
onMounted(async () => {
void load()
try {
exams.value = await getExams()
} catch {
exams.value = []
}
})
</script>
<template>
<div class="books">
<div class="page-heading">
<div>
<h1>词书管理</h1>
<p>浏览词书目录、考试归属与词条规模</p>
</div>
<div class="heading-meta">共 {{ total.toLocaleString('en-US') }} 本</div>
</div>
<section class="panel">
<div class="filters">
<el-select v-model="query.examId" placeholder="全部考试" clearable class="filter">
<el-option v-for="exam in exams" :key="exam.id" :label="exam.name" :value="exam.id" />
</el-select>
<el-input
v-model="query.keyword"
placeholder="词书名称或编码"
clearable
class="filter keyword"
@keyup.enter="search"
/>
<el-select v-model="query.hasFile" placeholder="文件状态" clearable class="filter">
<el-option label="有清单文件" value="true" />
<el-option label="无清单文件" value="false" />
</el-select>
<el-button type="primary" @click="search">查询</el-button>
<el-button @click="reset">重置</el-button>
</div>
<DataTable
:data="rows"
:loading="loading"
:error="error"
:total="total"
:page="query.page"
:size="query.size"
empty-text="没有匹配的词书"
@update:page="(value: number) => { query.page = value; load() }"
@update:size="(value: number) => { query.size = value; query.page = 1; load() }"
@row-click="openBook"
>
<el-table-column label="词书" min-width="260">
<template #default="{ row }">
<div class="book-cell">
<CoverImage :path="row.coverPath" :width="30" :height="40" />
<div class="book-meta">
<div class="book-name">{{ row.name }}</div>
<div class="book-code">{{ row.code }}</div>
</div>
</div>
</template>
</el-table-column>
<el-table-column label="考试" width="100">
<template #default="{ row }">
<span v-if="row.examName">{{ row.examName }}</span>
<el-tag v-else size="small" type="info">未归类</el-tag>
</template>
</el-table-column>
<el-table-column label="声明" width="100" align="right">
<template #default="{ row }">{{ (row.declared ?? 0).toLocaleString('en-US') }}</template>
</el-table-column>
<el-table-column label="实际" width="100" align="right">
<template #default="{ row }">{{ row.actual.toLocaleString('en-US') }}</template>
</el-table-column>
<el-table-column label="差异" width="90" align="right">
<template #default="{ row }">
<span v-if="row.declared === null" class="muted">—</span>
<span v-else-if="row.declared === row.actual" class="ok">一致</span>
<span v-else class="warn-text">{{ row.actual - row.declared }}</span>
</template>
</el-table-column>
<el-table-column label="文件" width="100">
<template #default="{ row }">
<el-tag v-if="row.hasFile" size="small" type="success">有文件</el-tag>
<el-tag v-else size="small" type="danger">缺失</el-tag>
</template>
</el-table-column>
</DataTable>
</section>
</div>
</template>
<style scoped>
.page-heading {
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 16px;
margin-bottom: 18px;
}
.page-heading h1 {
margin: 0 0 4px;
font-size: 22px;
letter-spacing: -0.01em;
}
.page-heading p {
margin: 0;
font-size: 13px;
color: #6b7280;
}
.heading-meta {
font-size: 11.5px;
color: #9ca3af;
}
.panel {
background: #fff;
border: 1px solid #e8ebf0;
border-radius: 10px;
padding: 16px 18px;
}
.filters {
display: flex;
gap: 10px;
align-items: center;
flex-wrap: wrap;
margin-bottom: 16px;
}
.filter {
width: 150px;
}
.keyword {
width: 230px;
}
.book-cell {
display: flex;
align-items: center;
gap: 10px;
}
.book-meta {
min-width: 0;
}
.book-name {
font-weight: 500;
max-width: 330px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.book-code {
font-size: 11px;
color: #9ca3af;
}
.muted {
color: #9ca3af;
}
.ok {
color: #16a34a;
font-size: 12px;
}
.warn-text {
color: #d97706;
font-size: 12px;
}
</style>
+813
View File
@@ -0,0 +1,813 @@
<script setup lang="ts">
import { onMounted, reactive, ref, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import DataTable from '@/components/DataTable.vue'
import {
getEntries,
getEntry,
getEntryBooks,
getEntryConfusables,
getEntryExamples,
getEntryPhrases,
getEntrySenses,
getEntryVariants
} from '@/api/entries'
import type {
ConfusableItem,
EntryBookItem,
EntryDetail,
EntryListItem,
ExampleGroupItem,
PhraseItem,
SenseItem,
SpellingVariantItem
} from '@/api/types'
import { plainText } from '@/utils/text'
const route = useRoute()
const router = useRouter()
const rows = ref<EntryListItem[]>([])
const total = ref(0)
const loading = ref(false)
const error = ref('')
const query = reactive({ page: 1, size: 20, keyword: '' })
const drawerOpen = ref(false)
const currentId = ref('')
const activeTab = ref('basic')
const entry = ref<EntryDetail | null>(null)
const detailLoading = ref(false)
const detailError = ref('')
const senses = ref<SenseItem[]>([])
const sensesLoading = ref(false)
const sensesLoaded = ref(false)
const sensesError = ref('')
const variants = ref<SpellingVariantItem[]>([])
const confusables = ref<ConfusableItem[]>([])
const basicExtraLoading = ref(false)
const phrases = reactive({
items: [] as PhraseItem[],
total: 0,
page: 1,
size: 10,
loading: false,
loaded: false,
error: ''
})
const examples = reactive({
items: [] as ExampleGroupItem[],
total: 0,
page: 1,
size: 5,
loading: false,
loaded: false,
error: ''
})
const books = reactive({
items: [] as EntryBookItem[],
total: 0,
page: 1,
size: 10,
loading: false,
loaded: false,
error: ''
})
const GROUP_KINDS: Record<number, string> = {
1: '核心释义',
2: '扩展释义',
3: '短语动词',
4: '习语',
99: '听力语料'
}
const RELATION_LABELS: Record<string, string> = {
synonym: '近义',
antonym: '反义',
reference: '参见'
}
async function load(): Promise<void> {
loading.value = true
error.value = ''
try {
const result = await getEntries({
page: query.page,
size: query.size,
keyword: query.keyword.trim() || undefined
})
rows.value = result.items
total.value = result.total
} catch (err) {
error.value = err instanceof Error ? err.message : '词条加载失败'
rows.value = []
total.value = 0
} finally {
loading.value = false
}
}
function search(): void {
query.page = 1
void load()
}
function resetDetailState(): void {
entry.value = null
detailError.value = ''
senses.value = []
sensesLoaded.value = false
sensesError.value = ''
variants.value = []
confusables.value = []
Object.assign(phrases, { items: [], total: 0, page: 1, loaded: false, error: '' })
Object.assign(examples, { items: [], total: 0, page: 1, loaded: false, error: '' })
Object.assign(books, { items: [], total: 0, page: 1, loaded: false, error: '' })
}
async function openById(id: string): Promise<void> {
if (!id) return
if (currentId.value === id && drawerOpen.value) return
currentId.value = id
drawerOpen.value = true
activeTab.value = 'basic'
resetDetailState()
await Promise.all([loadDetail(), loadBasicExtras()])
void loadTab('basic')
}
async function loadDetail(): Promise<void> {
detailLoading.value = true
try {
entry.value = await getEntry(currentId.value)
} catch (err) {
detailError.value = err instanceof Error ? err.message : '词条详情加载失败'
} finally {
detailLoading.value = false
}
}
async function loadBasicExtras(): Promise<void> {
basicExtraLoading.value = true
try {
const [variantRows, confusableRows] = await Promise.all([
getEntryVariants(currentId.value),
getEntryConfusables(currentId.value)
])
variants.value = variantRows
confusables.value = confusableRows
} catch {
variants.value = []
confusables.value = []
} finally {
basicExtraLoading.value = false
}
}
async function loadSenses(): Promise<void> {
if (sensesLoaded.value || sensesLoading.value) return
sensesLoading.value = true
sensesError.value = ''
try {
senses.value = await getEntrySenses(currentId.value)
sensesLoaded.value = true
} catch (err) {
sensesError.value = err instanceof Error ? err.message : '义项加载失败'
} finally {
sensesLoading.value = false
}
}
async function loadPhrases(): Promise<void> {
if (phrases.loading) return
phrases.loading = true
phrases.error = ''
try {
const result = await getEntryPhrases(currentId.value, phrases.page, phrases.size)
phrases.items = result.items
phrases.total = result.total
phrases.loaded = true
} catch (err) {
phrases.error = err instanceof Error ? err.message : '短语加载失败'
} finally {
phrases.loading = false
}
}
async function loadExamples(): Promise<void> {
if (examples.loading) return
examples.loading = true
examples.error = ''
try {
const result = await getEntryExamples(currentId.value, examples.page, examples.size)
examples.items = result.items
examples.total = result.total
examples.loaded = true
} catch (err) {
examples.error = err instanceof Error ? err.message : '例句加载失败'
} finally {
examples.loading = false
}
}
async function loadBooks(): Promise<void> {
if (books.loading) return
books.loading = true
books.error = ''
try {
const result = await getEntryBooks(currentId.value, books.page, books.size)
books.items = result.items
books.total = result.total
books.loaded = true
} catch (err) {
books.error = err instanceof Error ? err.message : '收录词书加载失败'
} finally {
books.loading = false
}
}
function loadTab(name: string): void {
if (name === 'senses') void loadSenses()
if (name === 'phrases' && !phrases.loaded) void loadPhrases()
if (name === 'examples' && !examples.loaded) void loadExamples()
if (name === 'books' && !books.loaded) void loadBooks()
}
watch(activeTab, (value) => loadTab(value))
function openEntry(row: unknown): void {
const item = row as EntryListItem
void router.replace({ path: '/entries', query: { ...route.query, id: item.id } })
}
function closeDrawer(): void {
drawerOpen.value = false
if (route.query.id) {
const query = { ...route.query }
delete query.id
void router.replace({ path: '/entries', query })
}
}
function openBook(bookId: string): void {
void router.push(`/books/${bookId}`)
}
watch(
() => route.query.id,
(value) => {
if (typeof value === 'string' && value) {
void openById(value)
} else {
drawerOpen.value = false
}
},
{ immediate: true }
)
onMounted(() => {
void load()
})
</script>
<template>
<div class="entries">
<div class="page-heading">
<div>
<h1>词条词典</h1>
<p>搜索词条并查看释义、短语、例句、易混词与收录词书</p>
</div>
<div class="heading-meta">按词条 ID 稳定排序</div>
</div>
<section class="panel">
<div class="filters">
<el-input
v-model="query.keyword"
placeholder="原形或索引词"
clearable
class="keyword"
@keyup.enter="search"
/>
<el-button type="primary" @click="search">搜索</el-button>
</div>
<DataTable
:data="rows"
:loading="loading"
:error="error"
:total="total"
:page="query.page"
:size="query.size"
empty-text="没有匹配的词条"
@update:page="(value: number) => { query.page = value; load() }"
@update:size="(value: number) => { query.size = value; query.page = 1; load() }"
@row-click="openEntry"
>
<el-table-column label="原形" min-width="180">
<template #default="{ row }">
<span class="headword">{{ row.headword }}</span>
<span class="index-word">{{ row.indexWord }}</span>
</template>
</el-table-column>
<el-table-column label="音标" width="140">
<template #default="{ row }">
<span class="pron">{{ row.pronunciation || '—' }}</span>
</template>
</el-table-column>
<el-table-column label="释义摘要" min-width="320">
<template #default="{ row }">
<span class="definition">{{ row.definition || '—' }}</span>
</template>
</el-table-column>
<el-table-column label="义项" width="80" align="right">
<template #default="{ row }">{{ row.senseCount }}</template>
</el-table-column>
<el-table-column label="收录词书" width="100" align="right">
<template #default="{ row }">{{ row.bookCount }}</template>
</el-table-column>
</DataTable>
</section>
<el-drawer
v-model="drawerOpen"
direction="rtl"
size="min(760px, 92vw)"
:modal="false"
:lock-scroll="false"
:close-on-click-modal="false"
append-to-body
@close="closeDrawer"
>
<template #header>
<div class="drawer-title">
<b>{{ entry?.headword ?? '词条详情' }}</b>
<span v-if="entry" class="drawer-sub">{{ entry.indexWord }} · ID {{ entry.id }}</span>
</div>
</template>
<div v-loading="detailLoading" class="drawer-body">
<el-alert
v-if="detailError"
:title="detailError"
type="error"
show-icon
:closable="false"
/>
<template v-else-if="entry">
<el-tabs v-model="activeTab" class="tabs">
<el-tab-pane label="基本信息" name="basic">
<dl class="facts">
<div><dt>原形</dt><dd>{{ entry.headword }}</dd></div>
<div><dt>索引词</dt><dd>{{ entry.indexWord }}</dd></div>
<div><dt>美式音标</dt><dd>{{ entry.usPronunciation || '—' }}</dd></div>
<div><dt>英式音标</dt><dd>{{ entry.ukPronunciation || '—' }}</dd></div>
<div><dt>数据版本</dt><dd>{{ entry.dataVersion || '—' }}</dd></div>
<div><dt>所属考试</dt><dd>{{ entry.bookExamName || '—' }}</dd></div>
<div><dt>声明收录数</dt><dd>{{ entry.occurrenceCount ?? '—' }}</dd></div>
<div><dt>听力语料</dt><dd>{{ entry.hasListeningExamples ? '有' : '无' }}</dd></div>
</dl>
<div class="block">
<div class="block-title">原始释义</div>
<p class="definition-text">{{ entry.definitionText || '—' }}</p>
</div>
<div class="block">
<div class="block-title">拼写变体</div>
<div v-if="basicExtraLoading" class="muted">加载中…</div>
<div v-else-if="variants.length === 0" class="muted">无拼写变体</div>
<div v-else class="tag-row">
<el-tag v-for="variant in variants" :key="variant.position ?? variant.variant" size="small">
{{ variant.variant }}
</el-tag>
</div>
</div>
<div class="block">
<div class="block-title">易混词</div>
<div v-if="basicExtraLoading" class="muted">加载中…</div>
<el-empty v-else-if="confusables.length === 0" description="无易混词" :image-size="54" />
<el-table v-else :data="confusables" size="small" max-height="300">
<el-table-column prop="wordText" label="单词" width="140" />
<el-table-column prop="glossZh" label="辨析" />
</el-table>
</div>
</el-tab-pane>
<el-tab-pane label="义项" name="senses">
<div v-if="sensesLoading" class="muted">加载中…</div>
<el-alert v-else-if="sensesError" :title="sensesError" type="error" :closable="false" />
<el-empty v-else-if="senses.length === 0" description="该词条没有结构化义项,请查看原始释义" />
<div v-else class="sense-list">
<div v-for="sense in senses" :key="sense.senseId" class="sense-item">
<div class="sense-head">
<el-tag size="small" type="info">#{{ sense.senseNo ?? '—' }}</el-tag>
<el-tag v-if="sense.partOfSpeech" size="small">{{ sense.partOfSpeech }}</el-tag>
<span class="sense-gloss">{{ sense.glossZh || '—' }}</span>
</div>
<div class="tag-row" v-if="sense.exams.length">
<el-tag v-for="exam in sense.exams" :key="exam.id" size="small" effect="plain">
{{ exam.name }}
</el-tag>
</div>
<div class="tag-row" v-if="sense.relations.length">
<el-tag
v-for="relation in sense.relations"
:key="`${relation.type}-${relation.position}-${relation.targetMeaningId}`"
size="small"
type="warning"
effect="plain"
>
{{ RELATION_LABELS[relation.type] ?? relation.type }} → 义项对象 {{ relation.targetMeaningId }}
</el-tag>
</div>
</div>
</div>
</el-tab-pane>
<el-tab-pane label="短语" name="phrases">
<div v-if="phrases.loading" class="muted">加载中…</div>
<el-alert v-else-if="phrases.error" :title="phrases.error" type="error" :closable="false" />
<el-empty v-else-if="phrases.items.length === 0" description="该词条没有短语" />
<template v-else>
<el-table :data="phrases.items" size="small">
<el-table-column label="短语" min-width="220">
<template #default="{ row }">
<div class="phrase-en">{{ plainText(row.textEn) }}</div>
<div class="phrase-zh">{{ row.textZh || '—' }}</div>
</template>
</el-table-column>
<el-table-column label="组类型" width="80">
<template #default="{ row }">类型 {{ row.groupType }}</template>
</el-table-column>
<el-table-column label="考试" min-width="150">
<template #default="{ row }">
<el-tag v-for="exam in row.exams" :key="exam.id" size="small" effect="plain">
{{ exam.name }}
</el-tag>
<span v-if="row.exams.length === 0" class="muted">—</span>
</template>
</el-table-column>
<el-table-column label="顺序" min-width="150">
<template #default="{ row }">
<span v-for="order in row.orders" :key="`${order.examId}-${order.groupType}-${order.position}`" class="order">
{{ order.examName }}: {{ order.position }}
</span>
<span v-if="row.orders.length === 0" class="muted">—</span>
</template>
</el-table-column>
</el-table>
<el-pagination
class="drawer-pager"
background
layout="prev, pager, next"
:total="phrases.total"
:current-page="phrases.page"
:page-size="phrases.size"
@current-change="(value: number) => { phrases.page = value; loadPhrases() }"
/>
</template>
</el-tab-pane>
<el-tab-pane label="例句" name="examples">
<div v-if="examples.loading" class="muted">加载中…</div>
<el-alert v-else-if="examples.error" :title="examples.error" type="error" :closable="false" />
<el-empty v-else-if="examples.items.length === 0" description="该词条没有例句" />
<template v-else>
<div v-for="group in examples.items" :key="group.id" class="example-group">
<div class="example-head">
<el-tag size="small" type="info">
{{ GROUP_KINDS[group.groupKind] ?? `类型 ${group.groupKind}` }}
</el-tag>
<el-tag v-if="group.partOfSpeech" size="small">{{ group.partOfSpeech }}</el-tag>
<span class="example-def">{{ group.definitionZh || group.definitionEn || '—' }}</span>
</div>
<div class="tag-row" v-if="group.exams.length">
<el-tag v-for="exam in group.exams" :key="exam.id" size="small" effect="plain">
{{ exam.name }}
</el-tag>
</div>
<div v-for="usage in group.usages" :key="usage.id" class="usage">
<div v-if="usage.patternText" class="usage-pattern">{{ plainText(usage.patternText) }}</div>
<div v-for="sentence in usage.sentences" :key="sentence.id" class="sentence">
<p class="sentence-en">{{ plainText(sentence.textEn) }}</p>
<p class="sentence-zh">{{ sentence.textZh || '—' }}</p>
<p v-if="sentence.sourceTitle" class="sentence-src">来源:{{ sentence.sourceTitle }}</p>
</div>
</div>
<div v-for="sentence in group.directSentences" :key="sentence.id" class="sentence">
<p class="sentence-en">{{ plainText(sentence.textEn) }}</p>
<p class="sentence-zh">{{ sentence.textZh || '—' }}</p>
<p v-if="sentence.sourceTitle" class="sentence-src">来源:{{ sentence.sourceTitle }}</p>
</div>
</div>
<el-pagination
class="drawer-pager"
background
layout="prev, pager, next"
:total="examples.total"
:current-page="examples.page"
:page-size="examples.size"
@current-change="(value: number) => { examples.page = value; loadExamples() }"
/>
</template>
</el-tab-pane>
<el-tab-pane label="收录词书" name="books">
<div v-if="books.loading" class="muted">加载中…</div>
<el-alert v-else-if="books.error" :title="books.error" type="error" :closable="false" />
<el-empty v-else-if="books.items.length === 0" description="未被任何词书收录" />
<template v-else>
<el-table :data="books.items" size="small" @row-click="(row: EntryBookItem) => openBook(row.bookId)">
<el-table-column label="词书" min-width="240">
<template #default="{ row }">
<span class="link-text">{{ row.bookName }}</span>
<span class="index-word">{{ row.bookCode }}</span>
</template>
</el-table-column>
<el-table-column label="词书内展示词" min-width="160">
<template #default="{ row }">{{ row.displayWord }}</template>
</el-table-column>
<el-table-column label="顺序" width="90" align="right">
<template #default="{ row }">{{ row.seqBook ?? '—' }}</template>
</el-table-column>
</el-table>
<el-pagination
class="drawer-pager"
background
layout="prev, pager, next"
:total="books.total"
:current-page="books.page"
:page-size="books.size"
@current-change="(value: number) => { books.page = value; loadBooks() }"
/>
</template>
</el-tab-pane>
</el-tabs>
</template>
</div>
</el-drawer>
</div>
</template>
<style scoped>
.page-heading {
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 16px;
margin-bottom: 18px;
}
.page-heading h1 {
margin: 0 0 4px;
font-size: 22px;
letter-spacing: -0.01em;
}
.page-heading p {
margin: 0;
font-size: 13px;
color: #6b7280;
}
.heading-meta {
font-size: 11.5px;
color: #9ca3af;
}
.panel {
background: #fff;
border: 1px solid #e8ebf0;
border-radius: 10px;
padding: 16px 18px;
}
.filters {
display: flex;
gap: 10px;
margin-bottom: 16px;
}
.keyword {
width: 280px;
}
.headword {
font-weight: 600;
margin-right: 8px;
}
.index-word {
font-size: 11px;
color: #9ca3af;
margin-left: 6px;
}
.pron {
color: #6b7280;
font-size: 12px;
}
.definition {
color: #4b5563;
font-size: 12.5px;
}
.drawer-title {
display: flex;
align-items: baseline;
gap: 10px;
}
.drawer-title b {
font-size: 17px;
}
.drawer-sub {
font-size: 11.5px;
color: #9ca3af;
}
.drawer-body {
min-height: 200px;
}
.tabs :deep(.el-tabs__item) {
font-size: 13px;
}
.facts {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 10px 18px;
margin: 0 0 18px;
}
.facts div {
display: flex;
justify-content: space-between;
gap: 10px;
border-bottom: 1px dashed #f1f3f6;
padding-bottom: 6px;
}
.facts dt {
font-size: 12px;
color: #9ca3af;
}
.facts dd {
margin: 0;
font-size: 12.5px;
font-weight: 500;
color: #374151;
text-align: right;
}
.block {
margin-bottom: 18px;
}
.block-title {
font-size: 12.5px;
font-weight: 600;
color: #374151;
margin-bottom: 8px;
}
.definition-text {
margin: 0;
font-size: 12.5px;
color: #4b5563;
line-height: 1.8;
white-space: pre-wrap;
}
.tag-row {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin: 6px 0;
}
.sense-list {
display: flex;
flex-direction: column;
gap: 12px;
}
.sense-item {
border: 1px solid #eef0f3;
border-radius: 8px;
padding: 12px;
}
.sense-head {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
}
.sense-gloss {
font-size: 13px;
color: #374151;
}
.phrase-en {
font-weight: 500;
}
.phrase-zh {
font-size: 11.5px;
color: #9ca3af;
}
.order {
display: inline-block;
margin-right: 8px;
font-size: 11px;
color: #6b7280;
font-variant-numeric: tabular-nums;
}
.example-group {
border: 1px solid #eef0f3;
border-radius: 8px;
padding: 12px;
margin-bottom: 12px;
}
.example-head {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
}
.example-def {
font-size: 12.5px;
color: #374151;
}
.usage {
margin-top: 10px;
padding-left: 10px;
border-left: 2px solid #eef2f7;
}
.usage-pattern {
font-size: 12px;
color: #6b7280;
margin-bottom: 4px;
}
.sentence {
margin: 8px 0;
}
.sentence-en {
margin: 0;
font-size: 12.5px;
color: #1f2937;
line-height: 1.6;
}
.sentence-zh {
margin: 2px 0 0;
font-size: 12px;
color: #6b7280;
}
.sentence-src {
margin: 2px 0 0;
font-size: 10.5px;
color: #9ca3af;
}
.muted {
color: #9ca3af;
font-size: 12px;
padding: 8px 0;
}
.drawer-pager {
margin-top: 14px;
justify-content: flex-end;
}
.link-text {
color: #2563eb;
font-weight: 500;
}
</style>
+143
View File
@@ -0,0 +1,143 @@
<script setup lang="ts">
import { reactive, ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { useAuthStore } from '@/stores/auth'
const route = useRoute()
const router = useRouter()
const auth = useAuthStore()
const form = reactive({ username: 'admin', password: '' })
const loading = ref(false)
const error = ref('')
async function submit(): Promise<void> {
if (!form.username.trim() || !form.password) {
error.value = '请输入用户名和密码'
return
}
loading.value = true
error.value = ''
try {
await auth.login(form.username.trim(), form.password)
const redirect = typeof route.query.redirect === 'string' ? route.query.redirect : '/'
await router.replace(redirect)
} catch (err) {
error.value = err instanceof Error ? err.message : '登录失败'
} finally {
loading.value = false
}
}
</script>
<template>
<div class="login-page">
<div class="login-card">
<div class="brand">
<div class="brand-mark">W</div>
<div>
<div class="brand-name">Word Market</div>
<div class="brand-sub">词库管理后台 · 只读模式</div>
</div>
</div>
<el-alert
v-if="error"
class="error"
:title="error"
type="error"
show-icon
:closable="false"
/>
<el-form label-position="top" @submit.prevent="submit">
<el-form-item label="用户名">
<el-input v-model="form.username" autocomplete="username" placeholder="管理员用户名" />
</el-form-item>
<el-form-item label="密码">
<el-input
v-model="form.password"
type="password"
show-password
autocomplete="current-password"
placeholder="管理员密码"
@keyup.enter="submit"
/>
</el-form-item>
<el-button class="submit" type="primary" :loading="loading" @click="submit">
登录
</el-button>
</el-form>
<p class="hint">凭据由后端环境变量配置,本后台不提供账号管理。</p>
</div>
</div>
</template>
<style scoped>
.login-page {
min-height: 100vh;
display: grid;
place-items: center;
background:
radial-gradient(circle at 15% 20%, #dbeafe, transparent 42%),
radial-gradient(circle at 85% 80%, #ede9fe, transparent 45%),
#f3f5f8;
padding: 24px;
}
.login-card {
width: 380px;
max-width: 100%;
background: #fff;
border: 1px solid #e8ebf0;
border-radius: 14px;
padding: 30px 30px 24px;
box-shadow: 0 18px 50px rgba(17, 24, 39, 0.08);
}
.brand {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 24px;
}
.brand-mark {
width: 40px;
height: 40px;
border-radius: 11px;
background: linear-gradient(135deg, #2563eb, #7c3aed);
color: #fff;
display: grid;
place-items: center;
font-weight: 700;
font-size: 18px;
}
.brand-name {
font-size: 17px;
font-weight: 700;
}
.brand-sub {
font-size: 12px;
color: #9ca3af;
}
.error {
margin-bottom: 16px;
}
.submit {
width: 100%;
margin-top: 4px;
}
.hint {
margin: 18px 0 0;
font-size: 11.5px;
color: #9ca3af;
line-height: 1.6;
}
</style>
+762
View File
@@ -0,0 +1,762 @@
<script setup lang="ts">
import { computed, onMounted, reactive, ref, watch } from 'vue'
import DataTable from '@/components/DataTable.vue'
import {
getCard,
getCards,
getFamilies,
getFamily,
getFamilyTree,
getMorpheme,
getMorphemes
} from '@/api/morphology'
import type {
CardDetail,
CardItem,
FamilyDetail,
FamilyItem,
MorphemeDetail,
MorphemeItem,
TreeNode
} from '@/api/types'
type TabName = 'morphemes' | 'cards' | 'families'
const activeTab = ref<TabName>('morphemes')
const TYPE_LABELS: Record<string, string> = { prefix: '前缀', root: '词根', suffix: '后缀' }
const TYPE_TAGS: Record<string, 'warning' | 'primary' | 'success'> = {
prefix: 'warning',
root: 'primary',
suffix: 'success'
}
/* ----- 词素 ----- */
const morphemes = ref<MorphemeItem[]>([])
const morphemeTotal = ref(0)
const morphemeLoading = ref(false)
const morphemeError = ref('')
const morphemeQuery = reactive({ page: 1, size: 20, type: '', keyword: '' })
const morphemeOpen = ref(false)
const morphemeDetail = ref<MorphemeDetail | null>(null)
const morphemeDetailLoading = ref(false)
const morphemeDetailError = ref('')
const morphemeDetailId = ref('')
/* ----- 卡片 ----- */
const cards = ref<CardItem[]>([])
const cardTotal = ref(0)
const cardLoading = ref(false)
const cardError = ref('')
const cardQuery = reactive({ page: 1, size: 20, keyword: '' })
const cardOpen = ref(false)
const cardDetail = ref<CardDetail | null>(null)
const cardDetailLoading = ref(false)
const cardDetailError = ref('')
const cardDetailId = ref('')
/* ----- 词族 ----- */
const families = ref<FamilyItem[]>([])
const familyTotal = ref(0)
const familyLoading = ref(false)
const familyError = ref('')
const familyQuery = reactive({ page: 1, size: 20, keyword: '' })
const familyOpen = ref(false)
const familyDetail = ref<FamilyDetail | null>(null)
const familyDetailLoading = ref(false)
const familyDetailError = ref('')
const familyDetailId = ref('')
const treeKey = ref(0)
async function loadMorphemes(): Promise<void> {
morphemeLoading.value = true
morphemeError.value = ''
try {
const result = await getMorphemes({
page: morphemeQuery.page,
size: morphemeQuery.size,
type: morphemeQuery.type || undefined,
keyword: morphemeQuery.keyword.trim() || undefined
})
morphemes.value = result.items
morphemeTotal.value = result.total
} catch (err) {
morphemeError.value = err instanceof Error ? err.message : '词素加载失败'
morphemes.value = []
morphemeTotal.value = 0
} finally {
morphemeLoading.value = false
}
}
async function loadCards(): Promise<void> {
cardLoading.value = true
cardError.value = ''
try {
const result = await getCards({
page: cardQuery.page,
size: cardQuery.size,
keyword: cardQuery.keyword.trim() || undefined
})
cards.value = result.items
cardTotal.value = result.total
} catch (err) {
cardError.value = err instanceof Error ? err.message : '卡片加载失败'
cards.value = []
cardTotal.value = 0
} finally {
cardLoading.value = false
}
}
async function loadFamilies(): Promise<void> {
familyLoading.value = true
familyError.value = ''
try {
const result = await getFamilies({
page: familyQuery.page,
size: familyQuery.size,
keyword: familyQuery.keyword.trim() || undefined
})
families.value = result.items
familyTotal.value = result.total
} catch (err) {
familyError.value = err instanceof Error ? err.message : '词族加载失败'
families.value = []
familyTotal.value = 0
} finally {
familyLoading.value = false
}
}
async function openMorpheme(row: unknown): Promise<void> {
const item = row as MorphemeItem
morphemeOpen.value = true
morphemeDetailId.value = item.id
morphemeDetail.value = null
morphemeDetailError.value = ''
morphemeDetailLoading.value = true
try {
morphemeDetail.value = await getMorpheme(item.id)
} catch (err) {
morphemeDetailError.value = err instanceof Error ? err.message : '词素详情加载失败'
} finally {
morphemeDetailLoading.value = false
}
}
async function openCard(row: unknown): Promise<void> {
const item = row as CardItem
cardOpen.value = true
cardDetailId.value = item.id
cardDetail.value = null
cardDetailError.value = ''
cardDetailLoading.value = true
try {
cardDetail.value = await getCard(item.id)
} catch (err) {
cardDetailError.value = err instanceof Error ? err.message : '卡片详情加载失败'
} finally {
cardDetailLoading.value = false
}
}
async function openFamily(row: unknown): Promise<void> {
const item = row as FamilyItem
familyOpen.value = true
familyDetailId.value = item.id
familyDetail.value = null
familyDetailError.value = ''
familyDetailLoading.value = true
treeKey.value += 1
try {
familyDetail.value = await getFamily(item.id)
} catch (err) {
familyDetailError.value = err instanceof Error ? err.message : '词族详情加载失败'
} finally {
familyDetailLoading.value = false
}
}
const rootNodes = computed<TreeNode[]>(() => {
if (!familyDetail.value) return []
return [
{
nodeType: 'top',
id: familyDetail.value.id,
label: familyDetail.value.word,
subtitle: '顶层词族 · 展开查看变体与小组',
memberCount: 0,
leaf: false
}
]
})
async function loadNode(
node: any,
resolve: (data: TreeNode[]) => void
): Promise<void> {
if (node.level === 0) {
resolve(rootNodes.value)
return
}
const data = node.data as TreeNode
if (!data || data.nodeType === 'member' || data.nodeType === 'info') {
resolve([])
return
}
try {
const size = data.nodeType === 'top' ? 100 : 50
const result = await getFamilyTree(data.id, data.nodeType, 1, size)
const nodes: TreeNode[] = result.nodes.map((item) => ({
...item,
leaf: item.leaf || item.nodeType === 'member'
}))
if (result.total > nodes.length) {
nodes.push({
nodeType: 'info',
id: `info-${data.id}`,
label: `仅显示前 ${nodes.length} 个,共 ${result.total} 个成员`,
subtitle: '',
memberCount: result.total,
leaf: true
})
}
resolve(nodes)
} catch {
resolve([
{
nodeType: 'info',
id: `error-${data.id}`,
label: '子节点加载失败',
subtitle: '',
memberCount: 0,
leaf: true
}
])
}
}
function searchMorphemes(): void {
morphemeQuery.page = 1
void loadMorphemes()
}
function searchCards(): void {
cardQuery.page = 1
void loadCards()
}
function searchFamilies(): void {
familyQuery.page = 1
void loadFamilies()
}
watch(activeTab, (value) => {
if (value === 'morphemes' && morphemes.value.length === 0) void loadMorphemes()
if (value === 'cards' && cards.value.length === 0) void loadCards()
if (value === 'families' && families.value.length === 0) void loadFamilies()
})
onMounted(() => {
void loadMorphemes()
})
</script>
<template>
<div class="morphology">
<div class="page-heading">
<div>
<h1>词根词族</h1>
<p>浏览前缀、词根、后缀,单词卡片与可展开的词族族谱</p>
</div>
<div class="heading-meta">词素 2,235 · 卡片 12,003 · 词族 22,717</div>
</div>
<section class="panel">
<el-tabs v-model="activeTab" class="module-tabs">
<el-tab-pane label="词素" name="morphemes">
<div class="filters">
<el-select v-model="morphemeQuery.type" placeholder="全部类型" clearable style="width: 140px">
<el-option label="前缀" value="prefix" />
<el-option label="词根" value="root" />
<el-option label="后缀" value="suffix" />
</el-select>
<el-input
v-model="morphemeQuery.keyword"
placeholder="按词形搜索"
clearable
style="width: 220px"
@keyup.enter="searchMorphemes"
/>
<el-button type="primary" @click="searchMorphemes">查询</el-button>
</div>
<DataTable
:data="morphemes"
:loading="morphemeLoading"
:error="morphemeError"
:total="morphemeTotal"
:page="morphemeQuery.page"
:size="morphemeQuery.size"
empty-text="没有匹配的词素"
@update:page="(value: number) => { morphemeQuery.page = value; loadMorphemes() }"
@update:size="(value: number) => { morphemeQuery.size = value; morphemeQuery.page = 1; loadMorphemes() }"
@row-click="openMorpheme"
>
<el-table-column label="词形" min-width="150">
<template #default="{ row }">
<span class="word">{{ row.form || '—' }}</span>
</template>
</el-table-column>
<el-table-column label="类型" width="90">
<template #default="{ row }">
<el-tag size="small" :type="TYPE_TAGS[row.type] ?? 'info'">
{{ TYPE_LABELS[row.type] ?? row.type }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="中文释义" min-width="150">
<template #default="{ row }">{{ row.meaningZh || '—' }}</template>
</el-table-column>
<el-table-column label="英文释义" min-width="150">
<template #default="{ row }">{{ row.meaningEn || '—' }}</template>
</el-table-column>
<el-table-column label="备注" min-width="150">
<template #default="{ row }">{{ row.note || '—' }}</template>
</el-table-column>
</DataTable>
</el-tab-pane>
<el-tab-pane label="单词卡片" name="cards">
<div class="filters">
<el-input
v-model="cardQuery.keyword"
placeholder="按单词搜索"
clearable
style="width: 240px"
@keyup.enter="searchCards"
/>
<el-button type="primary" @click="searchCards">查询</el-button>
</div>
<DataTable
:data="cards"
:loading="cardLoading"
:error="cardError"
:total="cardTotal"
:page="cardQuery.page"
:size="cardQuery.size"
empty-text="没有匹配的卡片"
@update:page="(value: number) => { cardQuery.page = value; loadCards() }"
@update:size="(value: number) => { cardQuery.size = value; cardQuery.page = 1; loadCards() }"
@row-click="openCard"
>
<el-table-column label="单词" min-width="180">
<template #default="{ row }">
<span class="word">{{ row.word }}</span>
</template>
</el-table-column>
<el-table-column label="记忆提示" min-width="300">
<template #default="{ row }">{{ row.memoryNote || '—' }}</template>
</el-table-column>
<el-table-column label="考试" min-width="170">
<template #default="{ row }">
<el-tag v-for="exam in row.exams" :key="exam.id" size="small" effect="plain">
{{ exam.name }}
</el-tag>
<span v-if="row.exams.length === 0" class="muted">—</span>
</template>
</el-table-column>
</DataTable>
</el-tab-pane>
<el-tab-pane label="词族" name="families">
<div class="filters">
<el-input
v-model="familyQuery.keyword"
placeholder="按单词搜索"
clearable
style="width: 240px"
@keyup.enter="searchFamilies"
/>
<el-button type="primary" @click="searchFamilies">查询</el-button>
</div>
<DataTable
:data="families"
:loading="familyLoading"
:error="familyError"
:total="familyTotal"
:page="familyQuery.page"
:size="familyQuery.size"
empty-text="没有匹配的词族"
@update:page="(value: number) => { familyQuery.page = value; loadFamilies() }"
@update:size="(value: number) => { familyQuery.size = value; familyQuery.page = 1; loadFamilies() }"
@row-click="openFamily"
>
<el-table-column label="单词" min-width="150">
<template #default="{ row }">
<span class="word">{{ row.word }}</span>
</template>
</el-table-column>
<el-table-column label="顶层词族" min-width="150">
<template #default="{ row }">{{ row.topWord }}</template>
</el-table-column>
<el-table-column label="释义" min-width="240">
<template #default="{ row }">{{ row.interpretation || '—' }}</template>
</el-table-column>
<el-table-column label="分组层级" width="120" align="center">
<template #default="{ row }">
{{ row.groupLevel1 ?? '—' }} / {{ row.groupLevel2 ?? '—' }} / {{ row.groupLevel3 ?? '—' }}
</template>
</el-table-column>
<el-table-column label="考试" min-width="170">
<template #default="{ row }">
<el-tag v-for="exam in row.exams" :key="exam.id" size="small" effect="plain">
{{ exam.name }}
</el-tag>
<span v-if="row.exams.length === 0" class="muted">—</span>
</template>
</el-table-column>
</DataTable>
</el-tab-pane>
</el-tabs>
</section>
<!-- 词素详情 -->
<el-drawer v-model="morphemeOpen" direction="rtl" size="620px" append-to-body>
<template #header>
<b>词素详情 <span v-if="morphemeDetail" class="drawer-sub">{{ morphemeDetail.displayText }}</span></b>
</template>
<div v-loading="morphemeDetailLoading">
<el-alert v-if="morphemeDetailError" :title="morphemeDetailError" type="error" :closable="false" />
<template v-else-if="morphemeDetail">
<dl class="facts">
<div><dt>词形</dt><dd>{{ morphemeDetail.form || '—' }}</dd></div>
<div><dt>类型</dt>
<dd>
<el-tag size="small" :type="TYPE_TAGS[morphemeDetail.type] ?? 'info'">
{{ TYPE_LABELS[morphemeDetail.type] ?? morphemeDetail.type }}
</el-tag>
</dd>
</div>
<div><dt>英文释义</dt><dd>{{ morphemeDetail.meaningEn || '—' }}</dd></div>
<div><dt>中文释义</dt><dd>{{ morphemeDetail.meaningZh || '—' }}</dd></div>
<div><dt>备注</dt><dd>{{ morphemeDetail.note || '—' }}</dd></div>
<div><dt>引用卡片</dt><dd>{{ morphemeDetail.cardCount }}</dd></div>
</dl>
<div class="block-title">引用该词素的卡片</div>
<el-empty v-if="morphemeDetail.cards.length === 0" description="暂无引用卡片" :image-size="60" />
<el-table v-else :data="morphemeDetail.cards" size="small" max-height="380">
<el-table-column prop="word" label="单词" width="140" />
<el-table-column prop="memoryNote" label="记忆提示" />
</el-table>
</template>
<div v-else-if="!morphemeDetailLoading" class="muted">词素 {{ morphemeDetailId }} 暂无数据</div>
</div>
</el-drawer>
<!-- 卡片详情 -->
<el-drawer v-model="cardOpen" direction="rtl" size="680px" append-to-body>
<template #header>
<b>单词卡片 <span v-if="cardDetail" class="drawer-sub">{{ cardDetail.word }}</span></b>
</template>
<div v-loading="cardDetailLoading">
<el-alert v-if="cardDetailError" :title="cardDetailError" type="error" :closable="false" />
<template v-else-if="cardDetail">
<dl class="facts">
<div><dt>单词</dt><dd>{{ cardDetail.word }}</dd></div>
<div><dt>是否隐藏</dt><dd>{{ cardDetail.hidden ? '是' : '否' }}</dd></div>
<div><dt>前缀</dt><dd>{{ cardDetail.prefixForm || '—' }}</dd></div>
<div><dt>词根</dt><dd>{{ cardDetail.rootForm || '—' }}</dd></div>
<div><dt>后缀</dt><dd>{{ cardDetail.suffixForm || '—' }}</dd></div>
<div><dt>旧版词族引用</dt><dd>{{ cardDetail.defaultFamilyRef || '—' }}(不可解析)</dd></div>
</dl>
<div class="block">
<div class="block-title">记忆提示</div>
<p class="text">{{ cardDetail.memoryNote || '—' }}</p>
</div>
<div class="block">
<div class="block-title">例句</div>
<p class="text">{{ cardDetail.exampleText || '—' }}</p>
</div>
<div class="block">
<div class="block-title">适用考试</div>
<div class="tag-row">
<el-tag v-for="exam in cardDetail.exams" :key="exam.id" size="small" effect="plain">
{{ exam.name }}
</el-tag>
<span v-if="cardDetail.exams.length === 0" class="muted">—</span>
</div>
</div>
<div class="block">
<div class="block-title">卡片—分组关联</div>
<el-empty v-if="cardDetail.familyLinks.length === 0" description="暂无分组关联" :image-size="54" />
<el-table v-else :data="cardDetail.familyLinks" size="small">
<el-table-column prop="groupNo" label="组号" width="90" />
<el-table-column prop="familyRef" label="旧版词族引用" width="150" />
<el-table-column label="隐藏">
<template #default="{ row }">{{ row.hidden ? '是' : '否' }}</template>
</el-table-column>
</el-table>
</div>
</template>
<div v-else-if="!cardDetailLoading" class="muted">卡片 {{ cardDetailId }} 暂无数据</div>
</div>
</el-drawer>
<!-- 词族详情 + 族谱 -->
<el-drawer v-model="familyOpen" direction="rtl" size="min(860px, 94vw)" append-to-body>
<template #header>
<b>词族详情 <span v-if="familyDetail" class="drawer-sub">{{ familyDetail.word }}</span></b>
</template>
<div v-loading="familyDetailLoading">
<el-alert v-if="familyDetailError" :title="familyDetailError" type="error" :closable="false" />
<template v-else-if="familyDetail">
<dl class="facts">
<div><dt>单词</dt><dd>{{ familyDetail.word }}</dd></div>
<div><dt>顶层词族</dt><dd>{{ familyDetail.topWord }}</dd></div>
<div><dt>释义</dt><dd>{{ familyDetail.interpretation || '—' }}</dd></div>
<div><dt>分组层级</dt>
<dd>{{ familyDetail.groupLevel1 ?? '—' }} / {{ familyDetail.groupLevel2 ?? '—' }} / {{ familyDetail.groupLevel3 ?? '—' }}</dd>
</div>
</dl>
<div class="block">
<div class="block-title">适用考试</div>
<div class="tag-row">
<el-tag v-for="exam in familyDetail.exams" :key="exam.id" size="small" effect="plain">
{{ exam.name }}
</el-tag>
<span v-if="familyDetail.exams.length === 0" class="muted">—</span>
</div>
</div>
<div class="block">
<div class="block-title">变体({{ familyDetail.variants.length }})</div>
<el-empty v-if="familyDetail.variants.length === 0" description="没有变体" :image-size="54" />
<el-table v-else :data="familyDetail.variants" size="small">
<el-table-column prop="variantWord" label="变体词" width="160" />
<el-table-column prop="interpretation" label="释义" />
<el-table-column prop="memberCount" label="成员数" width="90" align="right" />
</el-table>
</div>
<div class="block">
<div class="block-title">小组({{ familyDetail.miniGroups.length }})</div>
<el-empty v-if="familyDetail.miniGroups.length === 0" description="没有小组" :image-size="54" />
<div v-else class="mini-groups">
<div v-for="group in familyDetail.miniGroups" :key="group.id" class="mini-group">
<div class="mini-head">
<span>小组 #{{ group.id }}</span>
<span class="muted">成员 {{ group.size }}</span>
</div>
<div class="tag-row">
<el-tag v-for="member in group.members" :key="member.familyEntryId" size="small" effect="plain">
{{ member.word }}
</el-tag>
</div>
</div>
</div>
</div>
<div class="block">
<div class="block-title">树形族谱</div>
<div class="tree-wrap">
<el-tree
:key="treeKey"
lazy
:load="loadNode"
:props="{ label: 'label', children: 'children', isLeaf: 'leaf' }"
node-key="id"
class="family-tree"
>
<template #default="{ data }">
<span class="tree-node" :class="`tree-${data.nodeType}`">
<span class="tree-label">{{ data.label }}</span>
<span v-if="data.subtitle" class="tree-sub">{{ data.subtitle }}</span>
</span>
</template>
</el-tree>
</div>
</div>
</template>
<div v-else-if="!familyDetailLoading" class="muted">词族 {{ familyDetailId }} 暂无数据</div>
</div>
</el-drawer>
</div>
</template>
<style scoped>
.page-heading {
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 16px;
margin-bottom: 18px;
}
.page-heading h1 {
margin: 0 0 4px;
font-size: 22px;
letter-spacing: -0.01em;
}
.page-heading p {
margin: 0;
font-size: 13px;
color: #6b7280;
}
.heading-meta {
font-size: 11.5px;
color: #9ca3af;
}
.panel {
background: #fff;
border: 1px solid #e8ebf0;
border-radius: 10px;
padding: 12px 18px 18px;
}
.module-tabs :deep(.el-tabs__item) {
font-size: 13.5px;
}
.filters {
display: flex;
gap: 10px;
margin-bottom: 16px;
flex-wrap: wrap;
}
.word {
font-weight: 600;
}
.muted {
color: #9ca3af;
font-size: 12px;
}
.drawer-sub {
font-size: 11.5px;
color: #9ca3af;
margin-left: 8px;
}
.facts {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 10px 18px;
margin: 0 0 18px;
}
.facts div {
display: flex;
justify-content: space-between;
gap: 10px;
border-bottom: 1px dashed #f1f3f6;
padding-bottom: 6px;
}
.facts dt {
font-size: 12px;
color: #9ca3af;
}
.facts dd {
margin: 0;
font-size: 12.5px;
font-weight: 500;
color: #374151;
text-align: right;
}
.block {
margin-bottom: 18px;
}
.block-title {
font-size: 12.5px;
font-weight: 600;
color: #374151;
margin-bottom: 8px;
}
.text {
margin: 0;
font-size: 12.5px;
color: #4b5563;
line-height: 1.8;
white-space: pre-wrap;
}
.tag-row {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.mini-groups {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 10px;
}
.mini-group {
border: 1px solid #eef0f3;
border-radius: 8px;
padding: 10px;
}
.mini-head {
display: flex;
justify-content: space-between;
font-size: 12px;
color: #374151;
margin-bottom: 6px;
}
.tree-wrap {
border: 1px solid #eef0f3;
border-radius: 8px;
padding: 10px;
max-height: 380px;
overflow: auto;
}
.family-tree {
background: transparent;
}
.tree-node {
display: flex;
align-items: baseline;
gap: 8px;
font-size: 12.5px;
}
.tree-label {
color: #374151;
}
.tree-sub {
font-size: 10.5px;
color: #9ca3af;
}
.tree-miniGroup .tree-label {
color: #7c3aed;
}
.tree-variant .tree-label {
color: #0891b2;
}
.tree-info .tree-label {
color: #9ca3af;
font-style: italic;
}
</style>
+475
View File
@@ -0,0 +1,475 @@
<script setup lang="ts">
import { nextTick, onBeforeUnmount, onMounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import * as echarts from 'echarts'
import SectionPanel from '@/components/SectionPanel.vue'
import StatCard from '@/components/StatCard.vue'
import {
getDashboardSummary,
getExamDistribution,
getPosDistribution,
getTopBooks
} from '@/api/dashboard'
import type {
CoverageItem,
ExamStat,
Kpi,
PosStat,
QualityItem,
TopBook
} from '@/api/types'
import { examChartOption, posChartOption } from '@/charts/overview'
import { coverUrl, onCoverError } from '@/utils/cover'
const loading = ref(true)
const refreshing = ref(false)
const error = ref('')
const kpis = ref<Kpi[]>([])
const quality = ref<QualityItem[]>([])
const coverage = ref<CoverageItem[]>([])
const exams = ref<ExamStat[]>([])
const topBooks = ref<TopBook[]>([])
const pos = ref<PosStat[]>([])
const router = useRouter()
const examEl = ref<HTMLDivElement | null>(null)
const posEl = ref<HTMLDivElement | null>(null)
let charts: echarts.ECharts[] = []
const fmt = (n: number) => n.toLocaleString('en-US')
function renderCharts(): void {
charts.forEach((chart) => chart.dispose())
charts = []
if (examEl.value) {
const chart = echarts.init(examEl.value)
chart.setOption(examChartOption(exams.value))
charts.push(chart)
}
if (posEl.value) {
const chart = echarts.init(posEl.value)
chart.setOption(posChartOption(pos.value))
charts.push(chart)
}
}
function resizeCharts(): void {
charts.forEach((chart) => chart.resize())
}
async function load(refresh = false): Promise<void> {
if (refresh) {
refreshing.value = true
} else {
loading.value = true
}
error.value = ''
const results = await Promise.allSettled([
getDashboardSummary(refresh),
getExamDistribution(refresh),
getTopBooks(refresh),
getPosDistribution(refresh)
])
const messages: string[] = []
if (results[0].status === 'fulfilled') {
kpis.value = results[0].value.kpis
quality.value = results[0].value.quality
coverage.value = results[0].value.coverage
} else {
kpis.value = []
messages.push(toMessage(results[0].reason, '总量指标加载失败'))
}
if (results[1].status === 'fulfilled') {
exams.value = results[1].value
} else {
exams.value = []
messages.push(toMessage(results[1].reason, '考试分布加载失败'))
}
if (results[2].status === 'fulfilled') {
topBooks.value = results[2].value
} else {
topBooks.value = []
messages.push(toMessage(results[2].reason, '词书排行加载失败'))
}
if (results[3].status === 'fulfilled') {
pos.value = results[3].value
} else {
pos.value = []
messages.push(toMessage(results[3].reason, '词性分布加载失败'))
}
error.value = messages.join(';')
await nextTick()
renderCharts()
loading.value = false
refreshing.value = false
}
function toMessage(reason: unknown, fallback: string): string {
return reason instanceof Error ? reason.message : fallback
}
function openQuality(): void {
void router.push('/quality')
}
onMounted(() => {
window.addEventListener('resize', resizeCharts)
void load()
})
onBeforeUnmount(() => {
window.removeEventListener('resize', resizeCharts)
charts.forEach((chart) => chart.dispose())
charts = []
})
</script>
<template>
<div v-loading="loading" class="overview">
<div class="page-heading">
<div>
<h1>数据概览</h1>
<p>四个业务域的整体规模、分布与健康度</p>
</div>
<div class="heading-actions">
<el-tag type="info" effect="plain" round>聚合缓存 10 分钟</el-tag>
<el-button :loading="refreshing" plain type="primary" @click="load(true)">刷新</el-button>
<div class="heading-meta">共 36 张表 · 约 364 万行</div>
</div>
</div>
<el-alert
v-if="error"
class="error"
:title="error"
type="error"
show-icon
:closable="false"
/>
<div class="kpi-grid">
<StatCard
v-for="kpi in kpis"
:key="kpi.key"
:label="kpi.label"
:value="kpi.value"
:note="kpi.note"
:tone="kpi.tone"
/>
</div>
<div class="chart-grid">
<SectionPanel title="考试维度 · 关联词条量" subtitle="按 book.exam_id 汇总">
<div ref="examEl" class="chart" />
</SectionPanel>
<SectionPanel title="词性分布" subtitle="word_sense · Top 10">
<div ref="posEl" class="chart" />
</SectionPanel>
</div>
<div class="lower-grid">
<SectionPanel title="词书规模排行" subtitle="实际词条数 Top 10">
<el-table :data="topBooks" size="small" class="ranking-table">
<el-table-column label="词书" min-width="240">
<template #default="{ row }">
<div class="book-cell">
<img
class="cover"
:src="coverUrl(row.coverPath)"
alt=""
@error="onCoverError"
/>
<div class="book-meta">
<div class="book-name">{{ row.name }}</div>
<div class="book-code">{{ row.code }}</div>
</div>
</div>
</template>
</el-table-column>
<el-table-column prop="exam" label="考试" width="88" />
<el-table-column label="实际" width="96" align="right">
<template #default="{ row }">{{ fmt(row.actual) }}</template>
</el-table-column>
<el-table-column label="声明" width="96" align="right">
<template #default="{ row }">
<span class="muted">{{ fmt(row.declared) }}</span>
</template>
</el-table-column>
<el-table-column label="差异" width="84" align="right">
<template #default="{ row }">
<span :class="row.actual === row.declared ? 'ok' : 'warn-text'">
{{ row.actual === row.declared ? '一致' : row.actual - row.declared }}
</span>
</template>
</el-table-column>
</el-table>
</SectionPanel>
<div class="side-stack">
<SectionPanel title="质量红绿灯" subtitle="点击进入数据质量">
<div class="quality-list">
<div
v-for="item in quality"
:key="item.key"
class="quality-row clickable"
@click="openQuality"
>
<span class="led" :class="`led-${item.level}`" />
<span class="quality-label">{{ item.label }}</span>
<span class="quality-value">
{{ fmt(item.value) }}<span class="unit"> {{ item.unit }}</span>
</span>
</div>
</div>
</SectionPanel>
<SectionPanel title="跨域文本覆盖度" subtitle="与词条索引词交集">
<div v-for="item in coverage" :key="item.name" class="coverage-row">
<div class="coverage-top">
<span>{{ item.name }}</span>
<b>{{ item.pct }}% · {{ fmt(item.hit) }}/{{ fmt(item.total) }}</b>
</div>
<el-progress
:percentage="item.pct"
:show-text="false"
:stroke-width="5"
color="#2563eb"
/>
</div>
</SectionPanel>
</div>
</div>
</div>
</template>
<style scoped>
.overview {
padding-bottom: 30px;
}
.page-heading {
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 16px;
margin-bottom: 18px;
}
.page-heading h1 {
margin: 0 0 4px;
font-size: 22px;
letter-spacing: -0.01em;
}
.page-heading p {
margin: 0;
font-size: 13px;
color: #6b7280;
}
.heading-meta {
font-size: 11.5px;
color: #9ca3af;
}
.heading-actions {
display: flex;
align-items: center;
gap: 10px;
}
.error {
margin-bottom: 16px;
}
.kpi-grid {
display: grid;
grid-template-columns: repeat(6, minmax(0, 1fr));
gap: 12px;
margin-bottom: 16px;
}
.chart-grid {
display: grid;
grid-template-columns: 1.55fr minmax(0, 1fr);
gap: 16px;
}
.lower-grid {
display: grid;
grid-template-columns: 1.45fr minmax(0, 1fr);
gap: 16px;
margin-top: 16px;
}
.side-stack {
display: flex;
flex-direction: column;
gap: 16px;
min-width: 0;
}
.chart {
height: 300px;
width: 100%;
}
.book-cell {
display: flex;
align-items: center;
gap: 10px;
}
.cover {
width: 30px;
height: 40px;
border-radius: 4px;
object-fit: cover;
background: #eef2f7;
flex: none;
}
.book-meta {
min-width: 0;
}
.book-name {
font-weight: 500;
max-width: 250px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.book-code {
font-size: 11px;
color: #9ca3af;
}
.ranking-table :deep(.el-table__header th) {
font-size: 11.5px;
color: #9ca3af;
font-weight: 500;
}
.ranking-table :deep(.el-table__cell) {
padding: 8px 0;
}
.muted {
color: #9ca3af;
}
.ok {
color: #16a34a;
font-size: 12px;
}
.warn-text {
color: #d97706;
font-size: 12px;
}
.quality-list {
display: flex;
flex-direction: column;
}
.quality-row {
display: grid;
grid-template-columns: 10px minmax(0, 1fr) auto;
gap: 10px;
align-items: center;
padding: 7px 0;
border-bottom: 1px dashed #f1f3f6;
}
.quality-row:last-child {
border-bottom: 0;
}
.quality-row.clickable {
cursor: pointer;
border-radius: 6px;
padding-left: 4px;
padding-right: 4px;
}
.quality-row.clickable:hover {
background: #f8fafc;
}
.led {
width: 8px;
height: 8px;
border-radius: 50%;
}
.led-bad {
background: #ef4444;
box-shadow: 0 0 0 3px #fee2e2;
}
.led-warn {
background: #f59e0b;
box-shadow: 0 0 0 3px #fef3c7;
}
.led-info {
background: #3b82f6;
box-shadow: 0 0 0 3px #dbeafe;
}
.quality-label {
font-size: 12.5px;
color: #4b5563;
}
.quality-value {
font-size: 13px;
font-weight: 600;
color: #111827;
font-variant-numeric: tabular-nums;
}
.unit {
font-size: 10px;
color: #9ca3af;
font-weight: 400;
}
.coverage-row {
margin-bottom: 11px;
}
.coverage-row:last-child {
margin-bottom: 0;
}
.coverage-top {
display: flex;
justify-content: space-between;
gap: 12px;
font-size: 12px;
color: #6b7280;
margin-bottom: 4px;
}
.coverage-top b {
color: #374151;
font-variant-numeric: tabular-nums;
}
@media (max-width: 1180px) {
.kpi-grid {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
.chart-grid,
.lower-grid {
grid-template-columns: minmax(0, 1fr);
}
}
</style>
+22
View File
@@ -0,0 +1,22 @@
<script setup lang="ts">
import { useRoute } from 'vue-router'
const route = useRoute()
</script>
<template>
<div class="placeholder">
<el-empty :description="`${String(route.meta.title ?? '该模块')}将在后续任务中实现`" />
</div>
</template>
<style scoped>
.placeholder {
display: grid;
place-items: center;
min-height: 420px;
background: #fff;
border: 1px solid #e8ebf0;
border-radius: 10px;
}
</style>
+414
View File
@@ -0,0 +1,414 @@
<script setup lang="ts">
import { nextTick, onBeforeUnmount, onMounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import * as echarts from 'echarts'
import SectionPanel from '@/components/SectionPanel.vue'
import {
getDeclaredDiff,
getMissingReferences,
getQualityCoverage,
getQualitySummary
} from '@/api/quality'
import type {
DeclaredDiff,
MissingReference,
QualityCoverage,
QualitySummaryItem
} from '@/api/types'
import { coverageOption } from '@/charts/quality'
const router = useRouter()
const items = ref<QualitySummaryItem[]>([])
const diffs = ref<DeclaredDiff[]>([])
const missing = ref<MissingReference[]>([])
const coverage = ref<QualityCoverage[]>([])
const loading = ref(true)
const error = ref('')
const chartEl = ref<HTMLDivElement | null>(null)
let chart: echarts.ECharts | null = null
const TYPE_LABELS: Record<string, string> = {
book_file: '缺失清单文件',
zpk: '缺失 zpk 引用',
cover: '缺少封面'
}
const LEVEL_CLASS: Record<string, string> = {
bad: 'led-bad',
warn: 'led-warn',
info: 'led-info'
}
async function load(refresh = false): Promise<void> {
loading.value = true
error.value = ''
const results = await Promise.allSettled([
getQualitySummary(refresh),
getDeclaredDiff(refresh),
getMissingReferences(refresh),
getQualityCoverage(refresh)
])
const messages: string[] = []
if (results[0].status === 'fulfilled') {
items.value = results[0].value.items
} else {
items.value = []
messages.push(asMessage(results[0].reason, '质量摘要加载失败'))
}
if (results[1].status === 'fulfilled') {
diffs.value = results[1].value
} else {
diffs.value = []
messages.push(asMessage(results[1].reason, '差异明细加载失败'))
}
if (results[2].status === 'fulfilled') {
missing.value = results[2].value
} else {
missing.value = []
messages.push(asMessage(results[2].reason, '缺失明细加载失败'))
}
if (results[3].status === 'fulfilled') {
coverage.value = results[3].value
await nextTick()
renderChart()
} else {
coverage.value = []
messages.push(asMessage(results[3].reason, '覆盖度加载失败'))
}
error.value = messages.join(';')
loading.value = false
}
function asMessage(reason: unknown, fallback: string): string {
return reason instanceof Error ? reason.message : fallback
}
function renderChart(): void {
if (!chartEl.value) return
if (!chart) chart = echarts.init(chartEl.value)
chart.setOption(coverageOption(coverage.value), true)
}
function resize(): void {
chart?.resize()
}
function openBook(bookId: string | null): void {
if (bookId) void router.push(`/books/${bookId}`)
}
function fmt(n: number): string {
return n.toLocaleString('en-US')
}
onMounted(() => {
window.addEventListener('resize', resize)
void load()
})
onBeforeUnmount(() => {
window.removeEventListener('resize', resize)
chart?.dispose()
chart = null
})
</script>
<template>
<div v-loading="loading" class="quality">
<div class="page-heading">
<div>
<h1>数据质量</h1>
<p>声明与实际差异、缺失引用、空义项与跨域覆盖度</p>
</div>
<div class="heading-actions">
<el-tag type="info" effect="plain" round>聚合结果缓存 10 分钟</el-tag>
<el-button type="primary" plain @click="load(true)">刷新</el-button>
</div>
</div>
<el-alert
v-if="error"
:title="error"
type="error"
show-icon
:closable="false"
class="block-gap"
/>
<div class="summary-grid">
<div v-for="item in items" :key="item.key" class="summary-card">
<el-tooltip :content="item.description" placement="top" effect="light">
<div class="summary-head">
<span class="led" :class="LEVEL_CLASS[item.level]" />
<span class="summary-label">{{ item.label }}</span>
<span class="info-dot">?</span>
</div>
</el-tooltip>
<div class="summary-value">
{{ fmt(item.value) }}<span class="summary-unit"> {{ item.unit }}</span>
</div>
<p class="summary-desc">{{ item.description }}</p>
</div>
</div>
<div class="grid">
<SectionPanel title="声明与实际差异" subtitle="book.declared_entry_count vs book_entry 实际行数">
<el-empty v-if="diffs.length === 0" description="没有声明与实际不一致的词书" :image-size="60" />
<el-table v-else :data="diffs" size="small" max-height="360" @row-click="(row: DeclaredDiff) => openBook(row.bookId)">
<el-table-column label="词书" min-width="230">
<template #default="{ row }">
<div class="book-name">{{ row.bookName }}</div>
<div class="book-code">{{ row.bookCode }}</div>
</template>
</el-table-column>
<el-table-column label="考试" width="90">
<template #default="{ row }">{{ row.examName || '未归类' }}</template>
</el-table-column>
<el-table-column label="声明" width="90" align="right">
<template #default="{ row }">{{ fmt(row.declared) }}</template>
</el-table-column>
<el-table-column label="实际" width="90" align="right">
<template #default="{ row }">{{ fmt(row.actual) }}</template>
</el-table-column>
<el-table-column label="差值" width="90" align="right">
<template #default="{ row }">
<span :class="row.diff < 0 ? 'warn-text' : 'ok'">{{ row.diff }}</span>
</template>
</el-table-column>
</el-table>
</SectionPanel>
<SectionPanel title="跨域文本覆盖度" subtitle="与 word_entry.index_word 的文本交集 · 弱关联">
<el-alert
v-if="coverage.length === 0"
title="覆盖度数据不可用"
type="warning"
:closable="false"
/>
<template v-else>
<div ref="chartEl" class="chart" />
<div class="coverage-rows">
<div v-for="item in coverage" :key="item.key" class="coverage-row">
<span>{{ item.name }}</span>
<span class="coverage-value">{{ item.hit.toLocaleString('en-US') }} / {{ item.total.toLocaleString('en-US') }} · {{ item.pct }}%</span>
<span class="coverage-miss">未覆盖 {{ (item.total - item.hit).toLocaleString('en-US') }}</span>
</div>
</div>
</template>
</SectionPanel>
</div>
<SectionPanel title="缺失引用与文件明细" subtitle="可定位项支持跳转到词书详情">
<el-empty v-if="missing.length === 0" description="没有缺失项" :image-size="60" />
<el-table v-else :data="missing" size="small" max-height="420">
<el-table-column label="类型" width="130">
<template #default="{ row }">
<el-tag size="small" :type="row.type === 'zpk' ? 'danger' : row.type === 'book_file' ? 'warning' : 'info'">
{{ TYPE_LABELS[row.type] ?? row.type }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="identifier" label="标识" width="220" />
<el-table-column prop="source" label="来源字段" width="220" />
<el-table-column prop="detail" label="说明" min-width="260" />
<el-table-column label="操作" width="100" align="center">
<template #default="{ row }">
<el-button
v-if="row.bookId"
link
type="primary"
size="small"
@click="openBook(row.bookId)"
>
查看词书
</el-button>
<span v-else class="muted">仅明细</span>
</template>
</el-table-column>
</el-table>
</SectionPanel>
</div>
</template>
<style scoped>
.page-heading {
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 16px;
margin-bottom: 18px;
}
.page-heading h1 {
margin: 0 0 4px;
font-size: 22px;
letter-spacing: -0.01em;
}
.page-heading p {
margin: 0;
font-size: 13px;
color: #6b7280;
}
.heading-actions {
display: flex;
align-items: center;
gap: 10px;
}
.block-gap {
margin-bottom: 14px;
}
.summary-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
gap: 12px;
margin-bottom: 16px;
}
.summary-card {
background: #fff;
border: 1px solid #e8ebf0;
border-radius: 10px;
padding: 14px 16px;
}
.summary-head {
display: flex;
align-items: center;
gap: 8px;
cursor: help;
}
.summary-label {
font-size: 12.5px;
color: #4b5563;
}
.info-dot {
margin-left: auto;
width: 16px;
height: 16px;
border-radius: 50%;
border: 1px solid #d1d5db;
color: #9ca3af;
font-size: 10px;
display: grid;
place-items: center;
}
.summary-value {
font-size: 24px;
font-weight: 700;
margin: 8px 0 4px;
font-variant-numeric: tabular-nums;
}
.summary-unit {
font-size: 11px;
color: #9ca3af;
font-weight: 400;
}
.summary-desc {
margin: 0;
font-size: 11px;
color: #9ca3af;
line-height: 1.5;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.led {
width: 8px;
height: 8px;
border-radius: 50%;
flex: none;
}
.led-bad {
background: #ef4444;
box-shadow: 0 0 0 3px #fee2e2;
}
.led-warn {
background: #f59e0b;
box-shadow: 0 0 0 3px #fef3c7;
}
.led-info {
background: #3b82f6;
box-shadow: 0 0 0 3px #dbeafe;
}
.grid {
display: grid;
grid-template-columns: 1.25fr minmax(0, 1fr);
gap: 16px;
margin-bottom: 16px;
}
.chart {
height: 190px;
width: 100%;
}
.coverage-rows {
margin-top: 10px;
border-top: 1px dashed #f1f3f6;
padding-top: 8px;
}
.coverage-row {
display: flex;
justify-content: space-between;
gap: 12px;
font-size: 11.5px;
color: #6b7280;
padding: 3px 0;
}
.coverage-value {
color: #374151;
font-variant-numeric: tabular-nums;
}
.coverage-miss {
color: #9ca3af;
}
.book-name {
font-weight: 500;
}
.book-code {
font-size: 11px;
color: #9ca3af;
}
.ok {
color: #16a34a;
font-size: 12px;
}
.warn-text {
color: #d97706;
font-size: 12px;
}
.muted {
color: #9ca3af;
font-size: 11.5px;
}
@media (max-width: 1100px) {
.grid {
grid-template-columns: minmax(0, 1fr);
}
}
</style>
+249
View File
@@ -0,0 +1,249 @@
<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { getSynonym } from '@/api/synonyms'
import type { SynonymDetail } from '@/api/types'
const route = useRoute()
const router = useRouter()
const wordId = String(route.params.id)
const detail = ref<SynonymDetail | null>(null)
const loading = ref(true)
const error = ref('')
async function load(): Promise<void> {
loading.value = true
error.value = ''
try {
detail.value = await getSynonym(wordId)
} catch (err) {
error.value = err instanceof Error ? err.message : '近义词详情加载失败'
detail.value = null
} finally {
loading.value = false
}
}
onMounted(() => {
void load()
})
</script>
<template>
<div class="synonym-detail">
<div class="page-heading">
<div class="heading-left">
<el-button link type="primary" @click="router.push('/synonyms')">← 返回近义词列表</el-button>
<h1>{{ detail?.word ?? '近义词详情' }}</h1>
</div>
<div class="heading-meta">词头 ID {{ wordId }}</div>
</div>
<el-alert v-if="error" :title="error" type="error" show-icon :closable="false" />
<div v-else v-loading="loading" class="content">
<div v-if="detail && detail.senses.length === 0" class="panel">
<el-empty description="该词头没有任何义项" />
<p class="empty-note">词头信息仍然保留:{{ detail.word }}(ID {{ detail.wordId }})</p>
</div>
<div v-for="sense in detail?.senses ?? []" :key="sense.senseId" class="panel sense-card">
<div class="sense-head">
<el-tag v-if="sense.partOfSpeech" size="small">{{ sense.partOfSpeech }}</el-tag>
<span class="sense-gloss">{{ sense.glossZh || '—' }}</span>
<span class="sense-id">义项 ID {{ sense.senseId }}</span>
</div>
<div class="block">
<div class="block-title">分考试近义组</div>
<el-empty
v-if="sense.groups.length === 0"
description="该义项没有近义组"
:image-size="54"
/>
<div v-else class="group-list">
<div v-for="group in sense.groups" :key="group.examId" class="group">
<div class="group-head">
<el-tag size="small" type="primary">{{ group.examName }}</el-tag>
<span class="canonical" v-if="group.canonicalWord">
规范词:<b>{{ group.canonicalWord }}</b>
</span>
<span class="muted">成员 {{ group.memberCount }}</span>
</div>
<div class="tag-row">
<el-tag
v-for="member in group.members"
:key="`${member.wordId}-${member.position}`"
size="small"
effect="plain"
:type="member.word === group.canonicalWord ? 'success' : undefined"
>
{{ member.word }}
</el-tag>
</div>
<p v-if="group.truncated" class="truncate-note">
仅展示前 {{ group.members.length }} 个成员,完整成员数 {{ group.memberCount }}。
</p>
</div>
</div>
</div>
<div class="block">
<div class="block-title">反义词</div>
<el-empty
v-if="sense.antonyms.length === 0"
description="该义项没有反义词"
:image-size="54"
/>
<div v-else class="group-list">
<div v-for="antonym in sense.antonyms" :key="antonym.examId" class="group">
<div class="group-head">
<el-tag size="small" type="danger">{{ antonym.examName }}</el-tag>
</div>
<div class="tag-row">
<el-tag
v-for="word in antonym.words"
:key="`${word.wordId}-${word.position}`"
size="small"
effect="plain"
type="danger"
>
{{ word.word }}
</el-tag>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<style scoped>
.page-heading {
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 16px;
margin-bottom: 18px;
}
.heading-left {
display: flex;
flex-direction: column;
gap: 4px;
}
.page-heading h1 {
margin: 0;
font-size: 24px;
letter-spacing: -0.01em;
}
.heading-meta {
font-size: 11.5px;
color: #9ca3af;
}
.content {
min-height: 200px;
}
.panel {
background: #fff;
border: 1px solid #e8ebf0;
border-radius: 10px;
padding: 18px;
margin-bottom: 14px;
}
.sense-card {
padding: 18px 20px;
}
.sense-head {
display: flex;
align-items: center;
gap: 10px;
flex-wrap: wrap;
border-bottom: 1px solid #f1f3f6;
padding-bottom: 12px;
margin-bottom: 14px;
}
.sense-gloss {
font-size: 14px;
font-weight: 600;
color: #1f2937;
}
.sense-id {
font-size: 11px;
color: #9ca3af;
margin-left: auto;
}
.block {
margin-bottom: 16px;
}
.block-title {
font-size: 12.5px;
font-weight: 600;
color: #374151;
margin-bottom: 10px;
}
.group-list {
display: flex;
flex-direction: column;
gap: 12px;
}
.group {
border: 1px solid #eef0f3;
border-radius: 8px;
padding: 12px;
}
.group-head {
display: flex;
align-items: center;
gap: 10px;
flex-wrap: wrap;
margin-bottom: 8px;
}
.canonical {
font-size: 12.5px;
color: #4b5563;
}
.canonical b {
color: #111827;
}
.tag-row {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.muted {
font-size: 11.5px;
color: #9ca3af;
}
.truncate-note {
margin: 8px 0 0;
font-size: 11px;
color: #d97706;
}
.empty-note {
text-align: center;
font-size: 12px;
color: #9ca3af;
}
</style>
+213
View File
@@ -0,0 +1,213 @@
<script setup lang="ts">
import { nextTick, onBeforeUnmount, onMounted, reactive, ref } from 'vue'
import { useRouter } from 'vue-router'
import * as echarts from 'echarts'
import DataTable from '@/components/DataTable.vue'
import SectionPanel from '@/components/SectionPanel.vue'
import { getSynonymDistribution, getSynonyms } from '@/api/synonyms'
import type { SizeBucket, SynonymWordItem } from '@/api/types'
import { synonymDistributionOption } from '@/charts/synonyms'
const router = useRouter()
const rows = ref<SynonymWordItem[]>([])
const total = ref(0)
const loading = ref(false)
const error = ref('')
const query = reactive({ page: 1, size: 20, keyword: '' })
const buckets = ref<SizeBucket[]>([])
const distributionLoading = ref(false)
const distributionError = ref('')
const chartEl = ref<HTMLDivElement | null>(null)
let chart: echarts.ECharts | null = null
async function load(): Promise<void> {
loading.value = true
error.value = ''
try {
const result = await getSynonyms({
page: query.page,
size: query.size,
keyword: query.keyword.trim() || undefined
})
rows.value = result.items
total.value = result.total
} catch (err) {
error.value = err instanceof Error ? err.message : '近义词头加载失败'
rows.value = []
total.value = 0
} finally {
loading.value = false
}
}
async function loadDistribution(): Promise<void> {
distributionLoading.value = true
distributionError.value = ''
try {
buckets.value = await getSynonymDistribution()
await nextTick()
renderChart()
} catch (err) {
distributionError.value = err instanceof Error ? err.message : '分布数据加载失败'
} finally {
distributionLoading.value = false
}
}
function renderChart(): void {
if (!chartEl.value) return
if (!chart) chart = echarts.init(chartEl.value)
chart.setOption(synonymDistributionOption(buckets.value))
}
function resize(): void {
chart?.resize()
}
function search(): void {
query.page = 1
void load()
}
function openWord(row: unknown): void {
const word = row as SynonymWordItem
void router.push(`/synonyms/${word.wordId}`)
}
onMounted(() => {
window.addEventListener('resize', resize)
void load()
void loadDistribution()
})
onBeforeUnmount(() => {
window.removeEventListener('resize', resize)
chart?.dispose()
chart = null
})
</script>
<template>
<div class="synonyms">
<div class="page-heading">
<div>
<h1>近反义词</h1>
<p>按考试浏览近义组、规范词与反义词,并观察组规模分布</p>
</div>
<div class="heading-meta">词头 6,279 · 义项 8,383</div>
</div>
<SectionPanel title="近义组规模分布" subtitle="按成员数量分桶 · synonym_group">
<el-alert
v-if="distributionError"
:title="distributionError"
type="error"
show-icon
:closable="false"
/>
<div v-else v-loading="distributionLoading" ref="chartEl" class="chart" />
</SectionPanel>
<section class="panel list-panel">
<div class="filters">
<el-input
v-model="query.keyword"
placeholder="按单词搜索"
clearable
style="width: 260px"
@keyup.enter="search"
/>
<el-button type="primary" @click="search">查询</el-button>
</div>
<DataTable
:data="rows"
:loading="loading"
:error="error"
:total="total"
:page="query.page"
:size="query.size"
empty-text="没有匹配的近义词头"
@update:page="(value: number) => { query.page = value; load() }"
@update:size="(value: number) => { query.size = value; query.page = 1; load() }"
@row-click="openWord"
>
<el-table-column label="单词" min-width="200">
<template #default="{ row }">
<span class="word">{{ row.word }}</span>
</template>
</el-table-column>
<el-table-column label="义项数" width="100" align="right">
<template #default="{ row }">{{ row.senseCount }}</template>
</el-table-column>
<el-table-column label="近义关系" width="120" align="center">
<template #default="{ row }">
<el-tag v-if="row.hasRelation" size="small" type="success">有</el-tag>
<el-tag v-else size="small" type="info">无</el-tag>
</template>
</el-table-column>
<el-table-column label="词头 ID" width="130">
<template #default="{ row }">
<span class="muted">{{ row.wordId }}</span>
</template>
</el-table-column>
</DataTable>
</section>
</div>
</template>
<style scoped>
.page-heading {
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 16px;
margin-bottom: 18px;
}
.page-heading h1 {
margin: 0 0 4px;
font-size: 22px;
letter-spacing: -0.01em;
}
.page-heading p {
margin: 0;
font-size: 13px;
color: #6b7280;
}
.heading-meta {
font-size: 11.5px;
color: #9ca3af;
}
.chart {
height: 240px;
width: 100%;
}
.list-panel {
background: #fff;
border: 1px solid #e8ebf0;
border-radius: 10px;
padding: 16px 18px;
margin-top: 16px;
}
.filters {
display: flex;
gap: 10px;
margin-bottom: 16px;
}
.word {
font-weight: 600;
}
.muted {
color: #9ca3af;
font-size: 11.5px;
}
</style>
+25
View File
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"target": "ES2022",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"skipLibCheck": true,
"moduleResolution": "Bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve",
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
},
"types": ["node", "element-plus/global"]
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.vue", "vite.config.ts"]
}
+21
View File
@@ -0,0 +1,21 @@
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
server: {
port: 5173,
proxy: {
'/api': {
target: process.env.VITE_PROXY_TARGET ?? 'http://127.0.0.1:8080',
changeOrigin: true
}
}
}
})