修复 IDCard 读取日志格式,优化错误信息提示
This commit is contained in:
@@ -51,7 +51,7 @@ const U1: React.FC = () => {
|
||||
window.electronAPI.log("info", `[idcard-data] received`);
|
||||
window.electronAPI.log(
|
||||
"info",
|
||||
`Read IDCard success: ${payload.name} ${payload.id_card_no}`
|
||||
`Read IDCard success: ${payload.name} ${payload.id_card_no}`,
|
||||
);
|
||||
|
||||
// 清理倒计时
|
||||
@@ -75,7 +75,7 @@ const U1: React.FC = () => {
|
||||
.catch((e: any) => console.error(e));
|
||||
}, 1000);
|
||||
})
|
||||
.catch(() => { });
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
// 先验证档案信息,查询到才跳转
|
||||
@@ -92,13 +92,15 @@ const U1: React.FC = () => {
|
||||
.then((res) => {
|
||||
if (res.Status === 200 && res.Data) {
|
||||
// 查询成功,跳转到 u2
|
||||
window.electronAPI.stopIdCardListen().catch(() => { });
|
||||
window.electronAPI.stopIdCardListen().catch(() => {});
|
||||
setReading(false);
|
||||
isProcessingRef.current = false;
|
||||
navigate("/u2");
|
||||
} else {
|
||||
// 未查询到档案信息,显示错误提示,不跳转
|
||||
setErrorMsg("未查询到您的档案信息,详情请咨询前台工作人员!");
|
||||
setErrorMsg(
|
||||
res.Message || "未查询到您的档案信息,详情请咨询前台工作人员!",
|
||||
);
|
||||
setReading(false);
|
||||
isProcessingRef.current = false;
|
||||
resetListening();
|
||||
@@ -119,7 +121,7 @@ const U1: React.FC = () => {
|
||||
});
|
||||
|
||||
return () => {
|
||||
window.electronAPI.stopIdCardListen().catch(() => { });
|
||||
window.electronAPI.stopIdCardListen().catch(() => {});
|
||||
window.electronAPI.removeIdCardListeners();
|
||||
if (timerRef.current) clearTimeout(timerRef.current);
|
||||
if (intervalRef.current) clearInterval(intervalRef.current);
|
||||
|
||||
Reference in New Issue
Block a user