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

@@ -0,0 +1,24 @@
import { Suspense } from "react";
import { ExamAnalyticsClient } from "@/features/teacher/exams/exam-analytics-client";
import { DetailPageSkeleton } from "@/shared/components/page-templates";
/**
* 考试分析页ARCHITECTURE.md §7.3 详情页 / §9.1 / §10 P2
*
* Server Component 入口:仅负责 Suspense 边界包裹。
* 业务逻辑在 ExamAnalyticsClientclient component中。
*
* 数据契约:混合契约
* - 基础统计 ✅ assignmentAnalysisdata-ana 子图schema 已就绪)
* - 扩展字段(排名/每题正确率)❌ → MSW 兜底(@contract-pending
*
* 关联ARCHITECTURE.md §5.4 / §5.5 / §7.3 / §9.1 / §10 P2 / §11.3 / §11.4
*/
export default function ExamAnalyticsPage(): React.ReactElement {
return (
<Suspense fallback={<DetailPageSkeleton />}>
<ExamAnalyticsClient />
</Suspense>
);
}

View File

@@ -0,0 +1,25 @@
import { Suspense } from "react";
import { ExamBuildClient } from "@/features/teacher/exams/exam-build-client";
import { WorkbenchPageSkeleton } from "@/shared/components/page-templates";
/**
* 组卷工作台页ARCHITECTURE.md §7.3 工作台页 / §9.1 / §10 P2
*
* Server Component 入口:仅负责 Suspense 边界包裹。
* 业务逻辑在 ExamBuildClientclient component中。
*
* 数据契约:❌ @contract-pending
* - examBuild(examId) 根字段不存在 → MSW 兜底
* - questionsLibrary(filter) 根字段不存在 → MSW 兜底
* - saveExamBuild(input) mutation 不存在 → MSW 兜底
*
* 关联ARCHITECTURE.md §5.4 / §7.3 / §9.1 / §10 P2 / §11.3 / §11.4
*/
export default function ExamBuildPage(): React.ReactElement {
return (
<Suspense fallback={<WorkbenchPageSkeleton />}>
<ExamBuildClient />
</Suspense>
);
}

View File

@@ -0,0 +1,24 @@
import { Suspense } from "react";
import { ExamEditClient } from "@/features/teacher/exams/exam-edit-client";
import { WorkbenchPageSkeleton } from "@/shared/components/page-templates";
/**
* 富文本试卷编辑页ARCHITECTURE.md §7.3 工作台页 / §9.1 / §10 P2
*
* Server Component 入口:仅负责 Suspense 边界包裹。
* 业务逻辑在 ExamEditClientclient component中。
*
* 数据契约:❌ @contract-pending
* - examRichEditor(examId) 根字段不存在 → MSW 兜底
* - saveExamRichContent(input) mutation 不存在 → MSW 兜底
*
* 关联ARCHITECTURE.md §5.4 / §7.3 / §9.1 / §10 P2 / §11.3 / §11.4
*/
export default function ExamEditPage(): React.ReactElement {
return (
<Suspense fallback={<WorkbenchPageSkeleton />}>
<ExamEditClient />
</Suspense>
);
}