This commit is contained in:
18631081161 2026-01-29 17:50:55 +08:00
parent 79ad42e43c
commit b0c62bb226
2 changed files with 36 additions and 9 deletions

View File

@ -463,11 +463,21 @@
const handleSubmitVerification = async () => {
if (!canSubmit.value || submitting.value) return
//
const idCardRegex = /^[1-9]\d{5}(19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$/
if (!idCardRegex.test(idCardNumber.value)) {
//
const idCard = idCardNumber.value.trim()
if (idCard.length !== 18) {
uni.showToast({
title: '请输入正确的身份证号',
title: '身份证号必须是18位',
icon: 'none'
})
return
}
//
const idCardRegex = /^[1-9]\d{5}(19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$/
if (!idCardRegex.test(idCard)) {
uni.showToast({
title: '身份证号格式不正确,请检查',
icon: 'none'
})
return

View File

@ -173,15 +173,32 @@ public class AliyunRealNameProvider : IRealNameProvider
/// </summary>
private static string GetErrorMessage(string? bizCode, string? message)
{
return bizCode switch
// 先检查 bizCode
var bizCodeMsg = bizCode switch
{
"1" => "验证通过",
"2" => "姓名与身份证号不一致",
"3" => "身份证号不存在",
"4" => "身份证号格式错误",
"2" => "姓名与身份证号不一致,请核对后重新输入",
"3" => "身份证号不存在,请检查是否输入正确",
"4" => "身份证号格式错误请输入18位有效身份证号",
"5" => "服务异常,请稍后重试",
_ => message ?? "验证失败,请检查身份信息是否正确"
_ => null
};
if (bizCodeMsg != null)
return bizCodeMsg;
// 检查 message 中的特定错误
if (!string.IsNullOrEmpty(message))
{
if (message.Contains("identifyNum") || message.Contains("IdentifyNum"))
return "身份证号格式错误请输入正确的18位身份证号";
if (message.Contains("userName") || message.Contains("UserName"))
return "姓名格式错误,请输入正确的中文姓名";
if (message.Contains("参数非法"))
return "输入信息格式错误,请检查姓名和身份证号是否正确";
}
return message ?? "验证失败,请检查身份信息是否正确";
}
private static string MaskIdCard(string idCard)