feat(出题): 参考流程图改用画布画,「让学生自己画」不再要参考图
Deploy / deploy (push) Canceled after 0s

- 学生画的图现在按例子和测试数据评(拼成程序跑),参考图用不上了:「让学生自己画」
  只剩一句说明,保存前改成检查有没有例子;「给学生的提示」那一栏去掉(学生从来看不到,
  16 道题也都没填)
- 「给学生看一张参考流程图」改用学生画图的同一个编辑器,存结构树(problem.flowchart_data,
  原来是死列),Mermaid 由后端照它生成,题面里的图和学生交的图同一套形状
- 「AI 照 Python 答案画一张」改成出结构树,直接摆在画布上接着改;for 循环画成
  计数变量 + 当型循环
- 老题手写的 Mermaid 照旧给代码框,旁边「改用画布画」

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-10-12 21:39:50 +08:00
1 parent b9ece7d38f
commit 6e946c99fb
8 files changed
+168 -57

No files matched your search

+5 -2
View File
@@ -117,7 +117,7 @@ export function toggleProblemVisible(problemID: number) {
}
export function generateFlowchartFromPythonCode(python: string) {
return api.post<{ flowchart: string }>("admin/problems/flowchart", {
return api.post<{ doc: Record<string, unknown> }>("admin/problems/flowchart", {
python,
})
}
@@ -276,7 +276,9 @@ export function generateTestInputs(data: GenerateTestInputsRequest) {
/** 出站补默认值。字段名两边已经一致,不再做键名转换 */
function toProblemBody(problem: AdminProblem | BlankProblem) {
const p = problem as Partial<AdminProblem>
const p = problem as Partial<Omit<AdminProblem, "flowchartData">> & {
flowchartData?: Record<string, unknown> | null
}
return {
_id: p._id,
title: p.title,
@@ -300,6 +302,7 @@ function toProblemBody(problem: AdminProblem | BlankProblem) {
allowFlowchart: p.allowFlowchart ?? false,
showFlowchart: p.showFlowchart ?? false,
mermaidCode: p.mermaidCode ?? null,
flowchartData: p.flowchartData ?? null,
flowchartHint: p.flowchartHint ?? null,
astRules: p.astRules ?? null,
sqlConfig: p.sqlConfig ?? null,