From 1f89b2734f21c3b99b01170315bc40a251a2010c Mon Sep 17 00:00:00 2001 From: charlie <charlie@lvguanqingdeMacBook-Pro.local> Date: 星期一, 24 一月 2022 17:18:37 +0800 Subject: [PATCH] fixed:修正顧問結案頁面的身份證ID驗證規則 --- PAMapp/pages/appointment/_appointmentId/close/index.vue | 24 ++++++++++++++++++++++-- 1 files changed, 22 insertions(+), 2 deletions(-) diff --git a/PAMapp/pages/appointment/_appointmentId/close/index.vue b/PAMapp/pages/appointment/_appointmentId/close/index.vue index a267a72..0514edc 100644 --- a/PAMapp/pages/appointment/_appointmentId/close/index.vue +++ b/PAMapp/pages/appointment/_appointmentId/close/index.vue @@ -210,6 +210,27 @@ this.$router.push(`/myAppointmentList/contactedList`); } + checkIdentityId (id) { + const tab = "ABCDEFGHJKLMNPQRSTUVXYWZIO"; + const A1 = [ 1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3 ]; + const A2 = [ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5 ]; + const Mx = [ 9,8,7,6,5,4,3,2,1,1 ]; + + if ( id.length != 10 ) return false; + let i = tab.indexOf( id.charAt(0) ); + if ( i == -1 ) return false; + let sum = A1[i] + A2[i]*9; + + for ( i=1; i<10; i++ ) { + const v = parseInt( id.charAt(i) ); + if ( isNaN(v) ) return false; + sum = sum + v * Mx[i]; + } + + if ( sum % 10 != 0 ) return false; + return true; +} + get isSubmitBtnDisabled() { const { selectCloseOption, @@ -228,9 +249,8 @@ } get identityIdValid() { - const rule = /^[A-Z]\d{9}$/; const identityId = this.appointmentCloseInfo.policyholderIdentityId; - return identityId ? rule.test(identityId) : true; + return identityId ? this.checkIdentityId(identityId) : true; } } -- Gitblit v1.8.0