feat(提交列表): 重做成左边列表、右边代码,方向键一条条翻,不再开弹框
- 右栏常驻选中那条的代码:编译失败 / 运行时错误用中文说清第几行错了并标红, 老师看得到逐个测试点,学生看别人的只显示结果 - 老师一键「这节课」:筛到正在上课的班、这节课的题、今天 - 「正在评分」的行自己变成结果;新交的不插队,顶上提示「有 N 条新提交」 - 按天分组、默认每页 30 条;状态筛选补全,语言补上 SQL;流程图的评分详情也放进右栏 - 课堂看板的格子和名字能直接点进这个学生今天的提交 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ea480d5e0c
commit
660f689a5c
14 files changed
+2845
-673
No files matched your search
@@ -0,0 +1,36 @@
|
||||
import { parseTime } from "utils/functions"
|
||||
|
||||
/**
|
||||
* 提交时间的显示:今天的只写钟点,别的日子带上月日,跨年再带年份。列表里一眼看的是
|
||||
* 「刚才」还是「以前」,完整的年月日时分秒只会把这一列撑宽。
|
||||
* 日历按东八区算(parseTime),不跟浏览器时区走。
|
||||
*/
|
||||
export function submissionTimeText(time: string, withSeconds = false) {
|
||||
const clock = parseTime(time, withSeconds ? "HH:mm:ss" : "HH:mm")
|
||||
const day = parseTime(time, "YYYY-MM-DD")
|
||||
const now = parseTime(new Date(), "YYYY-MM-DD")
|
||||
if (day === now) return clock
|
||||
if (day.slice(0, 4) === now.slice(0, 4)) return `${parseTime(time, "M月D日")} ${clock}`
|
||||
return `${parseTime(time, "YYYY年M月D日")} ${clock}`
|
||||
}
|
||||
|
||||
/** 列表里每行只写钟点,日期在分隔行上(submissionDayText) */
|
||||
export function submissionClockText(time: string) {
|
||||
return parseTime(time, "HH:mm")
|
||||
}
|
||||
|
||||
/** 分隔行上的日子:今天 / 昨天 / 9月28日(跨年带年份) */
|
||||
export function submissionDayText(time: string) {
|
||||
const day = parseTime(time, "YYYY-MM-DD")
|
||||
const now = parseTime(new Date(), "YYYY-MM-DD")
|
||||
const yesterday = parseTime(new Date(Date.now() - 86_400_000), "YYYY-MM-DD")
|
||||
if (day === now) return "今天"
|
||||
if (day === yesterday) return `昨天 · ${parseTime(time, "M月D日")}`
|
||||
if (day.slice(0, 4) === now.slice(0, 4)) return parseTime(time, "M月D日")
|
||||
return parseTime(time, "YYYY年M月D日")
|
||||
}
|
||||
|
||||
/** 班级下拉的标签:`253` → `25计算机3班`,和统计面板、班级 PK 同一个写法 */
|
||||
export function classLabel(className: string) {
|
||||
return `${className.slice(0, 2)}计算机${className.slice(2)}班`
|
||||
}
|
||||
Reference in new issue
Block a user