feat(流程图): 手机上也能画流程图了
原来手机上不给画(节点库是 HTML5 拖放,手机上拖不动),只能在结果页签里多一段只读的 「流程图点评」。换成插入式编辑器之后只用点,手机上照样能画: - 「代码」页签的工具栏里有「写代码 / 画流程图」、撤销、重做 - 屏幕底部那条在画流程图时换成「交给 AI 点评」 - 结果页签就是电脑上那一套(逐组结果、亮路径、载回画布),只读的那一段删了 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6b7d87d677
commit
04c90e3f89
8 files changed
+36
-65
No files matched your search
@@ -3,7 +3,7 @@ import { storeToRefs } from "pinia"
|
||||
import { useBreakpoints } from "shared/composables/breakpoints"
|
||||
import { countBlank } from "shared/components/FlowchartEditor/model"
|
||||
import { useProblemStore } from "oj/store/problem"
|
||||
import { useFlowchartStore, type FlowchartEditorInstance } from "oj/store/flowchart"
|
||||
import { useFlowchartStore } from "oj/store/flowchart"
|
||||
|
||||
/**
|
||||
* 「交给 AI 点评」按钮。
|
||||
@@ -13,16 +13,20 @@ import { useFlowchartStore, type FlowchartEditorInstance } from "oj/store/flowch
|
||||
* 弹框盖住画布,学生没法一边看改进建议一边改图。
|
||||
*/
|
||||
|
||||
const flowchartEditorRef = inject<Ref<FlowchartEditorInstance | null>>("flowchartEditorRef")
|
||||
/** 手机上它在屏幕底部那条(MobileActionBar),不在编辑器里面,所以画布从 store 拿 */
|
||||
const { size, block = false } = defineProps<{
|
||||
size?: "small" | "medium" | "large"
|
||||
block?: boolean
|
||||
}>()
|
||||
|
||||
const message = useMessage()
|
||||
const { problem } = storeToRefs(useProblemStore())
|
||||
const flowchartStore = useFlowchartStore()
|
||||
const { loading, unchanged } = storeToRefs(flowchartStore)
|
||||
const { loading, unchanged, editor: canvas } = storeToRefs(flowchartStore)
|
||||
const { isDesktop } = useBreakpoints()
|
||||
|
||||
function submit() {
|
||||
const editor = flowchartEditorRef?.value
|
||||
const editor = canvas.value
|
||||
if (!editor) return
|
||||
const doc = editor.getDoc()
|
||||
if (!doc.steps.length) {
|
||||
@@ -44,7 +48,8 @@ watch(() => problem.value?.id, flowchartStore.ensureLoaded, { immediate: true })
|
||||
|
||||
<template>
|
||||
<n-button
|
||||
:size="isDesktop ? 'medium' : 'small'"
|
||||
:size="size ?? (isDesktop ? 'medium' : 'small')"
|
||||
:block="block"
|
||||
type="primary"
|
||||
:loading="loading"
|
||||
:disabled="loading || unchanged"
|
||||
|
||||
Reference in new issue
Block a user