feat(lesson-preparation): V4 类型定义(interaction + QATurn + V4 文档)
This commit is contained in:
@@ -57,7 +57,8 @@ export type BlockType =
|
|||||||
| "text_study"
|
| "text_study"
|
||||||
| "exercise"
|
| "exercise"
|
||||||
| "rich_text"
|
| "rich_text"
|
||||||
| "reflection";
|
| "reflection"
|
||||||
|
| "interaction"; // V4 新增:师生交互
|
||||||
|
|
||||||
// 正文节点类型(特殊:不可拖动,画布中央)
|
// 正文节点类型(特殊:不可拖动,画布中央)
|
||||||
export type TextbookContentNodeType = "textbook_content";
|
export type TextbookContentNodeType = "textbook_content";
|
||||||
@@ -208,6 +209,26 @@ export interface ReflectionBlockData {
|
|||||||
reflection: ReflectionItem[];
|
reflection: ReflectionItem[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// V4 师生交互
|
||||||
|
export interface QATurn {
|
||||||
|
id: string;
|
||||||
|
role: "teacher" | "student";
|
||||||
|
content: string;
|
||||||
|
/** 教师提问的预期答案 / 引导策略(可选)*/
|
||||||
|
expectedAnswer?: string;
|
||||||
|
/** 这一轮的顺序 */
|
||||||
|
order: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface InteractionBlockData {
|
||||||
|
/** 设计意图 */
|
||||||
|
designIntent: string;
|
||||||
|
/** 对话轮次 */
|
||||||
|
turns: QATurn[];
|
||||||
|
/** 关联知识点 */
|
||||||
|
knowledgePointIds: string[];
|
||||||
|
}
|
||||||
|
|
||||||
// 正文节点数据
|
// 正文节点数据
|
||||||
export interface TextbookContentNodeData {
|
export interface TextbookContentNodeData {
|
||||||
chapterId: string;
|
chapterId: string;
|
||||||
@@ -227,7 +248,8 @@ export type BlockData =
|
|||||||
| SummaryBlockData
|
| SummaryBlockData
|
||||||
| HomeworkBlockData
|
| HomeworkBlockData
|
||||||
| BlackboardBlockData
|
| BlackboardBlockData
|
||||||
| ReflectionBlockData;
|
| ReflectionBlockData
|
||||||
|
| InteractionBlockData; // V4 新增
|
||||||
|
|
||||||
// V5-15 T1:教学阶段(用于画布节点分组与可视化排序)
|
// V5-15 T1:教学阶段(用于画布节点分组与可视化排序)
|
||||||
// - import: 导入环节
|
// - import: 导入环节
|
||||||
@@ -284,14 +306,20 @@ export type AnyLessonPlanNode = LessonPlanNode | TextbookContentNode;
|
|||||||
// ---- 锚点 ----
|
// ---- 锚点 ----
|
||||||
export type AnchorType = "range" | "point";
|
export type AnchorType = "range" | "point";
|
||||||
|
|
||||||
|
// V4:NodeAnchor 简化(start/end/textPreview/invalid 字段标记为弃用)
|
||||||
|
// 旧 v3 字段保留用于迁移识别,新代码不应读取
|
||||||
export interface NodeAnchor {
|
export interface NodeAnchor {
|
||||||
id: string;
|
id: string;
|
||||||
nodeId: string; // 关联的教学节点 ID
|
nodeId: string; // 关联的教学节点 ID
|
||||||
type: AnchorType;
|
type: AnchorType;
|
||||||
start: number; // 正文纯文本偏移量
|
/** @deprecated v3 字符串偏移,v4 改用 Tiptap Mark,不再使用 */
|
||||||
end?: number; // range 锚定的结束偏移
|
start?: number;
|
||||||
textPreview?: string; // range 锚定的文字预览(用于失效重定位)
|
/** @deprecated v3 字符串偏移 */
|
||||||
invalid?: boolean; // 正文变更后无法重定位时标记为失效
|
end?: number;
|
||||||
|
/** @deprecated v3 文字预览 */
|
||||||
|
textPreview?: string;
|
||||||
|
/** @deprecated v3 失效标记 */
|
||||||
|
invalid?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- 边 ----
|
// ---- 边 ----
|
||||||
@@ -335,7 +363,7 @@ export interface LessonPlanDocumentV2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// v3(课文锚点画布格式)
|
// v3(课文锚点画布格式)
|
||||||
export interface LessonPlanDocument {
|
export interface LessonPlanDocumentV3 {
|
||||||
version: 3;
|
version: 3;
|
||||||
textbookContentNodeId: string;
|
textbookContentNodeId: string;
|
||||||
nodes: AnyLessonPlanNode[];
|
nodes: AnyLessonPlanNode[];
|
||||||
@@ -343,6 +371,20 @@ export interface LessonPlanDocument {
|
|||||||
anchors: NodeAnchor[];
|
anchors: NodeAnchor[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// v4(纸感锚点格式:Tiptap Mark 内嵌)
|
||||||
|
export interface LessonPlanDocumentV4 {
|
||||||
|
version: 4;
|
||||||
|
textbookContentNodeId: string;
|
||||||
|
nodes: AnyLessonPlanNode[];
|
||||||
|
edges: AnyLessonPlanEdge[]; // 保留但不再用于画布连线
|
||||||
|
anchors: NodeAnchor[]; // 简化:只存 id 关联
|
||||||
|
/** V4 新增:节点展开状态 */
|
||||||
|
expandedNodeIds: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 当前文档版本(v4)
|
||||||
|
export type LessonPlanDocument = LessonPlanDocumentV4;
|
||||||
|
|
||||||
// 课案
|
// 课案
|
||||||
export interface LessonPlan {
|
export interface LessonPlan {
|
||||||
id: string;
|
id: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user