Some checks failed
CI / build-deploy (push) Has been cancelled
- RBAC: 新增30个权限点、DataScope行级权限、requirePermission守卫,所有57+ Server Action接入权限校验 - UI拆分: exam-form(1623行→11文件)、textbook-reader(744行→7文件),均降至300行以内 - 测试: 新增5个单元测试文件(19用例),修复4个集成测试文件(38用例全部通过) - 架构文档: 新增架构影响地图(004/005)、标准功能清单(006)、差距审计报告(007) - 项目规则: 架构图优先规则,改码必同步图 - 安全: rehype-sanitize净化、AES加密API Key、权限路由守卫 - 无障碍: skip-link、aria-label、prefers-reduced-motion - 性能: next/font优化、next/image、代码分割
44 lines
1.7 KiB
TypeScript
44 lines
1.7 KiB
TypeScript
import { HomeworkAssignmentForm } from "@/modules/homework/components/homework-assignment-form"
|
|
import { getExams } from "@/modules/exams/data-access"
|
|
import { getTeacherClasses } from "@/modules/classes/data-access"
|
|
import { EmptyState } from "@/shared/components/ui/empty-state"
|
|
import { getAuthContext } from "@/shared/lib/auth-guard"
|
|
import { FileQuestion } from "lucide-react"
|
|
|
|
export const dynamic = "force-dynamic"
|
|
|
|
export default async function CreateHomeworkAssignmentPage() {
|
|
const { dataScope } = await getAuthContext()
|
|
const [exams, classes] = await Promise.all([getExams({ scope: dataScope }), getTeacherClasses()])
|
|
const options = exams.map((e) => ({ id: e.id, title: e.title }))
|
|
|
|
return (
|
|
<div className="flex h-full flex-col space-y-8 p-8">
|
|
<div className="flex items-center justify-between">
|
|
<div>
|
|
<h2 className="text-2xl font-bold tracking-tight">Create Assignment</h2>
|
|
<p className="text-muted-foreground">Dispatch homework from an existing exam.</p>
|
|
</div>
|
|
</div>
|
|
|
|
{options.length === 0 ? (
|
|
<EmptyState
|
|
title="No exams available"
|
|
description="Create an exam first, then dispatch it as homework."
|
|
icon={FileQuestion}
|
|
action={{ label: "Create Exam", href: "/teacher/exams/create" }}
|
|
/>
|
|
) : classes.length === 0 ? (
|
|
<EmptyState
|
|
title="No classes available"
|
|
description="Create a class first, then publish homework to that class."
|
|
icon={FileQuestion}
|
|
action={{ label: "Go to Classes", href: "/teacher/classes/my" }}
|
|
/>
|
|
) : (
|
|
<HomeworkAssignmentForm exams={options} classes={classes} />
|
|
)}
|
|
</div>
|
|
)
|
|
}
|