feat(流程图): 画流程图不用再拖框连线——点箭头上的 + 加一步,判断自动分出是 / 否,排版全自动
原来要从节点库拖框、对准连接点拉线、自己摆位置,还能画出断线和孤立的框; 画布上全是彩色圆角块,交上去的却是平行四边形和菱形。现在照画布稿 FlowEdB: - 图存成一棵结构树(顺序 / 判断 / 循环),开始、结束固定在两头,排版是纯函数 - 每根箭头上一个 +,点了选输入 / 输出 / 处理 / 判断 / 循环;点框直接改字,右上角「删除」 - 形状照国标流程图,画布、缩略图、交给 AI 的 Mermaid 是同一套;缩略图配色跟着画布改 - 已保存时间、撤销、重做挪到工具栏,「清空画布」收进「⋯」;空框交不上去 - 去掉 vue-flow 三个包(编辑器打包后 16 KB),删掉没人进的 /flowchart 页 2026-10 之前交的图是 vue-flow 格式,只能看缩略图、载不回画布;旧草稿键名不同,不去碰。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ce26925e79
commit
09f8a56913
25 files changed
+1670
-2102
No files matched your search
@@ -9,6 +9,7 @@ import { compressToBase64, copyToClipboard } from "utils/functions"
|
||||
import storage from "utils/storage"
|
||||
import { useDraftKey } from "./draftKey"
|
||||
import { useTeacherCollab } from "./teacherCollab"
|
||||
import { useFlowchartStore } from "oj/store/flowchart"
|
||||
import { useProblemPageContext } from "./problemPageContext"
|
||||
|
||||
/**
|
||||
@@ -48,7 +49,9 @@ export function useEditorMenu(statisticsInline: Ref<boolean>) {
|
||||
if (ctx.value.classStats && !statisticsInline.value && userStore.isTeacherOrAbove) {
|
||||
items.push({ label: "课堂统计", key: "statistics" })
|
||||
}
|
||||
if (codeStore.code.language !== "Flowchart") {
|
||||
if (codeStore.code.language === "Flowchart") {
|
||||
items.push({ label: "清空画布", key: "clearFlowchart" })
|
||||
} else {
|
||||
if (codeStore.code.language !== "SQL") items.push({ label: "去自测猫", key: "testcat" })
|
||||
items.push({ label: "复制代码", key: "copy" })
|
||||
// 协作中的教师不给「重置代码」:那会儿编辑器里是**学生的**代码,而 v-model
|
||||
@@ -80,6 +83,23 @@ export function useEditorMenu(statisticsInline: Ref<boolean>) {
|
||||
})
|
||||
}
|
||||
|
||||
// 清空会连这道题存着的草稿一起删掉(空图不留草稿),点错了只剩 Ctrl+Z
|
||||
const flowchartStore = useFlowchartStore()
|
||||
function clearFlowchart() {
|
||||
const editor = flowchartStore.editor
|
||||
if (!editor) return
|
||||
dialog.warning({
|
||||
title: "清空画布",
|
||||
content: "画布上的图会全部清掉。确定吗?",
|
||||
positiveText: "清空",
|
||||
negativeText: "再想想",
|
||||
onPositiveClick: () => {
|
||||
editor.clear()
|
||||
message.success("已清空,按 Ctrl+Z 可以撤回")
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
function goTestCat() {
|
||||
const data = {
|
||||
lang: LANGUAGE_FORMAT_VALUE[codeStore.code.language],
|
||||
@@ -124,6 +144,9 @@ export function useEditorMenu(statisticsInline: Ref<boolean>) {
|
||||
case "reset":
|
||||
reset()
|
||||
return true
|
||||
case "clearFlowchart":
|
||||
clearFlowchart()
|
||||
return true
|
||||
case "edit":
|
||||
goEdit()
|
||||
return true
|
||||
|
||||
Reference in new issue
Block a user