feat(统计): 「今日统计」「数据统计」合成一个「统计」,打开是一行一节课,这节课在最上面
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-30 09:23:54 +08:00
1 parent 921990285c
commit e3be3cd62c
11 files changed
+891 -550

No files matched your search

+28 -26
View File
@@ -11,7 +11,7 @@ import {
getTodaySubmissionCount,
retryFlowchartSubmission,
} from "oj/api"
import { DEFAULT_PERIOD, type Period } from "oj/statistics/period"
import { DEFAULT_PERIOD } from "oj/statistics/period"
import { useContestStore } from "oj/store/contest"
import Pagination from "shared/components/Pagination.vue"
import { useBreakpoints } from "shared/composables/breakpoints"
@@ -38,7 +38,7 @@ import { classLabel, submissionClockText, submissionDayText } from "./utils"
*
* 老师课上的三种用法 —— 一条条翻全班的代码、看某一个学生、看完成情况 —— 前两种在
* 这一页里做完:↑ ↓ 换条,右边跟着换,不再「点开弹框 → 关掉 → 点下一行」。
* 完成情况在课堂看板和「数据统计」里,这页不重复造一张表。
* 完成情况在课堂看板和「统计」里,这页不重复造一张表。
*/
// 右栏和今日统计弹框都不在关键路径上:右栏要等选中一条才有内容,弹框默认关着
@@ -190,7 +190,8 @@ async function getTodayCount() {
onMounted(() => {
listSubmissions()
if (route.name === "submissions") getTodayCount()
// 「今日统计 N」只给学生:老师那一版并进了「统计」
if (route.name === "submissions" && !teacher.value) getTodayCount()
})
watchDebounced(() => [query.username, query.problem], listSubmissions, {
@@ -483,9 +484,6 @@ const scope = computed({
},
})
/** 1366 以下(机房 1280 的屏)老师那排放不下:「今日统计」只留图标和数字 */
const narrowBar = useMediaQuery("(max-width: 1365px)")
const today = computed({
get: () => query.today === "1",
set: (value: boolean) => (query.today = value ? "1" : "0"),
@@ -564,7 +562,7 @@ function filterUser(username: string) {
}
/**
* 「数据统计」弹框的查询条件。每次打开从这张列表现在的班级 / 学生 / 题号 / 代码或流程图
* 「统计」弹框的查询条件。每次打开从这张列表现在的班级 / 学生 / 题号 / 代码或流程图
* 带进去(「今天」带过去就是统计的「今天」);时间段沿用上次在弹框里选的
*/
const statsQuery = reactive({
@@ -577,14 +575,18 @@ const statsQuery = reactive({
to: "",
})
function openStatistics(preset?: { className: string; period: Period }) {
todayPanel.value = false
/**
* 老师的「统计」:带着这张列表现在的班级 / 学生 / 题号 / 代码或流程图打开。原来旁边还有一颗
* 「今日统计」,和「数据统计」名字分不清(用户说的),老师那一版并进来了 —— 什么都没筛时
* 打开就是「一行一节课」,选「今天」就是原来今日统计看的东西
*/
function openStatistics() {
Object.assign(statsQuery, {
tab: flowMode.value ? "flow" : "code",
className: preset ? preset.className : query.className,
username: preset ? "" : query.username,
problem: preset ? "" : query.problem,
...(preset ? { period: preset.period } : query.today === "1" ? { period: "today" } : {}),
className: query.className,
username: query.username,
problem: query.problem,
...(query.today === "1" ? { period: "today" } : {}),
})
statsPanel.value = true
}
@@ -814,27 +816,28 @@ function dayBreak(index: number) {
<n-button size="small" quaternary @click="clear">清空</n-button>
<div class="spacer"></div>
<!-- 老师只有「统计」(今日统计并进去了);学生看不到统计,仍是「今日统计」 -->
<n-button
v-if="route.name === 'submissions' && !flowMode"
v-if="teacher && route.name === 'submissions'"
size="small"
quaternary
title="统计:这节课、今天,或者回头看以前的课"
@click="openStatistics()"
>
<template #icon><Icon icon="ph:chart-bar" /></template>
统计
</n-button>
<n-button
v-else-if="route.name === 'submissions' && !flowMode"
size="small"
quaternary
:title="`今日统计:今天全站 ${todayCount} 条`"
@click="toggleTodayPanel(true)"
>
<template #icon><Icon icon="ph:chart-bar" /></template>
<template v-if="!(teacher && narrowBar)">今日统计</template>
今日统计
<span v-if="todayCount" class="count">{{ todayCount }}</span>
</n-button>
<n-button
v-if="teacher && route.name === 'submissions'"
size="small"
quaternary
title="数据统计:按班级、题号、时间段回头看"
@click="openStatistics()"
>
<template #icon><Icon icon="ph:chart-pie-slice" /></template>
数据统计
</n-button>
</div>
<!-- 手机:只留全部/我的,其余收进「筛选」 -->
@@ -1109,7 +1112,6 @@ function dayBreak(index: number) {
@close="todayPanel = false"
@loaded="(total: number) => (todayCount = total)"
@open-problem="(id: string) => openProblem({ problemDisplayId: id } as Row)"
@open-class="(name: string) => openStatistics({ className: name, period: 'today' })"
/>
</n-modal>