feat: add word import and class type display controls
Build Docker Package / docker-package (push) Successful in 6m34s

This commit is contained in:
2026-07-02 14:34:00 +08:00
parent 0378504be0
commit 17fc24edc7
16 changed files with 844 additions and 66 deletions
+25
View File
@@ -0,0 +1,25 @@
import { NextRequest } from "next/server";
import { listWords } from "@/lib/db";
import { buildWordExcel } from "@/lib/word-excel";
export const runtime = "nodejs";
export const dynamic = "force-dynamic";
export async function GET(request: NextRequest) {
const searchParams = request.nextUrl.searchParams;
const grade = searchParams.get("grade") ?? undefined;
const classTypeId = Number(searchParams.get("classTypeId"));
const words = listWords({
grade,
classTypeId: Number.isFinite(classTypeId) && classTypeId > 0 ? classTypeId : undefined,
});
const workbook = buildWordExcel(words);
return new Response(workbook, {
headers: {
"Content-Type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"Content-Disposition": `attachment; filename="${encodeURIComponent("词库导入表格")}.xlsx"`,
"Cache-Control": "no-store",
},
});
}