From 88c2ee8c52ab2511d385113178599f373b28a293 Mon Sep 17 00:00:00 2001 From: jacobxu666 Date: Wed, 19 Aug 2026 17:13:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E8=AF=95=E5=8D=B7=E9=A2=98=E7=9B=AE?= =?UTF-8?q?=20JSON=20=E6=A0=A1=E9=AA=8C(choice=20options/order=20words)+?= =?UTF-8?q?=20=E5=88=A0=E5=91=A8=E6=B5=8B=E5=88=97=E8=A1=A8=E6=AD=BB?= =?UTF-8?q?=E5=AF=BC=E5=85=A5(=E6=9C=80=E7=BB=88=E8=AF=84=E5=AE=A1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Haiku 4.5 --- src/app/parent/actions.ts | 2 ++ src/app/parent/weekly-records/weekly-list.tsx | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) 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";