diff --git a/src/oj/problem/components/ProblemContent.vue b/src/oj/problem/components/ProblemContent.vue index f9e1f29..10c4af0 100644 --- a/src/oj/problem/components/ProblemContent.vue +++ b/src/oj/problem/components/ProblemContent.vue @@ -12,6 +12,7 @@ import { useDark } from "@vueuse/core" import { MdPreview } from "md-editor-v3" import "md-editor-v3/lib/preview.css" import { getSimilarProblems } from "oj/api" +import SQLDataTable from "./SQLDataTable.vue" type Sample = Problem["samples"][number] & { id: number @@ -30,6 +31,18 @@ const { problem } = storeToRefs(problemStore) const problemSetId = computed(() => route.params.problemSetId) +// SQL 题:隐藏输入/输出/例子,改为渲染数据表与期望结果 +const isSQL = computed(() => !!problem.value?.sql_config) +const sqlDisplay = computed(() => problem.value?.sql_display ?? null) +const sqlExpectedQuery = computed(() => { + const exp = sqlDisplay.value?.expected + return exp && "columns" in exp ? exp : null +}) +const sqlChangedTables = computed(() => { + const exp = sqlDisplay.value?.expected + return exp && "changed_tables" in exp ? exp.changed_tables : [] +}) + const router = useRouter() // 相似题目推荐 @@ -269,29 +282,79 @@ function type(status: ProblemStatus) { :theme="isDark ? 'dark' : 'light'" /> -
-
+
-
+
+
{{ t.name }}
+
+
+ 结果顺序不限 +
+ ++ {{ t.dropped ? `${t.name} 表已被删除` : `执行后的 ${t.name} 表` }} +
+@@ -334,50 +397,52 @@ function type(status: ProblemStatus) {
-
+
@@ -470,4 +535,16 @@ function type(status: ProblemStatus) {
font-size: 13px;
opacity: 0.65;
}
+
+.sqlTableName {
+ font-weight: 600;
+ margin: 8px 0 4px;
+ font-family: "Monaco";
+}
+
+.sqlNote {
+ font-size: 13px;
+ opacity: 0.65;
+ margin: 0 0 8px;
+}
diff --git a/src/oj/problem/components/SQLDataTable.vue b/src/oj/problem/components/SQLDataTable.vue
new file mode 100644
index 0000000..8330664
--- /dev/null
+++ b/src/oj/problem/components/SQLDataTable.vue
@@ -0,0 +1,60 @@
+
+
+
+
+ 共 {{ totalRows }} 行,仅展示前 {{ rows.length }} 行
+
+
+
+
+
+ {{ col.name }}
+ {{ col.type }}
+
+
+
+ (空表)
+
+
+
+
+ {{ v === null ? "NULL" : v }}
+
+