diff --git a/apps/web/src/oj/problem/components/EditorToolbar.vue b/apps/web/src/oj/problem/components/EditorToolbar.vue index dccf4b8..f477e18 100644 --- a/apps/web/src/oj/problem/components/EditorToolbar.vue +++ b/apps/web/src/oj/problem/components/EditorToolbar.vue @@ -269,8 +269,9 @@ const goEdit = () => { @update:value="changeLanguage" /> + { - + +import { useThemeVars } from "naive-ui" +import { storeToRefs } from "pinia" +import { useCodeStore } from "oj/store/code" +import { useProblemStore } from "oj/store/problem" +import { useSubmissionStore } from "oj/store/submission" +import SubmitCode from "./SubmitCode.vue" + +/** + * 手机上屏幕底部固定的「运行例子 / 提交」(设计文档 5.6)。原来这两个按钮在「代码」页签 + * 顶上,和语言、更多挤成两行;看着题面想交一次,还得先切回代码页签。 + * 提交状态、代码都在 store 里,编辑器没挂着也能交。 + */ +const theme = useThemeVars() +const codeStore = useCodeStore() +const submissionStore = useSubmissionStore() +const { samplesRunning } = submissionStore.trial +const { problem } = storeToRefs(useProblemStore()) + +// 和工具栏同一个条件:Judge0 跑不了 SQL,流程图没得跑,没有例子的题不给 +const canRunSamples = computed( + () => + !!problem.value?.samples.length && + codeStore.code.language !== "Flowchart" && + codeStore.code.language !== "SQL", +) + + + + + diff --git a/apps/web/src/oj/problem/components/ProblemEditor.vue b/apps/web/src/oj/problem/components/ProblemEditor.vue index 48a5227..0bdea88 100644 --- a/apps/web/src/oj/problem/components/ProblemEditor.vue +++ b/apps/web/src/oj/problem/components/ProblemEditor.vue @@ -98,9 +98,10 @@ const storageKey = computed(() => : `problem_${problem.value!._id}_contest_${contestID}_lang_${codeStore.code.language}`, ) -// 协作条 40px + 和工具栏之间的 12px 间距,要从编辑器里让出来,不然页面底下多出一截滚动条 +// 协作条 40px + 和工具栏之间的 12px 间距,要从编辑器里让出来,不然页面底下多出一截滚动条。 +// 手机上:顶栏两行 + 课堂条 + 页签 + 工具栏约 236px,底部还有「运行例子 / 提交」那条约 64px const editorHeight = computed(() => { - const base = isDesktop.value ? 133 : 172 + const base = isDesktop.value ? 133 : 300 return `calc(100vh - ${base + (teacherCollab.value ? 52 : 0)}px)` }) diff --git a/apps/web/src/oj/problem/components/SubmitCode.vue b/apps/web/src/oj/problem/components/SubmitCode.vue index f7b98cb..5a876c1 100644 --- a/apps/web/src/oj/problem/components/SubmitCode.vue +++ b/apps/web/src/oj/problem/components/SubmitCode.vue @@ -12,6 +12,9 @@ import { useUserStore } from "shared/store/user" * 这个组件在编辑器的工具栏里,编辑器卸载时它也跟着卸载,所以什么都不能只存在这里。 */ +/** 手机底部那条操作栏里用大号、占满半宽 */ +const props = defineProps<{ size?: "small" | "medium" | "large"; block?: boolean }>() + const userStore = useUserStore() const codeStore = useCodeStore() const submissionStore = useSubmissionStore() @@ -41,7 +44,8 @@ function submit() { - - - + +