feat(P2): 实现选课管理、考试监考、学情诊断三大功能模块
## 新增功能模块 ### 1. 选课管理(elective) - 新增表:electiveCourses、courseSelections - 新增权限:ELECTIVE_MANAGE/ELECTIVE_READ/ELECTIVE_SELECT - 支持先到先得 + 抽签两种选课模式 - admin/teacher/student 三端页面 ### 2. 考试监考(proctoring) - exams 表扩展:examMode/durationMinutes/antiCheatEnabled 等字段 - 新增表:examProctoringEvents - 新增权限:EXAM_PROCTOR/EXAM_PROCTOR_READ - 教师监考面板 + 学生端防作弊监控 - API:/api/proctoring/event 接收事件上报 ### 3. 学情诊断报告(diagnostic) - 新增表:knowledgePointMastery、learningDiagnosticReports - 新增权限:DIAGNOSTIC_MANAGE/DIAGNOSTIC_READ - 基于提交答案自动计算知识点掌握度 - 生成个人/班级诊断报告(强项/弱项/建议) - 雷达图可视化 ## 其他改动 - 项目规则:单文件行数限制从 300 行调整为企业级规范(组件≤500/Actions≤800/硬上限1000) - scripts/seed.ts:消除全部 any 类型,定义内部类型,0 lint 错误 - 架构文档 004/005 同步更新三个新模块 - 迁移文件 0001_heavy_sage.sql 生成 ## 验证 - npx tsc --noEmit:0 错误 - npm run lint:0 错误 0 警告
This commit is contained in:
31
src/app/(dashboard)/student/diagnostic/page.tsx
Normal file
31
src/app/(dashboard)/student/diagnostic/page.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
import { Stethoscope } from "lucide-react"
|
||||
import { getAuthContext } from "@/shared/lib/auth-guard"
|
||||
import { getStudentMasterySummary } from "@/modules/diagnostic/data-access"
|
||||
import { getDiagnosticReports } from "@/modules/diagnostic/data-access-reports"
|
||||
import { StudentDiagnosticView } from "@/modules/diagnostic/components/student-diagnostic-view"
|
||||
|
||||
export const dynamic = "force-dynamic"
|
||||
|
||||
export default async function StudentDiagnosticPage() {
|
||||
const ctx = await getAuthContext()
|
||||
|
||||
const [summary, reports] = await Promise.all([
|
||||
getStudentMasterySummary(ctx.userId),
|
||||
getDiagnosticReports({ studentId: ctx.userId }),
|
||||
])
|
||||
|
||||
return (
|
||||
<div className="h-full flex-1 flex-col space-y-8 p-8 md:flex">
|
||||
<div>
|
||||
<h2 className="flex items-center gap-2 text-2xl font-bold tracking-tight">
|
||||
<Stethoscope className="h-6 w-6" />
|
||||
My Diagnostic
|
||||
</h2>
|
||||
<p className="text-muted-foreground">
|
||||
Your knowledge point mastery analysis and diagnostic reports.
|
||||
</p>
|
||||
</div>
|
||||
<StudentDiagnosticView summary={summary} reports={reports} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
49
src/app/(dashboard)/student/elective/page.tsx
Normal file
49
src/app/(dashboard)/student/elective/page.tsx
Normal file
@@ -0,0 +1,49 @@
|
||||
import { auth } from "@/auth"
|
||||
import { Inbox } from "lucide-react"
|
||||
|
||||
import { getAvailableCoursesForStudent, getStudentSelections } from "@/modules/elective/data-access-selections"
|
||||
import { StudentSelectionView } from "@/modules/elective/components/student-selection-view"
|
||||
import { EmptyState } from "@/shared/components/ui/empty-state"
|
||||
|
||||
export const dynamic = "force-dynamic"
|
||||
|
||||
export default async function StudentElectivePage() {
|
||||
const session = await auth()
|
||||
const studentId = String(session?.user?.id ?? "")
|
||||
|
||||
if (!studentId) {
|
||||
return (
|
||||
<div className="flex h-full flex-col space-y-8 p-8">
|
||||
<div>
|
||||
<h2 className="text-2xl font-bold tracking-tight">Elective Courses</h2>
|
||||
<p className="text-muted-foreground">Browse and select elective courses.</p>
|
||||
</div>
|
||||
<EmptyState
|
||||
title="Sign in required"
|
||||
description="Please sign in to view elective courses."
|
||||
icon={Inbox}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const [availableCourses, mySelections] = await Promise.all([
|
||||
getAvailableCoursesForStudent(studentId),
|
||||
getStudentSelections(studentId),
|
||||
])
|
||||
|
||||
return (
|
||||
<div className="flex h-full flex-col space-y-8 p-8">
|
||||
<div>
|
||||
<h2 className="text-2xl font-bold tracking-tight">Elective Courses</h2>
|
||||
<p className="text-muted-foreground">
|
||||
Browse available electives and manage your selections.
|
||||
</p>
|
||||
</div>
|
||||
<StudentSelectionView
|
||||
availableCourses={availableCourses}
|
||||
mySelections={mySelections}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user