新增 SQL 题型前端支持

- LANGUAGE 类型与六张语言映射表补 SQL;编辑器 SQLite 方言高亮
- 出题表单:SQL 语言选项、题型/行序配置卡片、数据脚本压缩包上传、标准答案必填校验
- 修复做题页语言回退硬编码 Python3 的问题(SQL 题会提交被拒)
- SQL 题隐藏自测猫/自测屏/复制到自测猫(外部运行器不支持 SQL)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-02 17:23:23 -06:00
parent 5867bbceed
commit 38500671af
11 changed files with 138 additions and 12 deletions

View File

@@ -175,6 +175,7 @@ export const SOURCES = {
JavaScript: "",
Golang: "",
Flowchart: "",
SQL: "",
} as const
export const LANGUAGE_ID = {
@@ -186,6 +187,7 @@ export const LANGUAGE_ID = {
JavaScript: 0,
Golang: 0,
Flowchart: 0,
SQL: 0,
} as const
export const LANGUAGE_FORMAT_VALUE = {
@@ -197,6 +199,7 @@ export const LANGUAGE_FORMAT_VALUE = {
JavaScript: "javascript",
Golang: "go",
Flowchart: "flowchart",
SQL: "sql",
} as const
export const LANGUAGE_SHOW_VALUE = {
@@ -208,6 +211,7 @@ export const LANGUAGE_SHOW_VALUE = {
Python3: "Python",
JavaScript: "JS",
Golang: "Go",
SQL: "SQL",
} as const
export const ICON_SET = {
@@ -219,6 +223,7 @@ export const ICON_SET = {
Java: "devicon:java",
JavaScript: "devicon:javascript",
Golang: "devicon:go",
SQL: "devicon:sqlite",
} as const
const cTemplate = `//TEMPLATE BEGIN
@@ -256,6 +261,7 @@ export const CODE_TEMPLATES = {
JavaScript: blankTemplate,
Golang: blankTemplate,
Flowchart: blankTemplate,
SQL: blankTemplate,
} as const
export enum ScreenMode {

View File

@@ -65,6 +65,12 @@ export type LANGUAGE =
| "JavaScript"
| "Golang"
| "Flowchart"
| "SQL"
export interface SQLConfig {
mode: "query" | "modify"
order_sensitive: boolean
}
export type LANGUAGE_SHOW_LABEL =
(typeof LANGUAGE_SHOW_VALUE)[keyof typeof LANGUAGE_SHOW_VALUE]
@@ -164,6 +170,9 @@ export interface Problem {
}[]
} | null
has_ast_rules?: boolean
// SQL 题配置(非 SQL 题为 null
sql_config?: SQLConfig | null
}
export type AdminProblem = Problem & AlterProblem