feat(提交列表): 右栏名字旁多一个「只看这个班」,不在班级列表里的老班也能筛出来

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-09-30 00:00:38 +08:00
1 parent e37ad982c0
commit 5f9743efe0
4 files changed
+41 -1

No files matched your search

@@ -19,7 +19,7 @@ import {
import type { Submission, SubmissionListItem } from "utils/types"
import { useCopySubmission } from "../composables/copySubmission"
import { useTone } from "../composables/tone"
import { submissionTimeText } from "../utils"
import { classLabel, submissionTimeText } from "../utils"
import CodeView from "./CodeView.vue"
import StatusPill from "./StatusPill.vue"
import UserName from "./UserName.vue"
@@ -34,6 +34,8 @@ const props = defineProps<{
teacher: boolean
/** 在比赛的提交列表里(不能重判,题目链接走比赛) */
contest: boolean
/** 列表现在筛的班级:已经在筛这个班就不再给「只看这个班」 */
className?: string
/** 右下角的「本页第 i / n 条」 */
position: { index: number; count: number } | null
/** 手机上的整屏详情:头部折行、不提方向键 */
@@ -42,6 +44,7 @@ const props = defineProps<{
const emit = defineEmits<{
filterUser: [username: string]
filterClass: [className: string]
filterProblem: [displayId: string]
openProblem: [row: SubmissionListItem]
rejudge: [id: string]
@@ -243,6 +246,16 @@ function openStandalone() {
>
<Icon icon="ph:funnel-simple-bold" :width="12" />
</button>
<!-- 班级下拉只有网站配置里在读的班,摘掉的老班从这里筛 -->
<button
v-if="teacher && !contest && row.className && row.className !== className"
class="filter-pill wide"
:title="`只看${classLabel(row.className)}的提交`"
:aria-label="`只看${classLabel(row.className)}的提交`"
@click="emit('filterClass', row.className)"
>
{{ classLabel(row.className) }}<Icon icon="ph:funnel-simple-bold" :width="12" />
</button>
</div>
<span class="dot">·</span>
<a
@@ -526,6 +539,12 @@ function openStandalone() {
cursor: pointer;
}
.filter-pill.wide {
width: auto;
padding: 0 8px;
white-space: nowrap;
}
.filter-pill:hover {
background: v-bind("tone('success').background");
}
+12
View File
@@ -575,6 +575,14 @@ function openStatistics() {
window.open(href, "_blank")
}
/** 右栏「只看这个班」:从看一个人换成看他整个班 */
function filterClass(name: string) {
exactFor.value = ""
query.username = ""
query.myself = "0"
query.className = name
}
function filterProblem(displayId: string) {
query.problem = displayId
}
@@ -988,9 +996,11 @@ function dayBreak(index: number) {
v-else
:row="selectedRow as SubmissionListItem"
:teacher="teacher"
:class-name="query.className"
:contest="inContest"
:position="position"
@filter-user="filterUser"
@filter-class="filterClass"
@filter-problem="filterProblem"
@open-problem="openProblem"
@rejudge="rejudge"
@@ -1024,10 +1034,12 @@ function dayBreak(index: number) {
v-else
:row="selectedRow as SubmissionListItem"
:teacher="teacher"
:class-name="query.className"
:contest="inContest"
:position="null"
narrow
@filter-user="(name: string) => ((mobilePane = false), filterUser(name))"
@filter-class="(name: string) => ((mobilePane = false), filterClass(name))"
@filter-problem="(id: string) => ((mobilePane = false), filterProblem(id))"
@open-problem="openProblem"
@rejudge="rejudge"