From 536b7f23c6937ce027c44229e3d62d072b3dd7be Mon Sep 17 00:00:00 2001 From: yanlongqi Date: Sat, 8 Nov 2025 21:27:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E9=80=89=E9=A1=B9?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=9A=84=E9=98=B2=E5=BE=A1=E6=80=A7=E6=A3=80?= =?UTF-8?q?=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在ExamOnline和ExamPrint中对question.options添加空值检查 - 使用 (question.options || []) 防止 undefined 错误 - 确保在选项数据缺失时不会导致页面崩溃 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- web/src/pages/ExamOnline.tsx | 4 ++-- web/src/pages/ExamPrint.tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/web/src/pages/ExamOnline.tsx b/web/src/pages/ExamOnline.tsx index 89c2ba9..e125d6c 100644 --- a/web/src/pages/ExamOnline.tsx +++ b/web/src/pages/ExamOnline.tsx @@ -288,7 +288,7 @@ const ExamOnline: React.FC = () => { > - {question.options.map((opt) => ( + {(question.options || []).map((opt) => ( {opt.key}. {opt.value} @@ -315,7 +315,7 @@ const ExamOnline: React.FC = () => { > - {question.options.map((opt) => ( + {(question.options || []).map((opt) => ( {opt.key}. {opt.value} diff --git a/web/src/pages/ExamPrint.tsx b/web/src/pages/ExamPrint.tsx index ca3ae82..2681a79 100644 --- a/web/src/pages/ExamPrint.tsx +++ b/web/src/pages/ExamPrint.tsx @@ -210,7 +210,7 @@ const ExamPrint: React.FC = () => {
- {question.options.map((opt) => ( + {(question.options || []).map((opt) => (
{opt.key}. {opt.value}
@@ -237,7 +237,7 @@ const ExamPrint: React.FC = () => {
- {question.options.map((opt) => ( + {(question.options || []).map((opt) => (
{opt.key}. {opt.value}