feat(首页): 登录后不再弹「登录速报」,上次来做了什么、哪道还没做对放进首页,带「接着做」
Deploy / deploy (push) Canceled after 0s

- 新接口 /me/last-visit:上次登录到这次登录之间的题库提交,不调 AI(原来要同步等模型最长 60 秒弹框才出来)
- 班里今天在做时让位给班里卡,只在卡底留一句;班里那天就是上次来那天时两张卡合成一张
- 第一次登录说「欢迎来到判题狗」,隔了 30 天以上说「好久不见」
- 删掉弹框、store 和 /ai/login-summary

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-09-30 00:28:14 +08:00
1 parent 2b4676ae34
commit 91d9c9c6d7
15 files changed
+389 -289

No files matched your search

-15
View File
@@ -263,20 +263,6 @@ export const aiAnalysisRecordSchema = z.object({
username: z.string().optional(),
})
export const loginSummarySchema = z.object({
summary: z.object({
start: z.string(),
end: z.string(),
newProblemCount: z.number().int(),
submissionCount: z.number().int(),
acceptedCount: z.number().int(),
solvedCount: z.number().int(),
flowchartSubmissionCount: z.number().int(),
}),
analysis: z.string(),
analysisError: z.string().optional(),
})
export type Grade = z.infer<typeof gradeSchema>
export type DurationData = z.infer<typeof durationDataSchema>
export type SolvedProblem = z.infer<typeof solvedProblemSchema>
@@ -286,7 +272,6 @@ export type AiDetail = z.infer<typeof aiDetailSchema>
export type SolvedList = z.infer<typeof solvedListSchema>
export type HeatmapItem = z.infer<typeof heatmapItemSchema>
export type AiAnalysisRecord = z.infer<typeof aiAnalysisRecordSchema>
export type LoginSummary = z.infer<typeof loginSummarySchema>
export type AiAnalysisRequest = z.infer<typeof aiAnalysisRequestSchema>
export type AiHintRequest = z.infer<typeof aiHintRequestSchema>
+37
View File
@@ -1,5 +1,7 @@
import { z } from "zod"
import { judgeStatusSchema } from "./judge-status"
export const classRankItemSchema = z.object({
className: z.string(),
userCount: z.number().int(),
@@ -86,6 +88,40 @@ export const classActivitySchema = z.object({
problems: z.array(classActivityProblemSchema),
})
/**
* 首页的「上次来」卡(原来登录后弹的「登录速报」并进了首页,AI 那两句不要了)。
* 窗口是**上次登录到这次登录之间**,不是到现在 —— 这次登录期间卡片内容不变,
* 今天做的题不会混进「上次」里。只算题库提交,比赛的题号在题库里点不开。
*/
export const lastVisitSchema = z.object({
/** 上次登录的时刻。null = 头一回登录(或会话早于这个字段) */
previousLogin: z.string().nullable(),
/** null = 上次来已经是 30 天以前,或那次一条代码都没交 */
summary: z
.object({
submissionCount: z.number().int(),
/** 那次做对的题数(去重) */
solvedCount: z.number().int(),
/** 那次最后一条提交的时刻,前端拿它和「班里那天」比是不是同一天 */
lastSubmitTime: z.string(),
/**
* 那次交过、**到现在都还没做对**的题(这次登录后补做对了的不算),
* 按最后一次提交倒序,最多 3 道
*/
unsolved: z.array(
z.object({
problemDisplayId: z.string(),
title: z.string(),
attempts: z.number().int(),
lastResult: judgeStatusSchema,
}),
),
/** 那次做对的题,按第一次做对的先后,最多 12 道(总数看 solvedCount) */
solved: z.array(z.object({ problemDisplayId: z.string(), title: z.string() })),
})
.nullable(),
})
/** 课堂看板里老师布置这节课的题:按输入顺序给展示题号,最多 20 道,空数组 = 清掉 */
export const classLessonRequestSchema = z.object({
className: z.string().trim().min(1),
@@ -165,6 +201,7 @@ export type ClassComparison = z.infer<typeof classComparisonSchema>
export type ClassComparisonResponse = z.infer<typeof classComparisonResponseSchema>
export type ClassActivity = z.infer<typeof classActivitySchema>
export type LastVisit = z.infer<typeof lastVisitSchema>
export type ClassLessonRequest = z.infer<typeof classLessonRequestSchema>
export type ClassBoard = z.infer<typeof classBoardSchema>
export type ClassLesson = z.infer<typeof classLessonSchema>