diff --git a/src/api/hisApi.ts b/src/api/hisApi.ts index fbfdb81..fa620ca 100644 --- a/src/api/hisApi.ts +++ b/src/api/hisApi.ts @@ -28,6 +28,7 @@ export interface PatientInfo { phone: string; marital: number; marital_name: string; + is_valid_exam: number; } // VIP认证结果 diff --git a/src/pages/U2/u2.css b/src/pages/U2/u2.css index f9e6722..4bcb4b6 100644 --- a/src/pages/U2/u2.css +++ b/src/pages/U2/u2.css @@ -27,10 +27,26 @@ background: url(../../assets/u2-card.png) 100% no-repeat; background-size: 100% 100%; box-sizing: border-box; + display: flex; + flex-direction: column; + padding: 40px 48px; +} + +.u2-info-top { display: flex; flex-direction: row; align-items: center; - padding: 40px 48px; + width: 100%; + flex: 1; +} + +.u2-error-msg { + width: 100%; + text-align: center; + color: red; + font-size: 28px; + font-weight: bold; + margin-top: 10px; } .u2-avatar-container { diff --git a/src/pages/U2/u2.tsx b/src/pages/U2/u2.tsx index 4db0cc8..09f7c23 100644 --- a/src/pages/U2/u2.tsx +++ b/src/pages/U2/u2.tsx @@ -70,6 +70,11 @@ const U2: React.FC = () => { }; const handleConfirm = () => { + // 判断是否为有效签到 + if (!patientInfo?.is_valid_exam || patientInfo.is_valid_exam !== 1) { + // alert("当前签到无效,请联系前台工作人员处理"); + return; + } if (!idCardNo) { alert("未获取到身份证号,请重新刷卡"); navigate("/"); @@ -130,7 +135,7 @@ const U2: React.FC = () => { else if (genderName === "女") title = "女士"; return `尊敬的${ firstChar ? `${firstChar}${title}` : title - },欢迎您的到来:`; + },请确认您的个人信息:`; }; // 返回头像地址:使用 gender_name 字段("女" 显示女性头像),忽略 photo_path @@ -147,6 +152,17 @@ const U2: React.FC = () => { return genderName; }; + // 脱敏证件号:保留前6后4,其余替换为* + const maskIdCard = (id?: string | null) => { + if (!id) return "---"; + const s = String(id).trim(); + if (s.length <= 10) return s.replace(/.(?!.{4})/g, "*"); + const head = s.slice(0, 6); + const tail = s.slice(-4); + const middleLen = s.length - 10; + return head + "*".repeat(middleLen) + tail; + }; + // 在数据加载时显示占位,加载完成后再渲染完整内容 if (loading) { return <>; @@ -157,52 +173,62 @@ const U2: React.FC = () => { {getGreeting()}
-
- avatar -
-
-
-
-
- 姓名:{loading ? "" : patientInfo?.name || "---"} -
+
+
+ avatar
- -
-
-
- 性别:{loading ? "" : getGenderLabel()} +
+
+
+
+ 姓名:{loading ? "" : patientInfo?.name || "---"} +
-
-
-
-
- 年龄:{loading ? "" : patientInfo?.age || "---"} +
+
+
+ 性别:{loading ? "" : getGenderLabel()} +
-
-
-
-
- 证件号:{idCardNo || patientInfo?.IdCard || "---"} +
+
+
+ 年龄:{loading ? "" : patientInfo?.age || "---"} +
-
-
-
-
- 手机号:{loading ? "" : patientInfo?.phone || "---"} +
+
+
+ 证件号: + {loading ? "" : maskIdCard(idCardNo || patientInfo?.IdCard)} +
-
-
-
-
- 婚姻状况:{loading ? "" : patientInfo?.marital_name || "---"} +
+
+
+ 手机号:{loading ? "" : patientInfo?.phone || "---"} +
+
+ +
+
+
+ 婚姻状况:{loading ? "" : patientInfo?.marital_name || "---"} +
+ {!patientInfo?.is_valid_exam || patientInfo.is_valid_exam !== 1 ? ( +
+ 未查询到您当日的体检预约信息,建议核对预约日期! +
+ ) : ( + "" + )}
* 如信息有误,请联系前台