diff --git a/src/app/parent/dashboard.tsx b/src/app/parent/dashboard.tsx index 98e99a0..e43a19b 100644 --- a/src/app/parent/dashboard.tsx +++ b/src/app/parent/dashboard.tsx @@ -9,7 +9,6 @@ import { ChildManage } from "./child-manage"; import { DevicesTab } from "./devices-tab"; import { OverviewTab } from "./overview-tab"; import { TemplatesTab } from "./templates-tab"; -import { PlayBtn } from "@/components/play-audio"; export type DayCell = { done: number; @@ -57,16 +56,6 @@ export type DevicesData = { }[]; }; export type WeeklyRow = { childName: string; weekKey: string; score: number; passed: boolean }; -export type RecordingRow = { childName: string; word: string; url: string; at: string }; -export type GrammarTestRow = { childName: string; title: string; score: number; passed: boolean; at: string }; -export type WrongItemRow = { - childName: string; - stem: string; - userAnswer: string; - correctAnswer: string; - sourceTitle: string; - mastered: boolean; -}; const tabCls = "data-[state=active]:bg-white data-[state=active]:text-indigo-600 data-[state=active]:shadow-soft"; @@ -85,17 +74,11 @@ export function ParentDashboard({ templates, devices, weekly, - recordings, - grammarTests, - wrongItems, }: { overview: OverviewData; templates: TemplatesData; devices: DevicesData; weekly: WeeklyRow[]; - recordings: RecordingRow[]; - grammarTests: GrammarTestRow[]; - wrongItems: WrongItemRow[]; }) { return (
@@ -149,45 +132,6 @@ export function ParentDashboard({ ))} -
-

🎙️ 单词跟读录音

-
- {recordings.length === 0 &&

暂无跟读录音

} - {recordings.map((r, i) => ( -
- {r.childName} - {r.word} - -
- ))} -
-
-
-

📘 英语语法检测

-
- {grammarTests.length === 0 &&

暂无检测记录

} - {grammarTests.map((g, i) => ( -

- {g.childName} · {g.title} · {g.score} 分 {g.passed ? "✅" : "❌"} -

- ))} -
-
-
-

📒 孩子错题本

-
- {wrongItems.length === 0 &&

暂无错题

} - {wrongItems.map((w, i) => ( -
-

- {w.childName} · {w.stem} -

-

答:{w.userAnswer || "未作答"}

-

正:{w.correctAnswer}

-
- ))} -
-
diff --git a/src/app/parent/page.tsx b/src/app/parent/page.tsx index d0327b7..0359192 100644 --- a/src/app/parent/page.tsx +++ b/src/app/parent/page.tsx @@ -191,90 +191,12 @@ export default async function ParentPage() { passed: w.passed, })); - // ===== 单词跟读录音(课程管理回放) ===== - const recRows = await db - .select({ - childName: users.displayName, - word: wordRecording.word, - ossKey: wordRecording.ossKey, - createdAt: wordRecording.createdAt, - }) - .from(wordRecording) - .innerJoin(users, eq(users.id, wordRecording.childUserId)) - .where(eq(users.familyId, parent.familyId)) - .orderBy(desc(wordRecording.createdAt)) - .limit(20); - const recordings = recRows.map((r) => ({ - childName: r.childName, - word: r.word, - url: viewUrl(r.ossKey), - at: dstr(r.createdAt), - })); - - // ===== 英语语法检测明细 ===== - const grammarRows = await db - .select({ - childName: users.displayName, - title: grammarPoints.title, - score: grammarProgress.score, - passed: grammarProgress.passed, - completedAt: grammarProgress.completedAt, - }) - .from(grammarProgress) - .innerJoin(users, eq(users.id, grammarProgress.childUserId)) - .innerJoin(grammarPoints, eq(grammarPoints.pointId, grammarProgress.pointId)) - .where(eq(users.familyId, parent.familyId)) - .orderBy(desc(grammarProgress.completedAt)) - .limit(20); - const grammarTests = grammarRows.map((g) => ({ - childName: g.childName, - title: g.title, - score: g.score ?? 0, - passed: g.passed, - at: g.completedAt ? dstr(g.completedAt) : "", - })); - - // ===== 孩子错题数据 ===== - const wrongRows = await db - .select({ - childName: users.displayName, - question: wrongBook.question, - userAnswer: wrongBook.userAnswer, - correctAnswer: wrongBook.correctAnswer, - sourceTitle: wrongBook.sourceTitle, - mastered: wrongBook.mastered, - }) - .from(wrongBook) - .innerJoin(users, eq(users.id, wrongBook.childUserId)) - .where(eq(users.familyId, parent.familyId)) - .orderBy(desc(wrongBook.createdAt)) - .limit(30); - const wrongItems = wrongRows.map((w) => { - let stem = ""; - try { - stem = (JSON.parse(w.question) as { stem?: string }).stem ?? ""; - } catch { - stem = ""; - } - return { - childName: w.childName, - stem, - userAnswer: w.userAnswer ?? "", - correctAnswer: w.correctAnswer ?? "", - sourceTitle: w.sourceTitle ?? "", - mastered: w.mastered, - }; - }); - return ( ); }