Files
SuperJump/src/app/wrongbook/page.tsx
T
jacobxu666andClaude Opus 4.8 d84d827202 学习闭环增强:错题本+每周能力检测+学习概览日历+模板日历+课程管理
- 错题本:所有检测错题自动入库,带详细讲解,可标记掌握,孩子端可查
- 每周能力检测:从已学知识点确定性组卷10题,计分记录,达标关联当日
  英语打卡,错题进错题本,家长可见成绩
- 家长"今日概览"改"学习概览",月日历展示每日打卡/语法点亮/周检测
- 任务模板改日历展示,灵活添加:某一天/每周X/本周/日期区间批量,可删
- 家长中心新增"课程管理"栏目(语法课程编辑+周测成绩),设备管理弱化为
  栏目内二级区块

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-08-03 23:39:52 +08:00

59 lines
1.9 KiB
TypeScript

import Link from "next/link";
import { redirect } from "next/navigation";
import { BackgroundBlobs } from "@/components/background-blobs";
import { getSessionUser } from "@/lib/auth";
import { listWrong } from "@/lib/wrongbook";
import type { QuizQ } from "@/lib/quiz-parse";
import { WrongRow } from "./wrong-row";
export default async function WrongBookPage() {
const user = await getSessionUser();
if (!user) redirect("/join");
if (user.role !== "child") redirect("/parent");
const rows = await listWrong(user.id);
const open = rows.filter((r) => !r.mastered).length;
return (
<main className="relative mx-auto max-w-2xl space-y-5 p-4 pb-12">
<BackgroundBlobs />
<header className="flex items-center justify-between">
<Link href="/kid" className="text-sm font-medium text-indigo-600">
← 返回
</Link>
<h1 className="text-xl font-extrabold text-slate-900">我的错题本</h1>
<span className="text-xs text-muted-foreground">待掌握 {open} 题</span>
</header>
{rows.length === 0 ? (
<div className="rounded-2xl border border-slate-100 bg-white p-8 text-center shadow-soft">
<p className="text-3xl">🎉</p>
<p className="mt-2 font-bold text-slate-900">还没有错题,继续保持!</p>
</div>
) : (
<div className="space-y-3">
{rows.map((r) => {
let q: QuizQ;
try {
q = JSON.parse(r.question) as QuizQ;
} catch {
return null;
}
return (
<WrongRow
key={r.id}
id={r.id}
sourceTitle={r.sourceTitle}
q={q}
userAnswer={r.userAnswer}
correctAnswer={r.correctAnswer}
mastered={r.mastered}
/>
);
})}
</div>
)}
</main>
);
}