From b4ac42b736f29fcf21dd7d710238155bf2cfb4d9 Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Thu, 2 Jul 2026 17:45:44 -0600 Subject: [PATCH] =?UTF-8?q?=E5=87=BA=E9=A2=98=E8=A1=A8=E5=8D=95=EF=BC=9A?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20SQL=20=E9=A2=98=E5=B4=A9=E6=BA=83=E5=B9=B6?= =?UTF-8?q?=E9=9A=90=E8=97=8F=E6=B5=81=E7=A8=8B=E5=9B=BE=E5=8C=BA=E5=9F=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 流程图区域的"AI 生成"按钮读取 problem.answers 里 language==='Python3' 的 第一项 .code,SQL 题(languages=["SQL"])没有 Python3 答案,[0] 为 undefined,导致模板抛 TypeError 崩溃整个出题页。 流程图功能本身依赖 Python 答案生成 Mermaid 代码,对 SQL 题没有意义, 和已隐藏的"代码规则检查"一样直接整块隐藏(切到 SQL 时顺带重置 allow_flowchart/show_flowchart,避免脏数据)。顺手给禁用态判断加了 可选链,修掉未选 Python3 时同样会崩的潜在问题(如仅选 C/C++ 的题目)。 Co-Authored-By: Claude Fable 5 --- src/admin/problem/detail.vue | 83 +++++++++++++++++++----------------- 1 file changed, 44 insertions(+), 39 deletions(-) diff --git a/src/admin/problem/detail.vue b/src/admin/problem/detail.vue index fd9429e..5f0258e 100644 --- a/src/admin/problem/detail.vue +++ b/src/admin/problem/detail.vue @@ -202,6 +202,9 @@ watch( if (problem.value.ast_rules) { problem.value.ast_rules = null } + // 流程图依赖 Python 答案生成,对 SQL 没有意义 + problem.value.allow_flowchart = false + problem.value.show_flowchart = false } else if (problem.value.sql_config) { problem.value.sql_config = null } @@ -844,48 +847,50 @@ watch( /> - + 提交