refactor(lesson-preparation): V2 审计深度修复 — Server Actions i18n + 错误码模式 + 类型断言清零 + a11y 深度修复 + Tracker 埋点接入
V2-1: 12 个 Server Action 通过 getTranslations 翻译错误消息;Service/DataAccess 层抛出错误码异常(PublishServiceError/LessonPlanDataError),Actions 层通过 PUBLISH_ERROR_KEY_MAP 翻译为 i18n 消息 V2-2: SYSTEM_TEMPLATES name/title 改为 i18n 键,createLessonPlan 接受 translateTitle 函数在服务端翻译后存储到 DB V2-3: 8 处 as unknown as 断言替换为显式类型映射函数(mapRowToLessonPlan/mapRowToListItem/mapRowToTemplate/mapRowToVersion)+ 类型守卫(isLessonPlanStatus/isTemplateType/isTemplateScope) V2-4: MiniMap nodeColor 复用 lib/node-summary.ts 的 getNodeColor V2-5: a11y 深度修复 — lesson-plan-filters/exercise-block/inline-question-editor 的 select 添加 label htmlFor 关联;exercise-block 题目列表改为 ul/li;node-editor 画布添加 role=application + 键盘导航配置 V2-6: Tracker 埋点接入 — 新增 useLessonPlanTrackerSafe hook,在 create/save/publish/revert/duplicate/archive 6 处调用 tracker.track 同步更新架构图 004 和 005 文档
This commit is contained in:
@@ -36,9 +36,11 @@ export const RICH_TEXT_BLOCK_TYPES: BlockType[] = [
|
||||
];
|
||||
|
||||
// 系统预设模板骨架(seed 用)
|
||||
// V2-2 修复:title/hint 存储 i18n 键,由 createLessonPlan 调用 getTranslations 翻译
|
||||
// 键格式:`template.blocks.${templateId}.${blockIndex}.title` 或 `blockType.${type}`(默认)
|
||||
export interface SystemTemplateDef {
|
||||
id: string; // 固定 ID,便于幂等
|
||||
name: string;
|
||||
name: string; // i18n 键:template.names.${id}
|
||||
scope: TemplateScope;
|
||||
blocks: TemplateBlockSkeleton[];
|
||||
}
|
||||
@@ -46,60 +48,60 @@ export interface SystemTemplateDef {
|
||||
export const SYSTEM_TEMPLATES: SystemTemplateDef[] = [
|
||||
{
|
||||
id: "tpl_regular",
|
||||
name: "常规课",
|
||||
name: "tpl_regular", // i18n 键
|
||||
scope: "regular",
|
||||
blocks: [
|
||||
{ type: "objective", title: "教学目标", hint: "明确本课的知识、能力、情感目标" },
|
||||
{ type: "key_point", title: "教学重难点", hint: "标注重点与难点及突破策略" },
|
||||
{ type: "import", title: "导入", hint: "情境导入/复习导入/问题导入" },
|
||||
{ type: "new_teaching", title: "新授", hint: "核心教学活动设计" },
|
||||
{ type: "consolidation", title: "巩固练习", hint: "课堂练习,检验学习效果" },
|
||||
{ type: "summary", title: "课堂小结", hint: "归纳本课要点" },
|
||||
{ type: "homework", title: "作业布置", hint: "课后作业说明(如需下发请用练习块)" },
|
||||
{ type: "blackboard", title: "板书设计", hint: "板书结构示意" },
|
||||
{ type: "objective", title: "blockType.objective" },
|
||||
{ type: "key_point", title: "blockType.key_point" },
|
||||
{ type: "import", title: "blockType.import" },
|
||||
{ type: "new_teaching", title: "blockType.new_teaching" },
|
||||
{ type: "consolidation", title: "blockType.consolidation" },
|
||||
{ type: "summary", title: "blockType.summary" },
|
||||
{ type: "homework", title: "blockType.homework" },
|
||||
{ type: "blackboard", title: "blockType.blackboard" },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "tpl_review",
|
||||
name: "复习课",
|
||||
name: "tpl_review",
|
||||
scope: "review",
|
||||
blocks: [
|
||||
{ type: "objective", title: "复习目标" },
|
||||
{ type: "rich_text", title: "知识网络梳理", hint: "构建知识结构图" },
|
||||
{ type: "rich_text", title: "典型例题精讲" },
|
||||
{ type: "rich_text", title: "变式训练" },
|
||||
{ type: "exercise", title: "当堂检测", hint: "purpose 选 class_practice" },
|
||||
{ type: "summary", title: "课堂小结" },
|
||||
{ type: "objective", title: "blockType.objective" },
|
||||
{ type: "rich_text", title: "template.blocks.tpl_review.1" },
|
||||
{ type: "rich_text", title: "template.blocks.tpl_review.2" },
|
||||
{ type: "rich_text", title: "template.blocks.tpl_review.3" },
|
||||
{ type: "exercise", title: "blockType.exercise" },
|
||||
{ type: "summary", title: "blockType.summary" },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "tpl_experiment",
|
||||
name: "实验课",
|
||||
name: "tpl_experiment",
|
||||
scope: "experiment",
|
||||
blocks: [
|
||||
{ type: "objective", title: "实验目的" },
|
||||
{ type: "rich_text", title: "器材准备" },
|
||||
{ type: "rich_text", title: "实验步骤" },
|
||||
{ type: "rich_text", title: "观察记录表" },
|
||||
{ type: "rich_text", title: "交流讨论" },
|
||||
{ type: "summary", title: "课堂小结" },
|
||||
{ type: "objective", title: "blockType.objective" },
|
||||
{ type: "rich_text", title: "template.blocks.tpl_experiment.1" },
|
||||
{ type: "rich_text", title: "template.blocks.tpl_experiment.2" },
|
||||
{ type: "rich_text", title: "template.blocks.tpl_experiment.3" },
|
||||
{ type: "rich_text", title: "template.blocks.tpl_experiment.4" },
|
||||
{ type: "summary", title: "blockType.summary" },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "tpl_inquiry",
|
||||
name: "探究课",
|
||||
name: "tpl_inquiry",
|
||||
scope: "inquiry",
|
||||
blocks: [
|
||||
{ type: "rich_text", title: "情境导入" },
|
||||
{ type: "rich_text", title: "问题驱动" },
|
||||
{ type: "rich_text", title: "小组探究" },
|
||||
{ type: "rich_text", title: "成果展示" },
|
||||
{ type: "rich_text", title: "归纳提升" },
|
||||
{ type: "rich_text", title: "template.blocks.tpl_inquiry.0" },
|
||||
{ type: "rich_text", title: "template.blocks.tpl_inquiry.1" },
|
||||
{ type: "rich_text", title: "template.blocks.tpl_inquiry.2" },
|
||||
{ type: "rich_text", title: "template.blocks.tpl_inquiry.3" },
|
||||
{ type: "rich_text", title: "template.blocks.tpl_inquiry.4" },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "tpl_blank",
|
||||
name: "空白模板",
|
||||
name: "tpl_blank",
|
||||
scope: "blank",
|
||||
blocks: [],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user