fix(提交列表): 不在班级列表里的班(毕业、换届摘掉的老班)在班级下拉里选不到,筛不出它的提交
Deploy / deploy (push) Canceled after 0s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-09-29 23:31:50 +08:00
1 parent 6bc927402e
commit 61ec7d7f8e
3 files changed
+61 -3

No files matched your search

+5
View File
@@ -167,6 +167,11 @@ export function getTodaySubmissionCount(language?: string) {
return api.get<number>("submissions/today-count", { params: { language } })
}
/** 近半年有提交的班级(老师用),补上网站配置里已经摘掉的班 */
export function getSubmissionClasses() {
return api.get<string[]>("submissions/classes")
}
/** 「今日提交数」标签点开的统计。公开接口,口径同那颗标签:今天 + 非比赛提交 */
export function getTodaySubmissionStatistics() {
return api.get<TodaySubmissionStatistics>("submissions/today-statistics")
+26 -3
View File
@@ -7,6 +7,7 @@ import {
adminRejudge,
getClassLesson,
getFlowchartSubmissions,
getSubmissionClasses,
getSubmissions,
getTodaySubmissionCount,
retryFlowchartSubmission,
@@ -444,11 +445,33 @@ const languageOptions = [
{ label: "SQL", value: "SQL" },
]
// 配置里的班级列表是「注册时能选的班」,摘掉的老班还在交,得从提交里补出来
const activeClasses = ref<string[]>([])
watch(
teacher,
async (isTeacher) => {
if (!isTeacher || activeClasses.value.length) return
try {
activeClasses.value = await getSubmissionClasses()
} catch {
// 补不上就只有配置里那些,不打扰
}
},
{ immediate: true },
)
const classOptions = computed(() => {
const list = configStore.config?.classList ?? []
// 带进来的班级不在配置里(老班、手打的)也要显示得出来,不然框里是空的却在筛
const all = query.className && !list.includes(query.className) ? [query.className, ...list] : list
return all.map((item) => ({ label: classLabel(item), value: item }))
const others = activeClasses.value.filter((item) => !list.includes(item)).reverse()
// 带进来的班级哪边都没有(手打的)也要显示得出来,不然框里是空的却在筛
if (query.className && !list.includes(query.className) && !others.includes(query.className))
others.unshift(query.className)
const option = (item: string) => ({ label: classLabel(item), value: item })
if (!others.length) return list.map(option)
return [
{ type: "group", label: "班级列表", key: "listed", children: list.map(option) },
{ type: "group", label: "不在班级列表里", key: "others", children: others.map(option) },
]
})
const contestProblemOptions = computed(() => [