后端: - 添加 position_x, position_y 字段保存节点位置 前端: - 支持从节点右侧圆点拖拽出箭头连接到其他课程 - 自动根据节点Y坐标识别所属阶段 - 保存并恢复节点位置,不再重置 - 阶段区域高亮显示 - 循环依赖检测 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -86,6 +86,14 @@ class GrowthPathNode(BaseModel, SoftDeleteMixin):
|
||||
estimated_days: Mapped[int] = mapped_column(
|
||||
Integer, default=7, nullable=False, comment="预计学习天数"
|
||||
)
|
||||
|
||||
# 画布位置(用于可视化编辑器)
|
||||
position_x: Mapped[Optional[int]] = mapped_column(
|
||||
Integer, nullable=True, default=0, comment="画布X坐标"
|
||||
)
|
||||
position_y: Mapped[Optional[int]] = mapped_column(
|
||||
Integer, nullable=True, default=0, comment="画布Y坐标"
|
||||
)
|
||||
|
||||
# 关联关系
|
||||
growth_path: Mapped["GrowthPath"] = relationship( # noqa: F821
|
||||
|
||||
@@ -28,6 +28,8 @@ class NodeBase(BaseModel):
|
||||
is_required: bool = Field(True, description="是否必修")
|
||||
prerequisites: Optional[List[int]] = Field(None, description="前置节点IDs")
|
||||
estimated_days: int = Field(7, description="预计学习天数")
|
||||
position_x: Optional[int] = Field(0, description="画布X坐标")
|
||||
position_y: Optional[int] = Field(0, description="画布Y坐标")
|
||||
|
||||
|
||||
# =====================================================
|
||||
|
||||
Reference in New Issue
Block a user