lizhenhao 2 年 前
コミット
636f84507d
1 ファイル変更21 行追加23 行削除
  1. 21 23
      src/views/modules/sys/userInfo/UserInfoForm.vue

+ 21 - 23
src/views/modules/sys/userInfo/UserInfoForm.vue

@@ -1455,9 +1455,9 @@
         this.inputForm.signatureUrl = res.url
         this.inputForm.signatureUrl = res.url
         this.$forceUpdate()
         this.$forceUpdate()
       },
       },
-      handleAvatarSuccess3 (res, file ,scope) {
-          this.sysUserEducations[scope.$rowIndex].educationCertificateUrl = res.url
-          this.$forceUpdate()
+      handleAvatarSuccess3 (res, file, scope) {
+        this.sysUserEducations[scope.$rowIndex].educationCertificateUrl = res.url
+        this.$forceUpdate()
       },
       },
       handleAvatarSuccess4 (res, file, scope) {
       handleAvatarSuccess4 (res, file, scope) {
         this.sysUserEducations[scope.$rowIndex].degreeCertificateUrl = res.url
         this.sysUserEducations[scope.$rowIndex].degreeCertificateUrl = res.url
@@ -2129,12 +2129,11 @@
       },
       },
 
 
       // 身份证验证
       // 身份证验证
-      async validID(rule, value, callback)
-      {
+      async validID (rule, value, callback) {
         // 身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X
         // 身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X
         let reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/
         let reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/
         if (reg.test(value)) {
         if (reg.test(value)) {
-          await this.go(value.length);
+          await this.go(value.length)
           callback()
           callback()
         } else {
         } else {
           callback(new Error('身份证号码不正确'))
           callback(new Error('身份证号码不正确'))
@@ -2143,25 +2142,24 @@
 
 
       // 实现自动生成生日/年龄
       // 实现自动生成生日/年龄
       go (val) {
       go (val) {
-        let iden = this.inputForm.idCard;
-        let sex = null;
-        let birth = null;
-        let myDate = new Date();
-        let month = myDate.getMonth() + 1;
-        let day = myDate.getDate();
-        let age = 0;
-
-        if(val===18){
-          age = myDate.getFullYear() - iden.substring(6, 10) - 1;
-          sex = iden.substring(16,17);
-          birth = iden.substring(6,10)+"-"+iden.substring(10,12)+"-"+iden.substring(12,14);
+        let iden = this.inputForm.idCard
+        let sex = null
+        let birth = null
+        let myDate = new Date()
+        let month = myDate.getMonth() + 1
+        let day = myDate.getDate()
+        let age = 0
+
+        if (val === 18) {
+          age = myDate.getFullYear() - iden.substring(6, 10) - 1
+          sex = iden.substring(16, 17)
+          birth = iden.substring(6, 10) + '-' + iden.substring(10, 12) + '-' + iden.substring(12, 14)
           if ((iden.substring(10, 12) < month || iden.substring(10, 12) === month) && iden.substring(12, 14) <= day) age++
           if ((iden.substring(10, 12) < month || iden.substring(10, 12) === month) && iden.substring(12, 14) <= day) age++
-
         }
         }
-        if(val===15){
-          age = myDate.getFullYear() - iden.substring(6, 8) - 1901;
-          sex = iden.substring(13,14);
-          birth = "19"+iden.substring(6,8)+"-"+iden.substring(8,10)+"-"+iden.substring(10,12);
+        if (val === 15) {
+          age = myDate.getFullYear() - iden.substring(6, 8) - 1901
+          sex = iden.substring(13, 14)
+          birth = '19' + iden.substring(6, 8) + '-' + iden.substring(8, 10) + '-' + iden.substring(10, 12)
           if ((iden.substring(8, 10) < month || iden.substring(8, 10) === month) && iden.substring(10, 12) <= day) age++
           if ((iden.substring(8, 10) < month || iden.substring(8, 10) === month) && iden.substring(10, 12) <= day) age++
         }
         }
         this.inputForm.age = age
         this.inputForm.age = age