feat: v1.4.0 - 典型方案采纳、推荐方案列表、审计字段、导航优化

- 添加典型方案采纳功能 (POST /api/plans/<id>/adopt)
- 添加推荐方案列表 (GET /api/students/<id>/recommended-plans)
- PracticePlan 新增 created_by/updated_by/updated_at 审计字段
- 方案编辑/详情页导航优化 (bfcache 处理、pageshow 事件)
- 方案列表支持删除功能
- 学员列表'暂无方案/问题'样式统一
- 更新文档:问题文件已废弃(迁移到数据库)
- 更新部署脚本和验证清单
This commit is contained in:
hmo
2026-04-27 02:01:22 +08:00
parent 6abdd49c04
commit e50a9207b4
20 changed files with 873 additions and 88 deletions
+14
View File
@@ -340,10 +340,15 @@ class PracticePlan(db.Model):
template_id = db.Column(db.Integer, db.ForeignKey("templates.id"), nullable=True) # 使用的AI提示词模板
is_typical = db.Column(db.Boolean, default=False, nullable=False) # 是否为典型方案
content = db.Column(db.Text, nullable=False) # JSON格式存储方案内容
created_by = db.Column(db.Integer, db.ForeignKey("users.id"), nullable=True) # 创建人
created_at = db.Column(db.DateTime, default=datetime.now)
updated_by = db.Column(db.Integer, db.ForeignKey("users.id"), nullable=True) # 更新人
updated_at = db.Column(db.DateTime, nullable=True) # 更新人,只在更新时设置
# 关联
template = db.relationship("Template", foreign_keys=[template_id])
creator = db.relationship("User", foreign_keys=[created_by])
updater = db.relationship("User", foreign_keys=[updated_by])
def to_dict(self):
import json as json_module
@@ -370,6 +375,9 @@ class PracticePlan(db.Model):
if self.student and self.student.class_obj:
class_name = self.student.class_obj.name
# 采纳来源信息
adopted_from = content_obj.get("adopted_from")
return {
"id": self.id,
"student_id": self.student_id,
@@ -380,10 +388,16 @@ class PracticePlan(db.Model):
"is_typical": self.is_typical,
"problem_names": problem_names,
"problem_details": problem_details,
"created_by": self.creator.name if self.creator else None,
"created_at": self.created_at.strftime("%Y-%m-%d %H:%M")
if self.created_at
else None,
"updated_by": self.updater.name if self.updater else None,
"updated_at": self.updated_at.strftime("%Y-%m-%d %H:%M")
if self.updated_at
else None,
"content": self.content,
"adopted_from": adopted_from,
}