From fde534e0fe966da638a294405dac9cf86eecbd63 Mon Sep 17 00:00:00 2001 From: yuchenglong Date: Thu, 20 Nov 2025 15:23:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E8=BA=AB=E4=BB=BD=E8=AF=81?= =?UTF-8?q?=E8=AF=BB=E5=8F=96=E9=94=99=E8=AF=AF=E6=97=B6=E6=81=A2=E5=A4=8D?= =?UTF-8?q?=20UI=20=E7=8A=B6=E6=80=81=E5=B9=B6=E6=B7=BB=E5=8A=A0=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/U1/u1.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/pages/U1/u1.tsx b/src/pages/U1/u1.tsx index 62430ab..4b6edc5 100644 --- a/src/pages/U1/u1.tsx +++ b/src/pages/U1/u1.tsx @@ -70,6 +70,14 @@ const U1: React.FC = () => { window.electronAPI.onIdCardError((e: any) => { console.error("[idcard-error]", e.payload); window.electronAPI.log("error", `[idcard-error] ${e.payload}`); + // 发生错误时立即恢复 UI 状态 + if (timerRef.current) { + clearTimeout(timerRef.current); + timerRef.current = null; + } + setReading(false); + window.electronAPI.stopIdCardListen().catch(() => {}); + alert(`读取身份证失败: ${e.payload}`); }); return () => {