From 9110c678fc3c69d72ec51d6a07760c7e3c13d70a Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Mon, 28 Sep 2026 18:33:17 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E9=A2=98=E7=9B=AE):=20=E6=89=8B=E6=9C=BA?= =?UTF-8?q?=E4=B8=8A=E3=80=8C=E8=BF=90=E8=A1=8C=E4=BE=8B=E5=AD=90=20/=20?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E3=80=8D=E5=9B=BA=E5=AE=9A=E5=9C=A8=E5=B1=8F?= =?UTF-8?q?=E5=B9=95=E5=BA=95=E9=83=A8=EF=BC=8C=E7=9C=8B=E7=9D=80=E9=A2=98?= =?UTF-8?q?=E7=9B=AE=E4=B9=9F=E8=83=BD=E7=9B=B4=E6=8E=A5=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 两个 44px 高的大按钮固定在底部,三个页签下都在;原来它们在「代码」页签顶上, 和语言、更多挤成两行,看着题面想交一次还得先切回代码页签 - 「代码」页签的编辑器一直挂着(原来切走就卸载):没打开过代码页签也能交,撤销历史也不丢 - 编辑器高度让出底部那条,最后几行不再被按钮盖住 Co-Authored-By: Claude Opus 5.5 --- .../oj/problem/components/EditorToolbar.vue | 5 +- .../oj/problem/components/MobileActionBar.vue | 70 +++++++++++++++++++ .../oj/problem/components/ProblemEditor.vue | 5 +- .../src/oj/problem/components/SubmitCode.vue | 6 +- apps/web/src/oj/problem/detail.vue | 18 +++-- ...2026-09-28-problem-page-redesign-design.md | 2 +- 6 files changed, 96 insertions(+), 10 deletions(-) create mode 100644 apps/web/src/oj/problem/components/MobileActionBar.vue 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() { - - - + +