feat(lesson-preparation): 备课模块审计重构 — 跨模块解耦 + i18n + 纯函数抽取 + 错误边界
P0-1 跨模块直查修复:publish-service 不再直查 examQuestions 表,新增 exams/data-access.addExamQuestions 接口,复用 classes/data-access.getStudentIdsByClassIds P0-2 i18n 接入:新增 zh-CN/en 翻译文件,注册 lessonPreparation 命名空间,17 个组件改造为 useTranslations/getTranslations P1 纯函数抽取:lib/document-migration.ts(类型守卫替代 as 断言)、lib/node-summary.ts(翻译函数注入)、lib/rf-mappers.ts P1 错误边界+骨架屏:新增 LessonPlanErrorBoundary 和 4 个 Skeleton 组件 P1 Block 注册表:新增 config/block-registry.tsx(BlockRenderer 组件),node-edit-panel 重构为配置驱动渲染 P1 其他修复:exercise-block 改用 router.refresh(),node-editor/lesson-node 复用 lib/ 纯函数 架构图同步:更新 004 和 005 文档 Refs: docs/architecture/audit/lesson-preparation-audit-report.md
This commit is contained in:
198
src/shared/i18n/messages/en/lesson-preparation.json
Normal file
198
src/shared/i18n/messages/en/lesson-preparation.json
Normal file
@@ -0,0 +1,198 @@
|
||||
{
|
||||
"title": {
|
||||
"list": "My Lesson Plans",
|
||||
"new": "New Lesson Plan",
|
||||
"edit": "Edit Lesson Plan"
|
||||
},
|
||||
"description": {
|
||||
"list": "Manage your lesson preparation and teaching plans."
|
||||
},
|
||||
"action": {
|
||||
"new": "New Lesson Plan",
|
||||
"back": "Back to Lesson Plans",
|
||||
"addNode": "Add Node",
|
||||
"saveVersion": "Save Version",
|
||||
"versions": "Versions",
|
||||
"duplicate": "Duplicate",
|
||||
"archive": "Archive",
|
||||
"delete": "Delete Node",
|
||||
"close": "Close",
|
||||
"cancel": "Cancel",
|
||||
"confirm": "Confirm",
|
||||
"create": "Create Lesson Plan",
|
||||
"publish": "Publish as Homework",
|
||||
"viewHomework": "View"
|
||||
},
|
||||
"status": {
|
||||
"saving": "Saving...",
|
||||
"unsaved": "Unsaved",
|
||||
"saved": "Saved",
|
||||
"draft": "Draft",
|
||||
"published": "Published",
|
||||
"archived": "Archived",
|
||||
"publishedAsHomework": "Published as Homework"
|
||||
},
|
||||
"blockType": {
|
||||
"objective": "Objective",
|
||||
"key_point": "Key Points",
|
||||
"import": "Introduction",
|
||||
"new_teaching": "New Teaching",
|
||||
"consolidation": "Consolidation",
|
||||
"summary": "Summary",
|
||||
"homework": "Homework",
|
||||
"blackboard": "Blackboard Design",
|
||||
"text_study": "Text Study",
|
||||
"exercise": "Exercise",
|
||||
"rich_text": "Custom Section",
|
||||
"reflection": "Reflection"
|
||||
},
|
||||
"template": {
|
||||
"regular": "Regular Lesson",
|
||||
"review": "Review Lesson",
|
||||
"experiment": "Experiment Lesson",
|
||||
"inquiry": "Inquiry Lesson",
|
||||
"blank": "Blank Template",
|
||||
"selectLabel": "Select Template",
|
||||
"titleLabel": "Lesson Plan Title",
|
||||
"titlePlaceholder": "e.g., Autumn - Lesson 1",
|
||||
"blockCount": "{count} sections",
|
||||
"blankHint": "Start from scratch"
|
||||
},
|
||||
"editor": {
|
||||
"canvasEmpty": "Canvas is empty",
|
||||
"canvasEmptyHint": "Click \"Add Node\" at the bottom left to start",
|
||||
"selectNodeHint": "Click a node to edit content, or drag to connect",
|
||||
"unknownBlockType": "Unknown node type",
|
||||
"nodeSummaryEmpty": "Empty",
|
||||
"questionCount": "{count} questions",
|
||||
"charCount": "{count} chars"
|
||||
},
|
||||
"filters": {
|
||||
"searchPlaceholder": "Search title...",
|
||||
"allSubjects": "All Subjects",
|
||||
"allStatus": "All Status"
|
||||
},
|
||||
"list": {
|
||||
"empty": "No lesson plans. Click \"New Lesson Plan\" to start",
|
||||
"noTextbook": "No textbook",
|
||||
"noChapter": "No chapter",
|
||||
"noTemplate": "No template",
|
||||
"lastSaved": "Last saved: ",
|
||||
"neverSaved": "Never saved"
|
||||
},
|
||||
"version": {
|
||||
"title": "Version History",
|
||||
"empty": "No versions",
|
||||
"loading": "Loading...",
|
||||
"auto": "Auto",
|
||||
"manual": "Manual save",
|
||||
"revert": "Revert to this version",
|
||||
"revertConfirm": "Revert to v{versionNo}? A new version will be created.",
|
||||
"autoLabel": "Auto version"
|
||||
},
|
||||
"knowledgePoint": {
|
||||
"title": "Select Knowledge Points",
|
||||
"empty": "No knowledge points found. Please create them in the textbook module first.",
|
||||
"linked": "Linked to {count} knowledge points",
|
||||
"annotate": "Annotate Knowledge Points",
|
||||
"select": "Select Knowledge Points",
|
||||
"selected": "{count} selected"
|
||||
},
|
||||
"questionBank": {
|
||||
"title": "Select Questions from Bank",
|
||||
"add": "Add",
|
||||
"insert": "Insert",
|
||||
"selected": "{count} questions selected",
|
||||
"source": {
|
||||
"bank": "Bank",
|
||||
"inline": "New"
|
||||
},
|
||||
"inlineTitle": "New Question (in lesson plan)",
|
||||
"inlineNew": "New Question",
|
||||
"fromBank": "Add from Bank",
|
||||
"score": "{score} pts",
|
||||
"difficulty": "{level} star",
|
||||
"empty": "No questions. Click the button below to add",
|
||||
"inlineQuestion": "New question in lesson plan",
|
||||
"questionId": "Question {id}",
|
||||
"type": {
|
||||
"single_choice": "Single Choice",
|
||||
"text": "Fill in Blank",
|
||||
"judgment": "True/False"
|
||||
},
|
||||
"typeLabel": "Question Type",
|
||||
"stemLabel": "Question Stem",
|
||||
"optionsLabel": "Options (check correct answer)",
|
||||
"addOption": "+ Add Option",
|
||||
"correctAnswer": "Correct Answer",
|
||||
"correct": "True",
|
||||
"incorrect": "False",
|
||||
"difficultyLabel": "Difficulty",
|
||||
"knowledgePointLabel": "Knowledge Points",
|
||||
"stemRequired": "Please enter the question stem",
|
||||
"addBtn": "Add"
|
||||
},
|
||||
"exercise": {
|
||||
"purpose": {
|
||||
"class_practice": "Class Practice",
|
||||
"after_class_homework": "After-class Homework"
|
||||
}
|
||||
},
|
||||
"publish": {
|
||||
"title": "Publish as Homework",
|
||||
"classLabel": "Target Classes",
|
||||
"availableAtLabel": "Available At (optional)",
|
||||
"dueAtLabel": "Due At (optional)",
|
||||
"publishing": "Publishing...",
|
||||
"publish": "Publish",
|
||||
"selectClass": "Please select at least one class",
|
||||
"noStudents": "No students in selected classes",
|
||||
"noSubjectOrGrade": "Lesson plan missing subject or grade info",
|
||||
"alreadyPublished": "This exercise block is already published. Use 'Republish'",
|
||||
"noExerciseBlock": "Exercise block not found",
|
||||
"noQuestions": "No questions in exercise block",
|
||||
"planNotFound": "Lesson plan not found",
|
||||
"noPermission": "No permission to publish"
|
||||
},
|
||||
"textStudy": {
|
||||
"sourceTextLabel": "Source Text",
|
||||
"sourceTextPlaceholder": "Paste source text, select text to add annotations",
|
||||
"addAnnotation": "Add Annotation for Selection",
|
||||
"selectFirst": "Please select text first",
|
||||
"annotationTitle": "Teaching Node",
|
||||
"annotationNotePlaceholder": "Teaching notes..."
|
||||
},
|
||||
"reflection": {
|
||||
"hint": "Write teaching reflection after class..."
|
||||
},
|
||||
"richText": {
|
||||
"placeholder": "Enter content..."
|
||||
},
|
||||
"error": {
|
||||
"getList": "Failed to get lesson plan list",
|
||||
"getOne": "Failed to get lesson plan",
|
||||
"create": "Failed to create lesson plan",
|
||||
"save": "Failed to save",
|
||||
"saveVersion": "Failed to save version",
|
||||
"getVersions": "Failed to get versions",
|
||||
"revert": "Failed to revert",
|
||||
"delete": "Failed to delete",
|
||||
"duplicate": "Failed to duplicate",
|
||||
"getTemplates": "Failed to get templates",
|
||||
"saveTemplate": "Failed to save template",
|
||||
"deleteTemplate": "Failed to delete template",
|
||||
"publish": "Failed to publish",
|
||||
"aiSuggest": "AI suggestion failed. Please check AI Provider config",
|
||||
"loadKnowledgePoints": "Failed to load knowledge points",
|
||||
"notFound": "Lesson plan not found or no access",
|
||||
"versionNotFound": "Version not found or no permission",
|
||||
"templateNotFound": "Template not found",
|
||||
"createFailed": "Creation failed",
|
||||
"loadFailed": "Page load failed",
|
||||
"loadFailedDesc": "Sorry, an unexpected error occurred. Please try again later.",
|
||||
"retry": "Retry"
|
||||
},
|
||||
"confirm": {
|
||||
"archive": "Archive this lesson plan?"
|
||||
}
|
||||
}
|
||||
198
src/shared/i18n/messages/zh-CN/lesson-preparation.json
Normal file
198
src/shared/i18n/messages/zh-CN/lesson-preparation.json
Normal file
@@ -0,0 +1,198 @@
|
||||
{
|
||||
"title": {
|
||||
"list": "我的备课",
|
||||
"new": "新建课案",
|
||||
"edit": "编辑课案"
|
||||
},
|
||||
"description": {
|
||||
"list": "管理备课和教学计划。"
|
||||
},
|
||||
"action": {
|
||||
"new": "新建课案",
|
||||
"back": "返回备课列表",
|
||||
"addNode": "添加节点",
|
||||
"saveVersion": "保存版本",
|
||||
"versions": "版本",
|
||||
"duplicate": "复制",
|
||||
"archive": "归档",
|
||||
"delete": "删除此节点",
|
||||
"close": "关闭",
|
||||
"cancel": "取消",
|
||||
"confirm": "确认",
|
||||
"create": "创建课案",
|
||||
"publish": "发布为作业",
|
||||
"viewHomework": "查看"
|
||||
},
|
||||
"status": {
|
||||
"saving": "保存中...",
|
||||
"unsaved": "未保存",
|
||||
"saved": "已保存",
|
||||
"draft": "草稿",
|
||||
"published": "已发布",
|
||||
"archived": "已归档",
|
||||
"publishedAsHomework": "已发布为作业"
|
||||
},
|
||||
"blockType": {
|
||||
"objective": "教学目标",
|
||||
"key_point": "教学重难点",
|
||||
"import": "导入",
|
||||
"new_teaching": "新授",
|
||||
"consolidation": "巩固练习",
|
||||
"summary": "课堂小结",
|
||||
"homework": "作业布置",
|
||||
"blackboard": "板书设计",
|
||||
"text_study": "文本研习",
|
||||
"exercise": "练习/作业",
|
||||
"rich_text": "自定义环节",
|
||||
"reflection": "教学反思"
|
||||
},
|
||||
"template": {
|
||||
"regular": "常规课",
|
||||
"review": "复习课",
|
||||
"experiment": "实验课",
|
||||
"inquiry": "探究课",
|
||||
"blank": "空白模板",
|
||||
"selectLabel": "选择模板",
|
||||
"titleLabel": "课案标题",
|
||||
"titlePlaceholder": "例如:《秋天》第一课时",
|
||||
"blockCount": "{count} 个环节",
|
||||
"blankHint": "从空白开始"
|
||||
},
|
||||
"editor": {
|
||||
"canvasEmpty": "画布为空",
|
||||
"canvasEmptyHint": "点击左下角\"添加节点\"开始备课",
|
||||
"selectNodeHint": "点击节点编辑内容,或拖拽连线建立流程",
|
||||
"unknownBlockType": "未知节点类型",
|
||||
"nodeSummaryEmpty": "空",
|
||||
"questionCount": "{count} 道题",
|
||||
"charCount": "{count} 字"
|
||||
},
|
||||
"filters": {
|
||||
"searchPlaceholder": "搜索标题...",
|
||||
"allSubjects": "全部学科",
|
||||
"allStatus": "全部状态"
|
||||
},
|
||||
"list": {
|
||||
"empty": "暂无课案,点击\"新建课案\"开始",
|
||||
"noTextbook": "无教材",
|
||||
"noChapter": "无章节",
|
||||
"noTemplate": "无模板",
|
||||
"lastSaved": "最后保存:",
|
||||
"neverSaved": "未保存"
|
||||
},
|
||||
"version": {
|
||||
"title": "版本历史",
|
||||
"empty": "暂无版本",
|
||||
"loading": "加载中...",
|
||||
"auto": "自动",
|
||||
"manual": "手动保存",
|
||||
"revert": "回退到此版本",
|
||||
"revertConfirm": "确认回退到 v{versionNo}?将生成新版本。",
|
||||
"autoLabel": "自动版本"
|
||||
},
|
||||
"knowledgePoint": {
|
||||
"title": "选择知识点",
|
||||
"empty": "未找到知识点,请先在教材模块创建",
|
||||
"linked": "已关联 {count} 个知识点",
|
||||
"annotate": "标注知识点",
|
||||
"select": "选择知识点",
|
||||
"selected": "已选 {count} 个"
|
||||
},
|
||||
"questionBank": {
|
||||
"title": "从题库选择题目",
|
||||
"add": "添加",
|
||||
"insert": "插入",
|
||||
"selected": "已选 {count} 题",
|
||||
"source": {
|
||||
"bank": "题库",
|
||||
"inline": "新建"
|
||||
},
|
||||
"inlineTitle": "课案内新建题目",
|
||||
"inlineNew": "新建题目",
|
||||
"fromBank": "从题库添加",
|
||||
"score": "{score}分",
|
||||
"difficulty": "{level}星",
|
||||
"empty": "暂无题目,点击下方按钮添加",
|
||||
"inlineQuestion": "课案内新建题目",
|
||||
"questionId": "题目 {id}",
|
||||
"type": {
|
||||
"single_choice": "单选题",
|
||||
"text": "填空题",
|
||||
"judgment": "判断题"
|
||||
},
|
||||
"typeLabel": "题型",
|
||||
"stemLabel": "题干",
|
||||
"optionsLabel": "选项(勾选正确答案)",
|
||||
"addOption": "+ 添加选项",
|
||||
"correctAnswer": "正确答案",
|
||||
"correct": "正确",
|
||||
"incorrect": "错误",
|
||||
"difficultyLabel": "难度",
|
||||
"knowledgePointLabel": "知识点",
|
||||
"stemRequired": "请输入题干",
|
||||
"addBtn": "添加"
|
||||
},
|
||||
"exercise": {
|
||||
"purpose": {
|
||||
"class_practice": "课堂练习",
|
||||
"after_class_homework": "课后作业"
|
||||
}
|
||||
},
|
||||
"publish": {
|
||||
"title": "发布为作业",
|
||||
"classLabel": "下发班级",
|
||||
"availableAtLabel": "开始时间(可选)",
|
||||
"dueAtLabel": "截止时间(可选)",
|
||||
"publishing": "发布中...",
|
||||
"publish": "发布",
|
||||
"selectClass": "请选择至少一个班级",
|
||||
"noStudents": "所选班级无学生",
|
||||
"noSubjectOrGrade": "课案缺少学科或年级信息,无法发布",
|
||||
"alreadyPublished": "该练习块已发布,请使用'重新发布'",
|
||||
"noExerciseBlock": "练习块不存在",
|
||||
"noQuestions": "练习块无题目",
|
||||
"planNotFound": "课案不存在",
|
||||
"noPermission": "无权发布"
|
||||
},
|
||||
"textStudy": {
|
||||
"sourceTextLabel": "课文原文",
|
||||
"sourceTextPlaceholder": "粘贴课文原文,选中文本后可添加教学节点",
|
||||
"addAnnotation": "为选中文本添加节点",
|
||||
"selectFirst": "请先在课文中选中一段文本",
|
||||
"annotationTitle": "教学节点",
|
||||
"annotationNotePlaceholder": "教学说明..."
|
||||
},
|
||||
"reflection": {
|
||||
"hint": "课后填写教学反思..."
|
||||
},
|
||||
"richText": {
|
||||
"placeholder": "输入内容..."
|
||||
},
|
||||
"error": {
|
||||
"getList": "获取课案列表失败",
|
||||
"getOne": "获取课案失败",
|
||||
"create": "创建课案失败",
|
||||
"save": "保存失败",
|
||||
"saveVersion": "保存版本失败",
|
||||
"getVersions": "获取版本失败",
|
||||
"revert": "回退失败",
|
||||
"delete": "删除失败",
|
||||
"duplicate": "复制失败",
|
||||
"getTemplates": "获取模板失败",
|
||||
"saveTemplate": "保存模板失败",
|
||||
"deleteTemplate": "删除模板失败",
|
||||
"publish": "发布失败",
|
||||
"aiSuggest": "AI 推荐失败,请检查 AI Provider 配置",
|
||||
"loadKnowledgePoints": "加载知识点失败",
|
||||
"notFound": "课案不存在或无权访问",
|
||||
"versionNotFound": "版本不存在或无权操作",
|
||||
"templateNotFound": "模板不存在",
|
||||
"createFailed": "创建失败",
|
||||
"loadFailed": "页面加载失败",
|
||||
"loadFailedDesc": "抱歉,页面加载时发生了意外错误。请稍后重试。",
|
||||
"retry": "重试"
|
||||
},
|
||||
"confirm": {
|
||||
"archive": "确认归档此课案?"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user