Browse Source

个人认证创建页面添加规则

sunjh 6 years ago
parent
commit
bcf13271ba
1 changed files with 35 additions and 30 deletions
  1. 35 30
      src/components/authen/IndividualAuthenticationCreate.vue

+ 35 - 30
src/components/authen/IndividualAuthenticationCreate.vue

@@ -23,16 +23,16 @@
           <!--{{authentication.photo}}</a>-->
           <!--</div>-->
         </el-form-item>
-        <el-form-item label="身份证号" prop="name">
+        <el-form-item label="身份证号" prop="IDCard">
           <el-input size="small" v-if="isModifyMode" v-model="authentication.IDCard"></el-input>
           <!--<span v-if="!isModifyMode">{{authentication.name}}</span>-->
         </el-form-item>
 
-        <el-form-item label="银行卡账户" prop="name">
+        <el-form-item label="银行卡账户" prop="bankAccount">
           <el-input size="small" v-if="isModifyMode" v-model="authentication.bankAccount"></el-input>
           <!--<span v-if="!isModifyMode">{{authentication.bankAccount}}</span>-->
         </el-form-item>
-        <el-form-item label="地址" prop="name">
+        <el-form-item label="地址" prop="address">
           <el-input size="small" v-if="isModifyMode" v-model="authentication.address"></el-input>
           <!--<span v-if="!isModifyMode">{{authentication.address}}</span>-->
         </el-form-item>
@@ -82,23 +82,20 @@ export default {
         address: '',
       },
       rules: {
-        // name: [
-        //   {required: true, message: '请输入报告名称', trigger: 'blur'}
-        //   // { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
-        // ],
-        // abstract: [
-        //   {
-        //     required: true,
-        //     message: '请输入摘要信息',
-        //     trigger: 'change'
-        //   }
-        // ],
-        // type: [
-        //   {required: true, message: '请选择报告类型', trigger: 'change'}
-        // ],
-        // conclusion: [
-        //   {required: true, message: '请输入报告结论', trigger: 'blur'}
-        // ]
+        IDCard: [
+          {required: true, message: '请输入身份证号', trigger: 'blur'},
+          {min: 18, max: 18, message: '身份证号输入有误', trigger: 'blur'}
+        ],
+        realName: [
+          {required: true, message: '请输入身份证上的姓名', trigger: 'blur'},
+        ],
+        bankAccount: [
+          {required: true, message: '请输入银行卡账户', trigger: 'blur'}
+        ],
+        address: [
+          {required: true, message: '请输入地址', trigger: 'blur'}
+        ],
+
       }
     }
   },
@@ -122,16 +119,24 @@ export default {
     //提交认证信息
     submitInfo () {
       //this.isModifyMode = false
-      this.showLoading()
-      const newAuthentication = {
-        userId: this.user.userVO.id,
-        realName: this.authentication.realName,
-        IDCard: this.authentication.IDCard,
-        IDCardPhoto: this.authentication.IDCardPhoto,
-        bankAccount: this.authentication.bankAccount,
-        address: this.authentication.address
-      }
-      uploadIndividualAuthenticationInfo(this.user.userVO.id, newAuthentication, this.submitInfoSuccess, this.submitInfoFail)
+      this.$refs['authentication'].validate(valid => {
+        if (valid) {
+          this.showLoading()
+          const newAuthentication = {
+            userId: this.user.userVO.id,
+            realName: this.authentication.realName,
+            IDCard: this.authentication.IDCard,
+            IDCardPhoto: this.authentication.IDCardPhoto,
+            bankAccount: this.authentication.bankAccount,
+            address: this.authentication.address
+          }
+          uploadIndividualAuthenticationInfo(this.user.userVO.id, newAuthentication, this.submitInfoSuccess, this.submitInfoFail)
+
+        } else {
+          notify('error', '表单填写错误!')
+          return false
+        }
+      })
     },
     submitInfoSuccess (res) {
       console.log(res)