Commit 86df61a4 by cwq0219

身份证验证

1 parent 71faa1ea
...@@ -472,7 +472,7 @@ ...@@ -472,7 +472,7 @@
if ((merchantType == 1) && !validator.checkIdCard(value)) { if ((merchantType == 1) && !validator.checkIdCard(value)) {
return '请填入正确的身份证' return '请填入正确的身份证'
} }
if(value && validator.ISCHINESE2.test(value)) { if (value && validator.ISCHINESE2.test(value)) {
return '只能输入数字、字母和符号' return '只能输入数字、字母和符号'
} }
} }
......
...@@ -85,7 +85,7 @@ layui.define(['store'], function (exports) { ...@@ -85,7 +85,7 @@ layui.define(['store'], function (exports) {
var pass = true var pass = true
// 身份证位数为15或18位 // 身份证位数为15或18位
// if (![15, 18].includes(code.length)) { // if (![15, 18].includes(code.length)) {
if ((code.length != 15) || (code.length != 18)) { if (!((code.length == 15) || (code.length == 18))) {
pass = false pass = false
} else if (!code || (code.length === 18 && !/^\d{6}(18|19|20)\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(code))) { } else if (!code || (code.length === 18 && !/^\d{6}(18|19|20)\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(code))) {
// tip = '身份证号格式错误' // tip = '身份证号格式错误'
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!