Browse Source

fix conflict

guo00guo 5 years ago
parent
commit
17e3e09d3c

+ 1 - 3
src/pages/Homepage/LoginCard.vue

@@ -48,10 +48,8 @@
       userLogout() {
         this.isLogin = false
         logout().then((res) => {
-          location.reload();
-          this.$router.push('/home')
+          this.$router.go(0)
         })
-
       },
     },
     mounted() {

+ 152 - 87
src/pages/UserCenter/EnterpriseAuth.vue

@@ -17,10 +17,9 @@
       :title="failureReason"
       type="error">
     </el-alert>
-    <div class="upload-wrapper" v-if="active===0" style="margin-top: 10px">
-      <el-row class="agency-form-item">
-        <el-col :span="3">企业logo:</el-col>
-        <el-col :span="12">
+    <div v-if="active===0" class="uploader-wrapper">
+      <el-form ref="enterpriseForm1" :model="enterpriseForm1" :rules="rules1" label-width="100px" style="width: 600px;margin-top: 10px">
+        <el-form-item label="企业logo:" prop="agencyPhoto">
           <el-upload
             class="avatar-uploader"
             style="border: lightgrey 1px solid"
@@ -30,64 +29,63 @@
             :data="{type:3}"
             :disabled="!canEdit"
           >
-            <img v-if="enterpriseForm.agencyPhoto" :src="enterpriseForm.agencyPhoto" class="avatar">
+            <img v-if="enterpriseForm1.agencyPhoto" :src="enterpriseForm1.agencyPhoto" class="avatar">
+            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
           </el-upload>
-        </el-col>
-      </el-row>
-
-     <el-row class="agency-form-item">
-       <el-col :span="3">企业名称:</el-col>
-       <el-col :span="12">
-         <el-input :disabled="!canEdit" v-model="enterpriseForm.evaluationAgencyName" placeholder="企业名称"></el-input>
-       </el-col>
-      </el-row>
-
-      <el-row class="agency-form-item">
-        <div>营业执照:</div>
-        <el-col :span="8">
-          <div class="uploader-businessLicensePhoto">
-            <el-upload
-              class="avatar-uploader idcard-uploader"
-              style="border: lightgrey 1px solid"
-              action="https://jsonplaceholder.typicode.com/posts/"
-              :before-upload="beforeFileUpload"
-              :http-request="uploadFile"
-              :data="{type:2}"
-              :disabled="!canEdit"
-            >
-              <img  :src="enterpriseForm.businessLicensePhoto" class="avatar">
-            </el-upload>
-            <div><span style="color: red">*</span>营业执照:(仅支持三证合一)</div>
-          </div>
-        </el-col>
-        <el-col :span="16">
-          <div class="authentication-detail">
-            <div class="authentication-detail-title">证件要求</div>
-            <ul class="authentication-detail-list">
-              <li>必须为清晰、完整的彩色原件扫描件或数码照</li>
-              <li>仅支持.jpg .bmp .png .gif的图片格式,图片大小不超过4M</li>
-              <li>必须在有效期内且年检章齐全(当年成立的公司可无年检章)</li>
-              <li>必须为中国大陆工商局颁发</li>
-            </ul>
-          </div>
-        </el-col>
-      </el-row>
+        </el-form-item>
+        <el-form-item label="企业名称:" prop="evaluationAgencyName">
+          <el-input :disabled="!canEdit" v-model="enterpriseForm1.evaluationAgencyName" placeholder="身份证前后不能有空格"></el-input>
+        </el-form-item>
+      <el-form-item label="营业执照:" prop="businessLicensePhoto" style="width: 850px">
+        <el-row class="agency-form-item">
+          <el-col :span="10">
+            <div class="uploader-businessLicensePhoto">
+              <el-upload
+                class="avatar-uploader idcard-uploader"
+                style="border: lightgrey 1px solid"
+                action="https://jsonplaceholder.typicode.com/posts/"
+                :before-upload="beforeFileUpload"
+                :http-request="uploadFile"
+                :data="{type:2}"
+                :disabled="!canEdit"
+              >
+                <img v-if="enterpriseForm1.businessLicensePhoto" :src="enterpriseForm1.businessLicensePhoto" class="avatar">
+                <i v-else class="el-icon-plus avatar-uploader-icon card-uploader-icon"></i>
+              </el-upload>
+              <div><span style="color: red">*</span>营业执照:(仅支持三证合一)</div>
+            </div>
+          </el-col>
+          <el-col :span="14">
+            <div class="authentication-detail">
+              <div class="authentication-detail-title">证件要求</div>
+              <ul class="authentication-detail-list" style="padding-left:0 ">
+                <li>必须为清晰、完整的彩色原件扫描件或数码照</li>
+                <li>仅支持.jpg .bmp .png .gif的图片格式,图片大小不超过4M</li>
+                <li>必须在有效期内且年检章齐全(当年成立的公司可无年检章)</li>
+                <li>必须为中国大陆工商局颁发</li>
+              </ul>
+            </div>
+          </el-col>
+        </el-row>
+      </el-form-item>
+      </el-form>
     </div>
+
     <div class="legal-person-wrapper" v-if="active===1">
-      <el-form ref="enterpriseForm" :model="enterpriseForm" label-width="120px" style="width: 70%">
-        <el-form-item label="法人姓名">
+      <el-form ref="enterpriseForm" :model="enterpriseForm" :rules="rules" label-width="130px" style="width: 600px">
+        <el-form-item label="法人姓名" prop="legalPersonName">
           <el-input :disabled="!canEdit" v-model="enterpriseForm.legalPersonName" placeholder="请输入您的姓名,需与身份证保持一致"></el-input>
         </el-form-item>
-        <el-form-item label="身份证号码">
+        <el-form-item label="身份证号码" prop="idCardNum">
           <el-input :disabled="!canEdit" v-model="enterpriseForm.idCardNum" placeholder="身份证前后不能有空格"></el-input>
         </el-form-item>
-        <el-form-item label="性别">
+        <el-form-item label="性别" prop="gender">
           <el-radio-group v-model="enterpriseForm.gender" :disabled="!canEdit">
             <el-radio label="男"></el-radio>
             <el-radio label="女"></el-radio>
           </el-radio-group>
         </el-form-item>
-        <el-form-item label="身份证到期时间">
+        <el-form-item label="身份证到期时间" prop="idCardDeadTime">
           <el-date-picker
             v-model="enterpriseForm.idCardDeadTime"
             style="width: 100%"
@@ -98,17 +96,17 @@
           >
           </el-date-picker>
         </el-form-item>
-        <el-form-item label="家庭或单位地址">
+        <el-form-item label="家庭或单位地址" prop="address">
           <el-input :disabled="!canEdit" v-model="enterpriseForm.address"></el-input>
         </el-form-item>
-        <el-form-item label="认证权限">
+        <el-form-item label="认证权限" prop="roleList">
           <el-checkbox-group v-model="enterpriseForm.roleList" :disabled="!canEdit">
             <el-checkbox :label="0">发包</el-checkbox>
             <el-checkbox :label="1">接包</el-checkbox>
           </el-checkbox-group>
         </el-form-item>
       </el-form>
-      <div class="upload-wrapper">
+      <div class="uploader-wrapper">
         <el-row style="width: 100%">
           <el-col :span="9" style="padding-left: 30px">
             <div style="height:50%">
@@ -122,8 +120,9 @@
                 :disabled="!canEdit"
               >
                 <img v-if="enterpriseForm.idCardPositivePhoto" :src="enterpriseForm.idCardPositivePhoto" class="avatar">
+                <i v-else class="el-icon-plus avatar-uploader-icon card-uploader-icon"></i>
               </el-upload>
-              <div style="text-align: center">身份证正面照</div>
+              <div style="text-align: center">身份证正面照<span style="color:red">(必填)</span></div>
             </div>
             <div style="width: 280px;margin-top: 50px">
               <el-upload
@@ -136,9 +135,11 @@
                 :disabled="!canEdit"
               >
                 <img v-if="enterpriseForm.idCardBackPhoto" :src="enterpriseForm.idCardBackPhoto" class="avatar">
+                <i v-else class="el-icon-plus avatar-uploader-icon card-uploader-icon"></i>
+
               </el-upload>
 
-              <div style="text-align: center">身份证反面照</div>
+              <div style="text-align: center">身份证反面照<span style="color:red">(必填)</span></div>
             </div>
           </el-col>
           <el-col :span="15">
@@ -163,9 +164,9 @@
         </el-row>
       </div>
     </div>
-    <div class="enterprise-brn-wrapper">
+    <div class="enterprise-btn-wrapper">
       <button class="enterprise-btn previousBtn" @click="active--" v-if="active>0">上一步</button>
-      <button class="enterprise-btn nextBtn" @click="active++" v-if="active===0">下一步</button>
+      <button class="enterprise-btn nextBtn" @click="nextStep" v-if="active===0">下一步</button>
       <button class="enterprise-btn nextBtn" @click="submitEnterpriseAuth" v-if="active===1 && authStatus.text !=='认证通过'">提交审核</button>
     </div>
   </div>
@@ -187,28 +188,84 @@
         canEdit:false,
         authType:-1,
         authStatus:{},
+        enterpriseForm1:{
+          evaluationAgencyName:"", //企业名称
+          agencyPhoto:"", //企业logo
+          businessLicensePhoto: "",//企业执照
+        },
         enterpriseForm: {
           roleList: [],//0是发包 1是接包 如果两个都有那么权限都有。
           legalPersonName: "", //法人姓名
-          businessLicensePhoto: require('../../assets/img/business-license.png'),//企业执照
           idCardNum: "",//身份证号码
           address: "",//地址
           gender: "",
-          idCardPositivePhoto: idcardPositive,//身份证正面照
-          idCardBackPhoto: idcardBack,//身份证反面照片
+          idCardPositivePhoto: "",//身份证正面照
+          idCardBackPhoto: "",//身份证反面照片
           idCardDeadTime: "",//身份证过期时间
-          evaluationAgencyName:"", //企业名称
-          agencyPhoto:"", //企业logo
         },
-        failureReason:''
+        failureReason:'',
+        rules1:{
+          agencyPhoto: [
+            { required: true, message: '请上传企业logo', trigger: 'blur' },
+          ],
+          businessLicensePhoto: [
+            { required: true, message: '请上传企业执照', trigger: 'blur' },
+          ],
+          evaluationAgencyName: [
+            { required: true, message: '请输入企业名称', trigger: 'blur' },
+          ],
+
+        },
+        rules:{
+          legalPersonName: [
+            { required: true, message: '请输入法人姓名', trigger: 'blur' },
+          ],
+          idCardNum: [
+            { required: true, message: '请输入身份证号码', trigger: 'blur' },
+          ],
+          address:[
+            { required: true, message: '请输入家庭或单位地址', trigger: 'blur' },
+          ],
+          gender: [
+            { required: true, message: '请选择性别', trigger: 'blur' }
+          ],
+          roleList: [
+            { type: 'array', required: true, message: '请至少选择一个认证权限', trigger: 'change' }
+          ],
+          idCardDeadTime: [
+            {  required: true, message: '请选择身份证过期时间', trigger: 'change' }
+          ]
+        }
 
       }
     },
     methods: {
+      nextStep(){
+        this.$refs['enterpriseForm1'].validate(valid => {
+          if (!valid) {
+            notify('error', '信息填写不规范');
+            return false
+          }else{
+            this.active++;
+          }
+        })
+
+      },
       submitEnterpriseAuth() {
+        this.$refs['enterpriseForm'].validate(valid => {
+          if (!valid) {
+            notify('error', '信息填写不规范');
+            return false
+          }
+        })
+        if(!this.enterpriseForm.idCardPositivePhoto || !this.enterpriseForm.idCardBackPhoto){
+          notify('error', '身份证照片上传不规范');
+          return false;
+        }
         let firstSubmit = this.$route.query.type;
+        let data = {...this.enterpriseForm,...this.enterpriseForm1};
         if(firstSubmit==1){
-          Http.post(`/api/user/${this.user.id}/agency`, this.enterpriseForm).then(res => {
+          Http.post(`/api/user/${this.user.id}/agency`,data).then(res => {
             if (res) {
               notify('success', '提交成功');
               this.$router.push('/personal/authentication')
@@ -229,8 +286,8 @@
           if (res.agencyVO) {
             this.authType = 1  //企业已参与认证
             this.authStatus = res.agencyVO.authStatus ? res.agencyVO.authStatus : {}
-            //成功和审核中状态不可编辑,认证失败状态可编辑
-            this.authStatus.style === 'info' ? this.canEdit = true : null
+            //成功不可编辑,认证失败状态和审核中状态可编辑
+            this.authStatus.style !== 'success' ? this.canEdit = true : null
             this.failureReason = res.agencyVO.explain
             this.setFormInfo(res.agencyVO);
           } else {
@@ -288,13 +345,13 @@
         //console.log(JSON.parse(this.user).userVO)
         Http.upload(Apis.FILE.UPLOAD_IMAGE.replace('{userId}', this.user.id), formData, config).then((res) => {
           if(param.data.type==2){
-            this.enterpriseForm.businessLicensePhoto = res.data;
+            this.enterpriseForm1.businessLicensePhoto = res.data;
           }else if(param.data.type == 1){
             this.enterpriseForm.idCardBackPhoto = res.data
           }else if(param.data.type == 0){
             this.enterpriseForm.idCardPositivePhoto = res.data
           }else if(param.data.type == 3){
-            this.enterpriseForm.agencyPhoto = res.data
+            this.enterpriseForm1.agencyPhoto = res.data
           }
           notify('success', '上传成功')
           // this.$refs['agency'].validateField('photoUrl');
@@ -306,7 +363,6 @@
     mounted() {
       this.setUserInfo();
       this.getAuthStatus();
-      console.log(this.$route.params.type)
     }
   }
 </script>
@@ -317,7 +373,7 @@
     cursor: pointer;
     position: relative;
     overflow: hidden;
-    margin-right: 30px;
+    margin-right: 20px;
     width: 170px;
     height: 170px;
   }
@@ -326,9 +382,9 @@
     cursor: pointer;
     position: relative;
     overflow: hidden;
-    margin-right: 30px;
+    margin-right: 20px;
     width: 270px;
-    height: 150px;
+    height: 170px;
   }
   .idcard-uploader .el-upload{
     width: 270px;
@@ -345,7 +401,15 @@
   .avatar-uploader-icon {
     font-size: 28px;
     color: #8c939d;
-    width: 100%;
+    width: 170px;
+    height:170px;
+    line-height: 170px;
+    text-align: center;
+  }
+  .card-uploader-icon {
+    font-size: 28px;
+    color: #8c939d;
+    width: 270px;
     height:170px;
     line-height: 170px;
     text-align: center;
@@ -366,14 +430,13 @@
       margin-bottom: 20px;
     }
 
-    .upload-wrapper {
-      padding: 0 30px;
+    .uploader-wrapper {
 
       .agency-form-item {
         margin-bottom: 10px;
       }
       .authentication-detail {
-        padding: 0 30px;
+        padding: 0 15px;
         border-left: 1px solid rgba(220, 220, 220, 1);
 
         .idcard-example1{
@@ -397,24 +460,26 @@
           font-weight: 600;
           border-bottom: 1px dashed rgba(220, 220, 220, 1);
           margin-bottom: 10px;
-          padding-bottom: 5px;
+          padding-left: 20px;
         }
-      }
 
-      .authentication-detail-list {
-        list-style-type: none;
-        padding-left: 0;
+        .authentication-detail-list {
+          list-style-type: none;
+          padding-left: 0 !important;
+          line-height: 24px;
 
-        li:before {
-          content: "\2022";
-          color: #148AE0;
-          font-size: 22px;
-          margin-right: 10px;
+          li:before {
+            content: "\2022";
+            color: #148AE0;
+            font-size: 22px;
+            margin-right: 5px;
+          }
         }
       }
+
     }
 
-    .enterprise-brn-wrapper {
+    .enterprise-btn-wrapper {
       margin-top: 40px;
       display: flex;
       justify-content: center;

+ 48 - 14
src/pages/UserCenter/IndividualAuth.vue

@@ -18,20 +18,20 @@
       :title="failureReason"
       type="error">
     </el-alert>
-    <el-form ref="individualForm" :model="individualForm" label-width="120px" style="width: 70%;margin-top: 10px">
-      <el-form-item label="真实姓名">
+    <el-form ref="individualForm" :model="individualForm" :rules="rules" label-width="140px" style="width: 70%;margin-top: 10px">
+      <el-form-item label="真实姓名" prop="realName">
         <el-input :disabled="!canEdit" v-model="individualForm.realName" placeholder="请输入您的姓名,需与身份证保持一致"></el-input>
       </el-form-item>
-      <el-form-item label="身份证号码">
+      <el-form-item label="身份证号码" prop="idCard">
         <el-input :disabled="!canEdit" v-model="individualForm.idCard" placeholder="身份证前后不能有空格"></el-input>
       </el-form-item>
-      <el-form-item label="性别">
+      <el-form-item label="性别" prop="gender">
         <el-radio-group v-model="individualForm.gender" :disabled="!canEdit">
           <el-radio label="男"></el-radio>
           <el-radio label="女"></el-radio>
         </el-radio-group>
       </el-form-item>
-      <el-form-item label="身份证到期时间">
+      <el-form-item label="身份证到期时间" prop="idCardDeadTime">
         <el-date-picker
           v-model="individualForm.idCardDeadTime"
           style="width: 100%"
@@ -42,10 +42,10 @@
           >
         </el-date-picker>
       </el-form-item>
-      <el-form-item label="家庭或单位地址">
+      <el-form-item label="家庭或单位地址" prop="address">
         <el-input :disabled="!canEdit" v-model="individualForm.address"></el-input>
       </el-form-item>
-      <el-form-item label="认证权限">
+      <el-form-item label="认证权限" prop="roleList">
         <el-checkbox-group v-model="individualForm.roleList" :disabled="!canEdit">
           <el-checkbox :label="0">发包</el-checkbox>
           <el-checkbox :label="1">接包</el-checkbox>
@@ -67,7 +67,7 @@
             >
               <img v-if="individualForm.idCardPositivePhoto" :src="individualForm.idCardPositivePhoto" class="avatar">
             </el-upload>
-            <div style="text-align: center">手持身份证正面照</div>
+            <div style="text-align: center">身份证正面照<span style="color:red">(必填)</span></div>
           </div>
         </el-col>
         <el-col :span="15">
@@ -106,7 +106,7 @@
               <img v-if="individualForm.idCardBackPhoto" :src="individualForm.idCardBackPhoto" class="avatar">
             </el-upload>
 
-            <div style="text-align: center">身份证反面照</div>
+            <div style="text-align: center">身份证反面照<span style="color:red">(必填)</span></div>
           </div>
         </el-col>
         <el-col :span="15">
@@ -156,8 +156,8 @@
           realName: "",
           gender: "",
           idCard: "",
-          idCardPositivePhoto: idcardPositive,
-          idCardBackPhoto: idcardBack,
+          idCardPositivePhoto: '',
+          idCardBackPhoto: '',
           idCardDeadTime: "",
           address: ""
         },
@@ -166,6 +166,26 @@
         authDetail: {},
         authStatus: '',
         canEdit: false,
+        rules:{
+          realName: [
+            { required: true, message: '请输入真实姓名', trigger: 'blur' },
+          ],
+          idCard: [
+            { required: true, message: '请输入身份证号码', trigger: 'blur' },
+          ],
+          address:[
+            { required: true, message: '请输入家庭或单位地址', trigger: 'blur' },
+          ],
+          gender: [
+            { required: true, message: '请选择性别', trigger: 'blur' }
+          ],
+          roleList: [
+            { type: 'array', required: true, message: '请至少选择一个认证权限', trigger: 'change' }
+          ],
+          idCardDeadTime: [
+            {  required: true, message: '请选择身份证过期时间', trigger: 'change' }
+          ]
+        }
       }
     },
     methods: {
@@ -173,6 +193,16 @@
         this.user = storageGet('user') && storageGet('user').userVO;
       },
       submitIndividualAuth() {
+        this.$refs['individualForm'].validate(valid => {
+          if (!valid) {
+            notify('error', '信息填写不规范');
+            return false
+          }
+        })
+        if(!this.individualForm.idCardPositivePhoto || !this.individualForm.idCardBackPhoto){
+          notify('error', '身份证照片上传不规范');
+          return false;
+        }
         let firstSubmit = this.$route.query.type;
         if(firstSubmit == 1){
           Http.post(`/api/user/${this.user.id}/personalAuth`, this.individualForm).then(res => {
@@ -193,7 +223,6 @@
             notify('error', err.data)
           })
         }
-
       },
       //获取当前认证状态
       getAuthStatus() {
@@ -201,8 +230,8 @@
           if (res.personalAuthVO) {
             this.authType = 1  //个人已参与认证
             this.authStatus = res.personalAuthVO.authStatus
-            //成功和审核中状态不可编辑,认证失败状态可编辑
-            this.authStatus.style === 'danger' ? this.canEdit = true : null
+            //成功状态不可编辑,认证失败和审核中状态可编辑
+            this.authStatus.style !== 'success' ? this.canEdit = true : null
             this.failureReason = res.personalAuthVO.explain
             this.setFormInfo(res.personalAuthVO);
           } else {
@@ -283,6 +312,11 @@
     width: 270px;
     height: 170px;
   }
+  .avatar-uploader .el-upload {
+    width: 270px !important;
+    height: 170px !important;
+    border-color: #409EFF;
+  }
 
   .avatar-uploader .el-upload:hover {
     border-color: #409EFF;

+ 1 - 2
src/pages/UserCenter/Mine.vue

@@ -9,7 +9,7 @@
         <el-form-item label="头像" prop="photoUrl">
           <el-upload
             class="avatar-uploader"
-            style="border: lightgrey 1px solid;width:178px;"
+            style="border: lightgrey 1px solid;"
             action="https://jsonplaceholder.typicode.com/posts/"
             :before-upload="beforeFileUpload"
             :http-request="uploadFile"
@@ -36,7 +36,6 @@
                           style="width: 100%;" :disabled="!isModifyMode"
                           :picker-options="pickerOptions"></el-date-picker>
         </el-form-item>
-        {{userForm.location}}
         <el-form-item label="地址" prop="address" style="width: 160%">
           <provincecity
             ref="addFormProvince"