出题表单:SQL 题隐藏代码规则检查

AstRulesEditor 基于 tree-sitter 对 Python/C 做 AST 解析(后端 ast_checker
只注册了这两种语言),对 SQL 没有意义;此前只要 SQL 在已选语言里就会渲染
出对应 tab,选项全是 for/while 循环等编程语言概念。切到 SQL 时隐藏该区块
并清空 ast_rules,避免出题界面出现无意义配置。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-02 17:41:50 -06:00
parent 38500671af
commit c227c1d506

View File

@@ -198,6 +198,10 @@ watch(
problem.value.sql_config = { mode: "query", order_sensitive: false } problem.value.sql_config = { mode: "query", order_sensitive: false }
} }
currentActiveAnswer.value = "SQL" currentActiveAnswer.value = "SQL"
// 代码规则检查基于 Python/C 的 AST 解析,对 SQL 没有意义,清空避免脏数据
if (problem.value.ast_rules) {
problem.value.ast_rules = null
}
} else if (problem.value.sql_config) { } else if (problem.value.sql_config) {
problem.value.sql_config = null problem.value.sql_config = null
} }
@@ -754,7 +758,7 @@ watch(
</n-gi> </n-gi>
</n-grid> </n-grid>
<n-grid :cols="2"> <n-grid v-if="!isSQLProblem" :cols="2">
<n-gi :span="1"> <n-gi :span="1">
<AstRulesEditor <AstRulesEditor
v-model="problem.ast_rules!" v-model="problem.ast_rules!"