diff --git a/apps/web/src/admin/problem/components/CodePreview.vue b/apps/web/src/admin/problem/components/CodePreview.vue index fdd5ca3..19489f4 100644 --- a/apps/web/src/admin/problem/components/CodePreview.vue +++ b/apps/web/src/admin/problem/components/CodePreview.vue @@ -5,11 +5,15 @@ import { useMermaid } from "shared/composables/useMermaid" import { DIFFICULTY, SOURCES } from "utils/constants" import { getTagColor } from "utils/functions" import type { AstRules, BlankProblem, LANGUAGE } from "utils/types" +import type { FlowDoc } from "shared/components/FlowchartEditor/model" import type { AstCheckState, FlowchartMode, PreviewTab } from "./editorTypes" import type { TemplateParts } from "./codeTemplate" import { isBlankHtml } from "./problemForm" const CodeEditor = defineAsyncComponent(() => import("shared/components/CodeEditor.vue")) +const FlowchartView = defineAsyncComponent( + () => import("shared/components/FlowchartEditor/FlowchartView.vue"), +) /** * 编程题出题页的右栏:学生打开这道题看到的样子(设计稿「编程题出题页」B)。 @@ -35,6 +39,8 @@ const props = defineProps<{ astChecks: AstCheckState flowchartMode: FlowchartMode mermaidCode: string + /** 画布画的参考图;有就照学生题面那样画(FlowchartView),老题手写的 Mermaid 才走 mermaidCode */ + flowchartDoc: FlowDoc | null }>() const tab = defineModel("tab", { required: true }) @@ -84,6 +90,8 @@ const editorCode = computed(() => { // ---------------------------------------------------------------- 流程图 +const referenceDoc = computed(() => (props.flowchartDoc?.steps.length ? props.flowchartDoc : null)) + const container = useTemplateRef("chart") const { renderFlowchart, renderError, renderSuccess } = useMermaid() @@ -164,11 +172,6 @@ onMounted(() => nextTick(render)) - -

例子

@@ -188,6 +191,15 @@ onMounted(() => nextTick(render)) {{ bigData ? "在左边加一个例子" : "在左边的测试数据里勾几组「当例子」" }}

+ + @@ -361,19 +377,11 @@ onMounted(() => nextTick(render)) color: v-bind("theme.textColor3"); } -.fold { - display: flex; - align-items: center; - gap: 8px; - height: 38px; - padding: 0 12px; - border: 1px solid v-bind("theme.borderColor"); +/* 参考流程图:和学生题面(ProblemContent.vue)同一种浅灰底 */ +.reference { border-radius: 6px; - background: transparent; - font: inherit; - color: inherit; - text-align: left; - cursor: pointer; + background-color: rgba(128, 128, 128, 0.05); + padding: 16px 12px; } .exampleHead { diff --git a/apps/web/src/admin/problem/detail.vue b/apps/web/src/admin/problem/detail.vue index 645a68a..5a8b3c3 100644 --- a/apps/web/src/admin/problem/detail.vue +++ b/apps/web/src/admin/problem/detail.vue @@ -1211,7 +1211,7 @@ onMounted(async () => { 给学生看一张参考流程图 - 题面里多一条「老师给的参考流程图」,默认收着,学生点开才看 + 题面里例子下面摊开一张参考流程图