实名
This commit is contained in:
parent
79ad42e43c
commit
b0c62bb226
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user