feat(portal-shell): exams 三子页面迁移(analytics/build/edit)

§9.1 教师域 exams 模块补完(继 d066da5 列表/详情/表单后):
- /shell/teacher/exams/[id]/analytics:详情页(图表)- 混合契约
  · 基础统计  assignmentAnalysis(data-ana 子图,schema 已就绪)
  · 扩展字段(排名/每题正确率) MSW 兜底(@contract-pending)
  · 含 Summary/Distribution/QuestionAccuracy/Rankings 四区
- /shell/teacher/exams/[id]/build:工作台页(组卷)@contract-pending
  · 三栏:题库候选 / 已选题目 / 预览
  · 支持搜索/类型/难度筛选,添加/移除/上移/下移/改分
- /shell/teacher/exams/[id]/edit:工作台页(富文本试卷)@contract-pending
  · contentEditable + 工具栏(B/I/U/H1-H3/列表)
  · 右栏试卷属性面板

§11.3 DoD 11 项验收:
1. route-permissions:PREFIX 表 /shell/teacher/exams/ 已覆盖
2. 页面模板:analytics 用 DetailPageShell;build/edit 用 WorkbenchPageShell
3. 三态:loading/error/empty 均实现(workbench 用 errorNode 合并 empty)
4. lib/api hooks:useExamAnalytics/useExamBuild/useQuestionsLibrary/
   useSaveExamBuild/useExamRichEditor/useSaveExamRichContent 6 个
5. @contract-pending MSW 模式:graphql-data.ts 扩展 6 个 case
6. i18n:analytics(19 keys)+build(28 keys)+edit(13 keys) 中英对齐
7. lint:0 errors(4 warnings 在 __generated__)
8. lint:tokens:0 errors
9. notify:success/error/warning 走 @/shared/lib/notify(非 sonner 直引)
10. vitest:transformations 新增 10 函数 22 测试,全量 273/273 通过
11. typecheck:0 errors(noUncheckedIndexedAccess 安全 swap 写法)

剩余:proctoring 标注"二期 WS"按 §9.1 暂缓。
This commit is contained in:
SpecialX
2026-07-22 17:35:54 +08:00
parent d066da563f
commit dca25fc42f
14 changed files with 2467 additions and 0 deletions

View File

@@ -210,6 +210,95 @@
"errorTitleRequired": "Please fill in exam title",
"errorDateRequired": "Please select exam date",
"contractPending": "Create exam contract is @contract-pending, currently backed by MSW. Will switch to real submission once backend mutation is ready."
},
"analytics": {
"title": "Exam Analytics",
"subtitle": "Exam ID: {examId}",
"exportCsv": "Export CSV",
"notFound": "No analytics data found, grading may not be complete",
"sectionSummary": "Summary",
"sectionDistribution": "Score Distribution",
"sectionQuestionAccuracy": "Question Accuracy",
"sectionRankings": "Student Rankings",
"summaryExpected": "Expected",
"summaryAttended": "Attended",
"summaryAvg": "Average",
"summaryMax": "Max",
"summaryMin": "Min",
"summaryPassRate": "Pass Rate",
"emptyDistribution": "No score distribution data",
"emptyQuestionAccuracy": "No question accuracy data",
"emptyRankings": "No ranking data",
"colOrder": "#",
"colQuestionTitle": "Question",
"colCorrectRate": "Correct Rate",
"colAvgScore": "Avg Score",
"colMaxScore": "Max Score",
"colRank": "Rank",
"colStudentNo": "Student No.",
"colStudentName": "Name",
"colTotalScore": "Total Score",
"colLevel": "Level"
},
"build": {
"title": "Build Exam",
"subtitle": "Current total: {total} pts · Pass score: {pass} pts",
"save": "Save Build",
"saveSuccess": "Build saved successfully",
"saveFailed": "Save failed: {message}",
"notFound": "No build data found",
"alreadyAdded": "This question has already been added",
"libraryTitle": "Question Library",
"searchPlaceholder": "Search question content...",
"filterType": "Filter by type",
"filterDifficulty": "Filter by difficulty",
"allTypes": "All types",
"allDifficulties": "All difficulties",
"typeSingle": "Single Choice",
"typeMultiple": "Multiple Choice",
"typeFill": "Fill in the Blank",
"typeEssay": "Essay",
"diffEasy": "Easy",
"diffMedium": "Medium",
"diffHard": "Hard",
"loadingLibrary": "Loading library...",
"loadLibraryFailed": "Library load failed",
"libraryEmpty": "No questions match the filter",
"libraryTotal": "{total} questions total",
"addToExam": "Add to exam",
"unitScore": "pts",
"selectedTitle": "Selected Questions",
"selectedCount": "{count} questions",
"selectedEmpty": "Add questions from the library on the left",
"scoreLabel": "Score",
"moveUp": "Move up",
"moveDown": "Move down",
"remove": "Remove",
"previewTitle": "Preview",
"previewTotal": "Total Score",
"previewBaseline": "Baseline: {baseline} pts",
"previewPassScore": "Pass Score",
"previewTypeBreakdown": "Type Breakdown"
},
"edit": {
"title": "Edit Exam Paper",
"subtitle": "Total: {total} pts · {count} questions",
"save": "Save Paper",
"saveSuccess": "Paper saved successfully",
"saveFailed": "Save failed: {message}",
"notFound": "No paper content found",
"propertiesTitle": "Paper Properties",
"propExamId": "Exam ID",
"propTotalScore": "Total Score",
"propQuestionCount": "Question Count",
"propUpdatedAt": "Last Updated",
"contractPending": "Rich text editor contract is @contract-pending, currently backed by MSW. Will switch to real data once backend is ready.",
"editorTitle": "Paper Content",
"toolbarBold": "Bold",
"toolbarItalic": "Italic",
"toolbarUnderline": "Underline",
"toolbarBulletList": "Bullet list",
"toolbarOrderedList": "Ordered list"
}
},
"homework": {

View File

@@ -210,6 +210,95 @@
"errorTitleRequired": "请填写考试标题",
"errorDateRequired": "请选择考试日期",
"contractPending": "创建考试契约为 @contract-pending当前通过 MSW 兜底。后端补齐 mutation 后将切换为真实提交。"
},
"analytics": {
"title": "考试分析",
"subtitle": "考试 ID{examId}",
"exportCsv": "导出 CSV",
"notFound": "未找到考试分析数据,可能尚未完成批改",
"sectionSummary": "汇总统计",
"sectionDistribution": "分数段分布",
"sectionQuestionAccuracy": "每题正确率",
"sectionRankings": "学生排名",
"summaryExpected": "应考人数",
"summaryAttended": "实考人数",
"summaryAvg": "平均分",
"summaryMax": "最高分",
"summaryMin": "最低分",
"summaryPassRate": "及格率",
"emptyDistribution": "暂无分数段分布数据",
"emptyQuestionAccuracy": "暂无每题正确率数据",
"emptyRankings": "暂无学生排名数据",
"colOrder": "题号",
"colQuestionTitle": "题目",
"colCorrectRate": "正确率",
"colAvgScore": "平均得分",
"colMaxScore": "满分",
"colRank": "排名",
"colStudentNo": "学号",
"colStudentName": "姓名",
"colTotalScore": "总分",
"colLevel": "等级"
},
"build": {
"title": "组卷",
"subtitle": "当前总分:{total} 分 · 及格分:{pass} 分",
"save": "保存组卷",
"saveSuccess": "组卷保存成功",
"saveFailed": "保存失败:{message}",
"notFound": "未找到组卷数据",
"alreadyAdded": "该题目已添加,请勿重复添加",
"libraryTitle": "题库候选",
"searchPlaceholder": "搜索题目内容...",
"filterType": "题型筛选",
"filterDifficulty": "难度筛选",
"allTypes": "全部题型",
"allDifficulties": "全部难度",
"typeSingle": "单选题",
"typeMultiple": "多选题",
"typeFill": "填空题",
"typeEssay": "解答题",
"diffEasy": "简单",
"diffMedium": "中等",
"diffHard": "困难",
"loadingLibrary": "题库加载中...",
"loadLibraryFailed": "题库加载失败",
"libraryEmpty": "暂无符合条件的题目",
"libraryTotal": "共 {total} 题",
"addToExam": "添加到试卷",
"unitScore": "分",
"selectedTitle": "已选题目",
"selectedCount": "共 {count} 题",
"selectedEmpty": "请从左侧题库添加题目",
"scoreLabel": "分值",
"moveUp": "上移",
"moveDown": "下移",
"remove": "移除",
"previewTitle": "预览",
"previewTotal": "总分",
"previewBaseline": "基准:{baseline} 分",
"previewPassScore": "及格分",
"previewTypeBreakdown": "题型分布"
},
"edit": {
"title": "试卷编辑",
"subtitle": "满分:{total} 分 · 共 {count} 题",
"save": "保存试卷",
"saveSuccess": "试卷保存成功",
"saveFailed": "保存失败:{message}",
"notFound": "未找到试卷内容",
"propertiesTitle": "试卷属性",
"propExamId": "考试 ID",
"propTotalScore": "满分",
"propQuestionCount": "题目数量",
"propUpdatedAt": "最后更新",
"contractPending": "富文本编辑契约为 @contract-pending当前通过 MSW 兜底。后端补齐后切换为真实数据。",
"editorTitle": "试卷内容",
"toolbarBold": "加粗",
"toolbarItalic": "斜体",
"toolbarUnderline": "下划线",
"toolbarBulletList": "无序列表",
"toolbarOrderedList": "有序列表"
}
},
"homework": {