feat(题目): 手机上「运行例子 / 提交」固定在屏幕底部,看着题目也能直接交
- 两个 44px 高的大按钮固定在底部,三个页签下都在;原来它们在「代码」页签顶上, 和语言、更多挤成两行,看着题面想交一次还得先切回代码页签 - 「代码」页签的编辑器一直挂着(原来切走就卸载):没打开过代码页签也能交,撤销历史也不丢 - 编辑器高度让出底部那条,最后几行不再被按钮盖住 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0c2ff68e9b
commit
9110c678fc
6 files changed
+96
-10
No files matched your search
@@ -0,0 +1,70 @@
|
||||
<script setup lang="ts">
|
||||
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",
|
||||
)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="mobile-actions">
|
||||
<n-button
|
||||
v-if="canRunSamples"
|
||||
size="large"
|
||||
class="action"
|
||||
:loading="samplesRunning"
|
||||
:disabled="!codeStore.code.value.trim()"
|
||||
@click="submissionStore.runSamples()"
|
||||
>
|
||||
运行例子
|
||||
</n-button>
|
||||
<div class="action">
|
||||
<SubmitCode size="large" block />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.mobile-actions {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
|
||||
background-color: v-bind("theme.bodyColor");
|
||||
border-top: 1px solid rgba(128, 128, 128, 0.2);
|
||||
backdrop-filter: blur(8px);
|
||||
}
|
||||
|
||||
.action {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.mobile-actions :deep(.n-button) {
|
||||
height: 44px;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user