diff --git a/src/app/parent/actions.ts b/src/app/parent/actions.ts index 56cb056..f531688 100644 --- a/src/app/parent/actions.ts +++ b/src/app/parent/actions.ts @@ -346,6 +346,8 @@ function validateQuestionsJson(raw: string): { error?: string; count?: number } const t = q.type; if (!EXAM_TYPES.includes(t as string)) return { error: `${no}的 type 非法:${String(t)}` }; if ((t === "choice" || t === "judge") && typeof q.answer !== "number") return { error: `${no}(${t})缺少答案(answer 数字)` }; + if (t === "choice" && (!Array.isArray(q.options) || q.options.length === 0)) return { error: `${no}(choice)缺少选项(options)` }; + if (t === "order" && (!Array.isArray(q.words) || q.words.length === 0)) return { error: `${no}(order)缺少词块(words)` }; if (t === "fill" && !Array.isArray(q.answers)) return { error: `${no}(fill)缺少参考答案(answers 数组)` }; if (t === "order" && !Array.isArray(q.answer)) return { error: `${no}(order)缺少答案(answer 数组)` }; if (t === "match" && !Array.isArray(q.pairs)) return { error: `${no}(match)缺少配对(pairs 数组)` }; diff --git a/src/app/parent/weekly-records/weekly-list.tsx b/src/app/parent/weekly-records/weekly-list.tsx index 4de1267..371c55b 100644 --- a/src/app/parent/weekly-records/weekly-list.tsx +++ b/src/app/parent/weekly-records/weekly-list.tsx @@ -2,7 +2,7 @@ import { useState, useTransition } from "react"; import { useRouter } from "next/navigation"; -import { Check, Pencil, RotateCcw, Trash2, X } from "lucide-react"; +import { Check, Pencil, Trash2, X } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Checkbox } from "@/components/ui/checkbox"; import { Input } from "@/components/ui/input";