feat(出题): 参考流程图改用画布画,「让学生自己画」不再要参考图
Deploy / deploy (push) Canceled after 0s

- 学生画的图现在按例子和测试数据评(拼成程序跑),参考图用不上了:「让学生自己画」
  只剩一句说明,保存前改成检查有没有例子;「给学生的提示」那一栏去掉(学生从来看不到,
  16 道题也都没填)
- 「给学生看一张参考流程图」改用学生画图的同一个编辑器,存结构树(problem.flowchart_data,
  原来是死列),Mermaid 由后端照它生成,题面里的图和学生交的图同一套形状
- 「AI 照 Python 答案画一张」改成出结构树,直接摆在画布上接着改;for 循环画成
  计数变量 + 当型循环
- 老题手写的 Mermaid 照旧给代码框,旁边「改用画布画」

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-10-12 21:39:50 +08:00
1 parent b9ece7d38f
commit 6e946c99fb
8 files changed
+168 -57

No files matched your search

@@ -30,8 +30,14 @@ import { layoutDoc, PLACEHOLDER, type LaidNode, type LaidSlot } from "./layout"
interface Props {
height?: string
/**
* 题目页(默认):每道题一份本地草稿,自动存。
* false:图交给外面管(后台出题页的参考流程图,v-model:value),不存草稿
*/
draft?: boolean
}
const { height = "calc(100vh - 134px)" } = defineProps<Props>()
const { height = "calc(100vh - 134px)", draft = true } = defineProps<Props>()
const model = defineModel<FlowDoc | null>("value", { default: null })
const message = useMessage()
const theme = useThemeVars()
@@ -98,6 +104,13 @@ const cacheKey = computed(() => {
const savedAt = ref<Date | null>(null)
function loadDraft() {
if (!draft) {
doc.value = model.value ? cloneDoc(model.value) : emptyDoc()
deselect()
resetHistory()
fitSoon()
return
}
let saved: unknown = null
try {
saved = storage.get(cacheKey.value)
@@ -135,12 +148,20 @@ watch(
doc,
() => {
if (loading) return
saveDraft(cacheKey.value)
if (draft) saveDraft(cacheKey.value)
else model.value = cloneDoc(doc.value)
},
{ deep: true },
)
/** 外面换了一张图(后台点了「AI 照答案画一张」):摆上来,进历史,Ctrl+Z 能回去 */
watch(model, (next) => {
if (draft || !next || signature(next) === signature(doc.value)) return
setDoc(next)
})
watch(cacheKey, () => {
if (!draft) return
loading = true
loadDraft()
nextTick(() => (loading = false))