feat(portal-shell): 教师域考试管理页面迁移(P2)

按 ARCHITECTURE.md §9.1/§10 P2 要求,迁移教师域 exams 模块:
- 列表页 /shell/teacher/exams(ListPageShell + URL 状态 + 客户端二次筛选)
- 详情页 /shell/teacher/exams/[id](DetailPageShell + 真实 exam(id) 查询)
- 新建页 /shell/teacher/exams/new(FormPageShell + MSW 兜底)
- 纯函数 transformations.ts + 19 个 vitest 单测
- @contract-pending:exams(classId) 列表查询、createExam mutation 走 MSW
- 三态 UI(loading/error/empty)+ 路由级 loading.tsx/error.tsx
- i18n:zh-CN/en 双语补全,无硬编码中文
- MSW handlers 支持 variables 透传

§11.3 DoD 验收:
- lint: 0 errors(4 个 __generated__ 预存警告)
- typecheck: 0 errors
- test: 250/250 passed(含 19 个新增 transformations 测试)
- lint:tokens: 0 errors
This commit is contained in:
SpecialX
2026-07-22 17:02:05 +08:00
parent 843c3c0144
commit d066da563f
19 changed files with 1578 additions and 10 deletions

View File

@@ -146,7 +146,71 @@
"title": "Classes"
},
"exams": {
"title": "Exams"
"title": "Exams",
"list": {
"title": "Exams",
"description": "View and manage all exams",
"new": "New Exam",
"searchPlaceholder": "Search exam name...",
"statusFilter": "Filter by status",
"statusAll": "All statuses",
"statusDraft": "Draft",
"statusPublished": "Published",
"statusInProgress": "In Progress",
"statusScored": "Completed",
"total": "{count} total",
"colName": "Name",
"colStatus": "Status",
"colExamDate": "Exam Date",
"colDuration": "Duration",
"colTotalScore": "Total Score",
"colActions": "Actions",
"viewDetail": "View Detail →",
"mswNotice": "List query contract is pending, please ensure NEXT_PUBLIC_MSW=1 is enabled.",
"unitScore": "pts"
},
"detail": {
"title": "Exam Detail",
"edit": "Edit",
"notFound": "Exam not found, may have been deleted",
"createdAtPrefix": "Created on {date}",
"sectionBasic": "Basic Info",
"sectionStatus": "Status Info",
"fieldTitle": "Title",
"fieldDescription": "Description",
"fieldExamDate": "Exam Date",
"fieldDuration": "Duration",
"fieldTotalScore": "Total Score",
"fieldClassId": "Class ID",
"fieldSubjectId": "Subject ID",
"fieldCurrentStatus": "Current Status",
"fieldStatusChangedAt": "Status Changed At",
"fieldStatusChangedBy": "Status Changed By",
"fieldCreatedBy": "Created By",
"fieldCreatedAt": "Created At",
"fieldUpdatedAt": "Updated At",
"unitScore": "pts"
},
"new": {
"title": "New Exam",
"description": "Fill in exam basic information",
"submit": "Create Exam",
"success": "Exam created successfully",
"error": "Creation failed",
"classId": "Class ID",
"subjectId": "Subject ID",
"titleLabel": "Title",
"titlePlaceholder": "e.g. 2026 Spring Midterm",
"descriptionLabel": "Description",
"descriptionPlaceholder": "Exam scope, notes, etc.",
"examDate": "Exam Date",
"duration": "Duration (minutes)",
"totalScore": "Total Score",
"errorClassRequired": "Please fill in Class ID",
"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."
}
},
"homework": {
"title": "Homework"

View File

@@ -146,7 +146,71 @@
"title": "班级管理"
},
"exams": {
"title": "考试管理"
"title": "考试管理",
"list": {
"title": "考试管理",
"description": "查看和管理所有考试",
"new": "新建考试",
"searchPlaceholder": "搜索考试名称...",
"statusFilter": "按状态筛选",
"statusAll": "全部状态",
"statusDraft": "草稿",
"statusPublished": "已发布",
"statusInProgress": "进行中",
"statusScored": "已完成",
"total": "共 {count} 条",
"colName": "名称",
"colStatus": "状态",
"colExamDate": "考试时间",
"colDuration": "时长",
"colTotalScore": "满分",
"colActions": "操作",
"viewDetail": "查看详情 →",
"mswNotice": "列表查询契约待补齐,请确认 NEXT_PUBLIC_MSW=1 已启用。",
"unitScore": "分"
},
"detail": {
"title": "考试详情",
"edit": "编辑",
"notFound": "未找到考试,可能已被删除",
"createdAtPrefix": "创建于 {date}",
"sectionBasic": "基本信息",
"sectionStatus": "状态信息",
"fieldTitle": "标题",
"fieldDescription": "描述",
"fieldExamDate": "考试时间",
"fieldDuration": "时长",
"fieldTotalScore": "满分",
"fieldClassId": "班级 ID",
"fieldSubjectId": "科目 ID",
"fieldCurrentStatus": "当前状态",
"fieldStatusChangedAt": "状态变更时间",
"fieldStatusChangedBy": "状态变更人",
"fieldCreatedBy": "创建人",
"fieldCreatedAt": "创建时间",
"fieldUpdatedAt": "更新时间",
"unitScore": "分"
},
"new": {
"title": "新建考试",
"description": "填写考试基本信息",
"submit": "创建考试",
"success": "考试创建成功",
"error": "创建失败",
"classId": "班级 ID",
"subjectId": "科目 ID",
"titleLabel": "标题",
"titlePlaceholder": "例如2026 春季期中考试",
"descriptionLabel": "描述",
"descriptionPlaceholder": "考试范围、注意事项等",
"examDate": "考试日期",
"duration": "时长(分钟)",
"totalScore": "满分",
"errorClassRequired": "请填写班级 ID",
"errorTitleRequired": "请填写考试标题",
"errorDateRequired": "请选择考试日期",
"contractPending": "创建考试契约为 @contract-pending当前通过 MSW 兜底。后端补齐 mutation 后将切换为真实提交。"
}
},
"homework": {
"title": "作业管理"