From 59a31f436ede5a05efb57490a51e59dd04f6f9ce Mon Sep 17 00:00:00 2001 From: liudan <18634735655@163.com> Date: Tue, 4 Jul 2023 23:28:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .hbuilderx/launch.json | 2 +- user/pages/order.vue | 10 +++++---- utils/validate.js | 50 +++++++++++++++++++++--------------------- 3 files changed, 32 insertions(+), 30 deletions(-) diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json index a7cf3e9..a461607 100644 --- a/.hbuilderx/launch.json +++ b/.hbuilderx/launch.json @@ -19,7 +19,7 @@ "type" : "uniCloud" }, { - "playground" : "custom", + "playground" : "standard", "type" : "uni-app:app-android" }, { diff --git a/user/pages/order.vue b/user/pages/order.vue index 376f599..53e1ce4 100644 --- a/user/pages/order.vue +++ b/user/pages/order.vue @@ -244,10 +244,12 @@ }, data() { return { - carTypeList: [{ - id: 1, - title: '出租车' - }, { + carTypeList: [ + // { + // id: 1, + // title: '出租车' + // }, + { id: 0, title: '公交/地铁' }, ], diff --git a/utils/validate.js b/utils/validate.js index 180141c..0b43ce5 100644 --- a/utils/validate.js +++ b/utils/validate.js @@ -110,35 +110,35 @@ const strategies = { } }, isIdCard: function(value, errorMsg) { - var regIdCard = - /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/; + // var regIdCard = /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/; + var regIdCard = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/; if (value == null || value.length < 1) { return errorMsg; } if (regIdCard.test(value)) { - if (value.length == 18) { - var idCardWi = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, - 2); //将前17位加权因子保存在数组里 - var idCardY = new Array(1, 0, 10, 9, 8, 7, 6, 5, 4, 3, - 2); //这是除以11后,可能产生的11位余数、验证码,也保存成数组 - var idCardWiSum = 0; //用来保存前17位各自乖以加权因子后的总和 - for (var i = 0; i < 17; i++) { - idCardWiSum += value.substring(i, i + 1) * idCardWi[i]; - } - var idCardMod = idCardWiSum % 11; //计算出校验码所在数组的位置 - var idCardLast = value.substring(17); //得到最后一位身份证号码 - //如果等于2,则说明校验码是10,身份证号码最后一位应该是X - if (idCardMod == 2) { - if (idCardLast == "X" || idCardLast == "x") {} else { - return `${value} 身份证号码最后一位应为X`; - } - } else { - //用计算出的验证码与最后一位身份证号码匹配,如果一致,说明通过,否则是无效的身份证号码 - if (idCardLast == idCardY[idCardMod]) {} else { - return `${value} 身份证号码无效`; - } - } - } + // if (value.length == 18) { + // var idCardWi = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, + // 2); //将前17位加权因子保存在数组里 + // var idCardY = new Array(1, 0, 10, 9, 8, 7, 6, 5, 4, 3, + // 2); //这是除以11后,可能产生的11位余数、验证码,也保存成数组 + // var idCardWiSum = 0; //用来保存前17位各自乖以加权因子后的总和 + // for (var i = 0; i < 17; i++) { + // idCardWiSum += value.substring(i, i + 1) * idCardWi[i]; + // } + // var idCardMod = idCardWiSum % 11; //计算出校验码所在数组的位置 + // var idCardLast = value.substring(17); //得到最后一位身份证号码 + // //如果等于2,则说明校验码是10,身份证号码最后一位应该是X + // if (idCardMod == 2) { + // if (idCardLast == "X" || idCardLast == "x") {} else { + // return `${value} 身份证号码最后一位应为X`; + // } + // } else { + // //用计算出的验证码与最后一位身份证号码匹配,如果一致,说明通过,否则是无效的身份证号码 + // if (idCardLast == idCardY[idCardMod]) {} else { + // return `${value} 身份证号码无效`; + // } + // } + // } } else { return `${value} 身份证号码无效`; }