From 0857197c6501e12da8476c10df26ad63dc709240 Mon Sep 17 00:00:00 2001 From: xiezhijun <15270898033@163.com> Date: Thu, 14 Jan 2021 14:20:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=88=E5=90=8C=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E7=9A=84=E8=AF=81=E4=BB=B6=E9=AA=8C=E8=AF=81=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- stdiet-ui/src/utils/ruoyi.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/stdiet-ui/src/utils/ruoyi.js b/stdiet-ui/src/utils/ruoyi.js index 87e1f30f4..442a66f0a 100644 --- a/stdiet-ui/src/utils/ruoyi.js +++ b/stdiet-ui/src/utils/ruoyi.js @@ -266,17 +266,24 @@ export function validatorIDCard(idcode, type) { // 规则: 新版8位或18位数字, 旧版10位数字 + 英文字母 // 样本: 12345678 或 1234567890B const reg = /^\d{8}|^[a-zA-Z0-9]{10}|^\d{18}$/; - if (reg.test(card) === false) { + if (reg.test(idcode) === false) { return {code: -1, msg: '台湾居民来往大陆通行证号码不合规'}; } else { return {code: 1, msg: '校验通过'}; } - } else if (type === 4) { + }else if(type === 4){ + if(idcode != null && idcode != undefined && idcode.trim() != ""){ + //暂时先放开 + return {code: 1, msg: '校验通过'}; + } + return {code: -1, msg: '护照号格式不正确'}; + } + else if (type === 5) { // 军官证 // 规则: 军/兵/士/文/职/广/(其他中文) + "字第" + 4到8位字母或数字 + "号" // 样本: 军字第2001988号, 士字第P011816X号 - const reg = /^[\u4E00-\u9FA5](字第)([0-9a-zA-Z]{4,8})(号?)$/; - if (reg.test(card) === false) { + const reg = /^([0-9a-zA-Z]{4,8})(号?)$/; + if (reg.test(idcode) === false) { return {code: -1, msg: '军官证号不合规'}; } else { return {code: 1, msg: '校验通过'};