style(提交列表): 「重新判题」是右上角最显眼的按钮,上课却最用不上,收进「⋯」

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-09-30 08:47:57 +08:00
1 parent b19fc3c1d9
commit cb2fb57fdb
1 file changed
+32 -13
@@ -210,12 +210,27 @@ function caseColor(result: number) {
}
const canRejudge = computed(() => props.teacher && !props.contest)
const moreOptions = computed(() => [
/**
* 老师的「⋯」:复制两项 + 重新判题。重判不常用、点错了会真的重判,所以不放在外面当最显眼的
* 那个按钮。代码还没拉下来时只有重判一项 —— 代码拉不下来的那条,恰恰可能要重判
*/
const moreOptions = computed(() => {
const copy = shown.value
? [
{ label: "复制回到题目", key: "problem" },
...(shown.value?.language !== "SQL" ? [{ label: "复制到自测猫", key: "cat" }] : []),
])
...(shown.value.language !== "SQL" ? [{ label: "复制到自测猫", key: "cat" }] : []),
]
: []
if (!canRejudge.value) return copy
return [
...copy,
...(copy.length ? [{ type: "divider", key: "divider" }] : []),
{ label: "重新判题", key: "rejudge" },
]
})
function handleMore(key: string) {
if (key === "rejudge") return emit("rejudge", props.row.id)
if (!shown.value) return
if (key === "problem") copyToProblem(shown.value)
else copyToCat(shown.value)
@@ -285,14 +300,9 @@ function openStandalone() {
题单 {{ row.problemSet.title }}
</a>
<div class="spacer"></div>
<!-- 重判不用等代码拉下来:代码拉不下来的那条,恰恰可能要重判 -->
<n-button v-if="canRejudge" size="small" @click="emit('rejudge', row.id)">
<template #icon><Icon icon="ph:arrow-clockwise" /></template>
重新判题
</n-button>
<template v-if="shown">
<template v-if="teacher">
<n-button
v-if="shown"
size="small"
quaternary
title="新页面打开(有测试点明细)"
@@ -301,13 +311,23 @@ function openStandalone() {
>
<template #icon><Icon icon="ph:arrow-square-out" /></template>
</n-button>
<n-dropdown :options="moreOptions" trigger="click" @select="handleMore">
<n-button size="small" quaternary aria-label="更多" title="复制回到题目、复制到自测猫">
<n-dropdown
v-if="moreOptions.length"
:options="moreOptions"
trigger="click"
@select="handleMore"
>
<n-button
size="small"
quaternary
aria-label="更多"
:title="moreOptions.flatMap((o) => ('label' in o ? [o.label] : [])).join('、')"
>
<template #icon><Icon icon="ph:dots-three-bold" /></template>
</n-button>
</n-dropdown>
</template>
<template v-else>
<template v-else-if="shown">
<n-button size="small" type="primary" @click="copyToProblem(shown)">
<template #icon><Icon icon="ph:arrow-u-up-left" /></template>
复制回到题目
@@ -325,7 +345,6 @@ function openStandalone() {
<template #icon><Icon icon="ph:arrow-square-out" /></template>
</n-button>
</template>
</template>
</div>
<div class="meta">