Quellcode durchsuchen

Merge branch 'Dev' into 'Test'

Dev

See merge request crowd-2019/crowd-test-service-front!90
郭超 vor 5 Jahren
Ursprung
Commit
861c6da702

+ 1 - 0
src/App.vue

@@ -91,6 +91,7 @@ export default {
     width: 100%;
     min-height: calc(~"100% - 70px - 180px");
     margin: 0 auto;
+    padding-bottom: 30px;
   }
   .home-slice {
     width: 100%;

+ 9 - 6
src/components/Mine.vue

@@ -52,8 +52,9 @@
                   style="font-size: 14px;">
             <el-col :span="6" type="flex" align="middle" justify="center">项目图片</el-col>
             <el-col :span="6" type="flex" align="middle" justify="center">项目名称</el-col>
-            <el-col :span="6" type="flex" align="middle" justify="center">应用类型</el-col>
-            <el-col :span="2" type="flex" align="middle" justify="center">项目预算</el-col>
+            <el-col :span="3" type="flex" align="middle" justify="center">应用类型</el-col>
+            <el-col :span="3" type="flex" align="middle" justify="center">项目预算</el-col>
+            <el-col :span="3" type="flex" align="middle" justify="center">参与人数</el-col>
             <el-col :span="4" type="flex" align="middle" justify="center">操作</el-col>
           </el-row>
           <project-item v-if="myProjects != null || myProjects.length > 0"
@@ -70,8 +71,9 @@
                   justify="center" style="font-size: 14px;">
             <el-col :span="6">项目图片</el-col>
             <el-col :span="6">项目名称</el-col>
-            <el-col :span="6">应用类型</el-col>
-            <el-col :span="2">项目预算</el-col>
+            <el-col :span="3">应用类型</el-col>
+            <el-col :span="3">项目预算</el-col>
+            <el-col :span="3">参与人数</el-col>
             <el-col :span="4">操作</el-col>
           </el-row>
           <span v-if="handlingProjects == null || handlingProjects.length == 0"> 暂无项目 </span>
@@ -89,8 +91,9 @@
                   justify="center" style="font-size: 14px;">
             <el-col :span="6">项目图片</el-col>
             <el-col :span="6">项目名称</el-col>
-            <el-col :span="6">应用类型</el-col>
-            <el-col :span="2">项目预算</el-col>
+            <el-col :span="3">应用类型</el-col>
+            <el-col :span="3">项目预算</el-col>
+            <el-col :span="3">参与人数</el-col>
             <el-col :span="4">操作</el-col>
           </el-row>
           <span v-if="acceptableProjects == null || acceptableProjects.length == 0"> 暂无项目 </span>

+ 14 - 2
src/components/authen/AuthenticationManage.vue

@@ -97,7 +97,11 @@
             <span>{{authInfoDetail.address}}</span>
           </el-form-item>
           <el-form-item label="角色:" v-if="authInfoDetail.type == 'personal'">
-            <span>{{authInfoDetail.roleList}}</span>
+            <el-checkbox-group v-model="authInfoDetail.roleList" disabled>
+              <el-checkbox :label="0">发包</el-checkbox>
+              <el-checkbox :label="1">接包</el-checkbox>
+            </el-checkbox-group>
+<!--            <span>{{authInfoDetail.roleList}}</span>-->
           </el-form-item>
           <el-form-item label="申请时间:">
             <span>{{reformTime(new Date(authInfoDetail.applyTime))}}</span>
@@ -173,8 +177,16 @@
           <el-form-item label="身份证截止时间:" v-if="authInfoDetail.type == 'agency'">
             <span>{{authInfoDetail.idCardDeadTime}}</span>
           </el-form-item>
+<!--          <el-form-item label="企业角色:" v-if="authInfoDetail.type == 'agency'">-->
+<!--            <span>{{authInfoDetail.roleList}}</span>-->
+<!--          </el-form-item>-->
+
           <el-form-item label="企业角色:" v-if="authInfoDetail.type == 'agency'">
-            <span>{{authInfoDetail.roleList}}</span>
+            <el-checkbox-group v-model="authInfoDetail.roleList" disabled>
+              <el-checkbox :label="0">发包</el-checkbox>
+              <el-checkbox :label="1">接包</el-checkbox>
+            </el-checkbox-group>
+            <!--            <span>{{authInfoDetail.roleList}}</span>-->
           </el-form-item>
 
 <!--          <el-form-item label="机构能力:" v-if="authInfoDetail.type == 'agency'">-->

+ 1 - 1
src/components/commons/Header2.0.vue

@@ -177,7 +177,7 @@
         userLogout () {
             this.isLogin = false
             logout().then((res) => {
-                location.reload();
+                // location.reload();
                 this.$router.push('/home')
             })
 

+ 12 - 18
src/components/commons/HomeSlice.vue

@@ -45,15 +45,12 @@
                     notify('warning', '请登录后访问');
                 }
                 else if(this.isLogin){
-                    Http.get(`/api/user/${this.user.id}`).then(res => {
-                        res.roleList.forEach(function(item) {
-                            if(item.indexOf("part") != -1){
-                                this.$router.push('/project/create');
-                            }
-                        })
-                        notify('warning', '请先认证成为发包用户');
-                    });
-
+                    Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
+                        console.log(res)
+                        this.$router.push('/project/create');
+                    }).catch((error) => {
+                        notify('error', error.data)
+                    })
                 }
             },
             checkCreateTaskAuth() {
@@ -62,15 +59,12 @@
                     notify('warning', '请登录后访问');
                 }
                 else if(this.isLogin){
-                    Http.get(`/api/user/${this.user.id}`).then(res => {
-                        console.log(res.roleList);
-                        res.roleList.forEach(function(item) {
-                            if(item.indexOf("evaluation") != -1){
-                                this.$router.push("/square")
-                            }
-                        })
-                        notify('warning', '请先认证成为接包用户');
-                    });
+                    Http.get(Apis.USER.IS_AGENCY.replace('{userId}', this.user.id)).then((res) => {
+                        console.log(res)
+                        this.$router.push('/square');
+                    }).catch((error) => {
+                        notify('error', error.data)
+                    })
 
                 }
             },

+ 1 - 1
src/components/project/Project.vue

@@ -30,7 +30,7 @@
                 ¥
                 <template slot="append"></template>
               </el-input>
-              <span v-if="!isModifyMode">{{project.budget}}¥</span>
+              <span v-if="!isModifyMode">¥{{project.budget}}</span>
             </el-form-item>
 
             <el-form-item label="计价标准" prop="valuationStandard">

+ 3 - 1
src/components/report/ProjectReport.vue

@@ -60,7 +60,7 @@
           <span v-if="!isModifyMode">{{report.conclusion}}</span>
         </el-form-item>
         <el-form-item v-if="!isModifyMode">
-          <div class="btn btn-medium btn-info" @click="modifyForm()">修改</div>
+          <div class="btn btn-medium btn-info" @click="modifyForm()"  v-if="operational">修改</div>
           <div class="btn btn-medium" @click="back()">返回</div>
         </el-form-item>
         <el-form-item v-if="isModifyMode">
@@ -101,6 +101,7 @@ export default {
         fileUrl: '',
         conclusion: ''
       },
+        operational:'',
       rules: {
         name: [
           {required: true, message: '任务名称不可为空', trigger: 'blur'},
@@ -233,6 +234,7 @@ export default {
         this.report.fileUrl = res.crowdReportVO.file
         this.report.conclusion = res.crowdReportVO.conclusion
         this.report.target = res.crowdReportVO.target
+          this.operational = res.operational
         this.hideLoading()
         //notify('success', '修改成功')
       }).catch((error) => {

+ 3 - 1
src/components/report/TaskReport.vue

@@ -58,7 +58,7 @@
           <span v-if="!isModifyMode">{{report.conclusion}}</span>
         </el-form-item>
         <el-form-item v-if="!isModifyMode">
-          <div class="btn btn-medium btn-info" @click="modifyForm()">修改</div>
+          <div class="btn btn-medium btn-info" @click="modifyForm()"  v-if="operational">修改</div>
           <div class="btn btn-medium" @click="back()">返回</div>
         </el-form-item>
         <el-form-item v-if="isModifyMode">
@@ -88,6 +88,7 @@ export default {
       projectId: '',
       taskId: '',
       isModifyMode: false,
+        operational: '',
       reportType: [],
       report: {
         name: '',
@@ -239,6 +240,7 @@ export default {
         this.report.conclusion = res.crowdReportVO.conclusion
         this.report.target = res.crowdReportVO.target
         this.report.participantCount = res.crowdReportVO.participantCount
+          this.operational = res.operational
         this.hideLoading()
       }).catch((error) => {
         this.hideLoading()

+ 7 - 4
src/components/task/Task.vue

@@ -28,7 +28,7 @@
         <el-form-item label="测试类型" prop="serviceType">
           <el-radio-group v-if="isModifyMode" v-model="task.serviceType">
             <span v-for="(item,index) in serviceType" :key="index">
-              <el-radio :label="item.code" name="type">{{item.name}}</el-radio>
+              <el-radio :label="item.code" name="serviceType">{{item.name}}</el-radio>
             </span>
           </el-radio-group>
           <span class="badge" v-if="!isModifyMode">{{task.serviceType}}</span>
@@ -314,8 +314,8 @@
             {required: true, message: '请输入任务名称', trigger: 'blur'},
             {min: 5, max: 50, message: '任务名称长度在 5 到 50 个字符', trigger: 'blur'}
           ],
-          type: [
-            {required: true, message: '测试类型不可为空'},
+            serviceType: [
+            {required: true, message: '测试类型不可为空', trigger: 'change'},
           ],
           desc: [{required: false, message: '请填写描述', trigger: 'blur'}],
           //price: [{required: true, message: '请填写价格', trigger: 'blur'}],
@@ -401,7 +401,7 @@
 
       //切换至可编辑页面
       modifyForm() {
-        this.task.serviceType = ''
+        // this.task.serviceType = ''
         this.isModifyMode = true
       },
       //切换至不可编辑页面
@@ -567,6 +567,7 @@
         this.task.requireDocUrl = res.crowdTaskVO.requirementFile,
           this.task.participantCount = res.crowdTaskVO.participantCount
         this.reportList = res.crowdReportVOList
+        this.acceptedUserList = res.acceptedUserList
         this.hideLoading()
         notify('success', '修改成功')
       },
@@ -584,8 +585,10 @@
         }
         formData.append('file', param.file)
         Http.upload(Apis.FILE.REQUIREMENT_FILE.replace('{userId}', this.user.userVO.id), formData, config).then((res) => {
+            notify('success', '上传成功')
           this.uploadRequireDocSuccess(res)
         }).catch((error) => {
+            notify('error', '上传失败:' + error.data)
           this.uploadRequireDocFail(error)
         })
       },

+ 2 - 0
src/js/api.js

@@ -69,6 +69,8 @@ export default {
     REJECT_INDIVIDUAL_AUTH:'/api/user/{userId}/personalAuth/status/reject',
     GET_DETAIL: "/api/user/detail/{userId}",
     GET_ADDRESS: "/api/index/address",
+    IS_PART: "/api/common/check/create/project/{userId}",
+    IS_AGENCY: "/api/common/check/accept/task/{userId}",
   },
   PAGE: {
     HOME_PAGE: '/api/common/index/',

+ 148 - 123
src/pages/DetailPage/AgencyDetail.vue

@@ -5,7 +5,7 @@
       <div class="title" v-else>入驻品牌机构信息</div>
       <el-form :model="authentication" ref="authentication" label-width="12%" class="demo-report">
         <el-form-item prop="agencyPhoto" label="机构logo">
-          <span >
+          <span>
           <el-image
             style="width: 100px;"
             :src="authentication.agencyPhoto"
@@ -13,35 +13,36 @@
         </span>
         </el-form-item>
         <el-form-item label="机构名称" prop="evaluationAgencyName">
-          <span >{{authentication.evaluationAgencyName}}</span>
+          <span>{{authentication.evaluationAgencyName}}</span>
         </el-form-item>
-        <el-form-item  label="认证状态" prop="name">
-          <el-tag :type="authentication.authStatus.style">{{authentication.authStatus.text}}</el-tag>
+        <el-form-item label="法人名称" prop="legalPersonName">
+          <span>{{authentication.legalPersonName}}</span>
         </el-form-item>
-        <el-form-item v-if="authentication.authStatus.text == '认证失败'" label="失败原因" prop="name">
-          <el-link v-if="authentication.explain!=null&&authentication.explain!=''" type="danger" disabled>
-            {{authentication.explain}}
-          </el-link>
-          <el-link v-if="authentication.explain==null || authentication.explain==''" type="danger" disabled>管理员未填写
-          </el-link>
-        </el-form-item>
-        <el-form-item label="地址" prop="address" v-if="this.authentication.address != null &&  this.authentication.address != ''">
-          <span >{{authentication.address}}</span>
-        </el-form-item>
-        <el-form-item label="测评机构能力" prop="evaluationAgencyAbilityList">
-          <span  v-for="(item,index) in authentication.evaluationAgencyAbilityList"
-                :key="index"><span class="badge">{{item}}</span></span>
-        </el-form-item>
-        <el-form-item label="测评机构资源" prop="evaluationAgencyResourceList">
-          <span  v-for="item in authentication.evaluationAgencyResourceList" :key="item.id">
-            资源类型:{{item.type}};&nbsp;&nbsp;资源名称:{{item.name}};&nbsp;&nbsp;资源总量:{{item.totalNum}};&nbsp;&nbsp;可用资源:{{item.availableNum}}<br/>
-          </span>
+        <!--        <el-form-item  label="认证状态" prop="name">-->
+        <!--          <el-tag :type="authentication.authStatus.style">{{authentication.authStatus.text}}</el-tag>-->
+        <!--        </el-form-item>-->
+        <el-form-item label="地址" prop="address"
+                      v-if="this.authentication.address != null &&  this.authentication.address != ''">
+          <span>{{authentication.address}}</span>
         </el-form-item>
+        <!--        <el-form-item label="测评机构能力" prop="evaluationAgencyAbilityList">-->
+        <!--          <span  v-for="(item,index) in authentication.evaluationAgencyAbilityList"-->
+        <!--                :key="index"><span class="badge">{{item}}</span></span>-->
+        <!--        </el-form-item>-->
+        <!--        <el-form-item label="测评机构资源" prop="evaluationAgencyResourceList">-->
+        <!--          <span  v-for="item in authentication.evaluationAgencyResourceList" :key="item.id">-->
+        <!--            资源类型:{{item.type}};&nbsp;&nbsp;资源名称:{{item.name}};&nbsp;&nbsp;资源总量:{{item.totalNum}};&nbsp;&nbsp;可用资源:{{item.availableNum}}<br/>-->
+        <!--          </span>-->
+        <!--        </el-form-item>-->
 
         <el-form-item label="接包数量" prop="taskCount" v-if="this.type == 0">
-          <span >{{authentication.taskCount}}</span>
+          <span>{{authentication.taskCount}}</span>
         </el-form-item>
-        <el-form-item >
+        <el-form-item label="审核通过时间" prop="checkTime">
+          <span>{{dateFormat(new Date(authentication.checkTime),'yyyy-MM-dd HH:mm:ss')}}</span>
+        </el-form-item>
+
+        <el-form-item>
           <div class="btn btn-medium btn-info" @click="back()">返回</div>
         </el-form-item>
       </el-form>
@@ -49,106 +50,133 @@
   </div>
 </template>
 <script>
-    import Http from '@/js/http.js'
-    import Apis from '@/js/api.js'
-    import {notify} from '@/constants/index'
-    import {getAllReportTypes,
-        defaultValue,
-        storageGet,
-        getCurrentAgencyAuthInfo,
-        getAllAgencyResourceTypes,
-        getAllServiceTypes,} from '@/js/index'
+  import Http from '@/js/http.js'
+  import Apis from '@/js/api.js'
+  import {notify} from '@/constants/index'
+  import {
+    getAllReportTypes,
+    defaultValue,
+    storageGet,
+    getCurrentAgencyAuthInfo,
+    getAllAgencyResourceTypes,
+    getAllServiceTypes,
+  } from '@/js/index'
 
-    export default {
-        name: 'AgencyDetail',
-        components: {},
-        data() {
-            return {
-                user: {},
-                loading: false,
-                type: 0,
-                userId: 0,
-                resourceTypes: [],
-                serviceTypes: [],
-                authentication: {
-                    mobile: '',
-                    evaluationAgencyName: '',
-                    bankAccount: '',
-                    address: '',
-                    evaluationAgencyAbilityList: [],
-                    evaluationAgencyResourceList: [],
-                    authStatus: {},
-                    agencyPhoto: defaultValue.image,
-                    explain: '',
-                    taskCount: 0
-                },
-            }
-        },
-        mounted() {
-            this.$nextTick(() => {
-                this.init()
-            })
+  export default {
+    name: 'AgencyDetail',
+    components: {},
+    data() {
+      return {
+        user: {},
+        loading: false,
+        type: 0,
+        userId: 0,
+        resourceTypes: [],
+        serviceTypes: [],
+        authentication: {
+          mobile: '',
+          evaluationAgencyName: '',
+          bankAccount: '',
+          address: '',
+          evaluationAgencyAbilityList: [],
+          evaluationAgencyResourceList: [],
+          authStatus: {},
+          legalPersonName: '',
+          checkTime: '',
+          agencyPhoto: defaultValue.image,
+          explain: '',
+          taskCount: 0
         },
-        methods: {
-            init() {
-                this.userId = this.$route.params.id
-                this.type = this.$route.params.type
-                this.setServiceTypes()
-                this.setResourceTypes()
-                this.getAuthInfo ()
-            },
-            back() {
-                this.$router.go(-1);
-            },
-            //加载数据
-            getAuthInfo () {
-                this.showLoading()
-                getCurrentAgencyAuthInfo(this.userId, this.getAuthInfoSuccess, this.getAuthInfoFail)
-            },
-            getAuthInfoSuccess (res) {
-                this.hideLoading()
-                this.authentication.agencyPhoto = res.agencyPhoto == null ? defaultValue.image : res.agencyPhoto
-                this.authentication.evaluationAgencyName = res.evaluationAgencyName == null ? '暂未填写' : res.evaluationAgencyName
-                this.authentication.evaluationAgencyAbilityList = res.evaluationAgencyAbilityList == null ? [] : res.evaluationAgencyAbilityList
-                this.authentication.evaluationAgencyResourceList = res.evaluationAgencyResourceList == null ? [] : res.evaluationAgencyResourceList
-                this.authentication.bankAccount = res.bankAccount == null ? '暂未填写' : res.bankAccount
-                this.authentication.address = res.address == null ? '暂未填写' : res.address
-                this.authentication.authStatus = res.authStatus
-                this.authentication.explain = res.explain
-                this.authentication.taskCount = res.taskCount
-            },
-            getAuthInfoFail (error) {
-                this.hideLoading()
-                notify('error', '加载认证信息失败:' + error.data)
-            },
-            //设置测试类型
-            setServiceTypes () {
-                getAllServiceTypes().then((res) => {
-                    this.serviceTypes = res
-                }).catch((error) => {
-                    notify('error', '机构能力加载失败')
-                })
-            },
-            //设置机构资源类型
-            setResourceTypes () {
-                this.resourceTypes = getAllAgencyResourceTypes()
-            },
-            setUserInfo() {
-                this.user = storageGet('user')
-            },
-            showLoading() {
-                this.loading = true
-            },
-            hideLoading() {
-                this.loading = false
-            }
-        },
-        watch: {
-            agencyType(val) {
-                this.agencyType = val
-            }
+      }
+    },
+    mounted() {
+      this.$nextTick(() => {
+        this.init()
+      })
+    },
+    methods: {
+      init() {
+        this.userId = this.$route.params.id
+        this.type = this.$route.params.type
+        this.setServiceTypes()
+        this.setResourceTypes()
+        this.getAuthInfo()
+      },
+      back() {
+        this.$router.go(-1);
+      },
+      //加载数据
+      getAuthInfo() {
+        this.showLoading()
+        getCurrentAgencyAuthInfo(this.userId, this.getAuthInfoSuccess, this.getAuthInfoFail)
+      },
+      getAuthInfoSuccess(res) {
+        this.hideLoading()
+        this.authentication.agencyPhoto = res.data.agencyPhoto == null ? defaultValue.image : res.data.agencyPhoto
+        this.authentication.evaluationAgencyName = res.data.evaluationAgencyName == null ? '暂未填写' : res.data.evaluationAgencyName
+        this.authentication.evaluationAgencyAbilityList = res.data.evaluationAgencyAbilityList == null ? [] : res.data.evaluationAgencyAbilityList
+        this.authentication.evaluationAgencyResourceList = res.data.evaluationAgencyResourceList == null ? [] : res.data.evaluationAgencyResourceList
+        this.authentication.bankAccount = res.data.bankAccount == null ? '暂未填写' : res.data.bankAccount
+        this.authentication.address = res.data.address == null ? '暂未填写' : res.data.address
+        this.authentication.authStatus = res.data.authStatus
+        this.authentication.legalPersonName = res.data.legalPersonName == null ? '暂未填写' : res.data.legalPersonName
+        this.authentication.explain = res.data.explain
+        this.authentication.taskCount = res.data.taskCount
+        this.authentication.checkTime = res.data.checkTime
+      },
+      getAuthInfoFail(error) {
+        this.hideLoading()
+        notify('error', '加载认证信息失败:' + error.data)
+      },
+      //设置测试类型
+      setServiceTypes() {
+        getAllServiceTypes().then((res) => {
+          this.serviceTypes = res
+        }).catch((error) => {
+          notify('error', '机构能力加载失败')
+        })
+      },
+      //设置机构资源类型
+      setResourceTypes() {
+        this.resourceTypes = getAllAgencyResourceTypes()
+      },
+      setUserInfo() {
+        this.user = storageGet('user')
+      },
+      showLoading() {
+        this.loading = true
+      },
+      hideLoading() {
+        this.loading = false
+      },
+      dateFormat (date, format) {
+        date = new Date(date)
+        let o = {
+          'M+' : date.getMonth() + 1, //month
+          'd+' : date.getDate(), //day
+          'H+' : date.getHours(), //hour+8小时
+          'm+' : date.getMinutes(), //minute
+          's+' : date.getSeconds(), //second
+          'q+' : Math.floor((date.getMonth() + 3) / 3), //quarter
+          'S' : date.getMilliseconds() //millisecond
+        }
+        if (/(y+)/.test(format)){
+          format = format.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
         }
+
+        for (let k in o)
+          if (new RegExp('(' + k + ')').test(format))
+            format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length));
+
+        return format;
+      }
+    },
+    watch: {
+      agencyType(val) {
+        this.agencyType = val
+      }
     }
+  }
 </script>
 
 <style>
@@ -156,7 +184,4 @@
     font-size: 32px;
   }
 
-  .el-form-item {
-    max-height: 120px !important;
-  }
 </style>

+ 63 - 63
src/pages/DetailPage/UserDetail.vue

@@ -27,72 +27,72 @@
 </template>
 
 <script>
-    import Http from '@/js/http.js'
-    import Apis from '@/js/api.js'
-    import {notify} from '@/constants/index'
-    import {getAllReportTypes, storageGet} from '@/js/index'
+  import Http from '@/js/http.js'
+  import Apis from '@/js/api.js'
+  import {notify} from '@/constants/index'
+  import {getAllReportTypes, storageGet} from '@/js/index'
 
-    export default {
-        name: 'UserDetail',
-        components: {},
-        data() {
-            return {
-                user: {},
-                loading: false,
-                id: 0,
-                user: {
-                    name: '',
-                    photo: '',
-                    taskCount: '',
-                    address: '',
-                    gender: '',
-                },
-            }
+  export default {
+    name: 'UserDetail',
+    components: {},
+    data() {
+      return {
+        user: {},
+        loading: false,
+        id: 0,
+        user: {
+          name: '',
+          photo: '',
+          taskCount: '',
+          address: '',
+          gender: '',
         },
-        mounted() {
-            this.$nextTick(() => {
-                this.init()
-            })
-        },
-        methods: {
-            init() {
-                this.id = this.$route.params.id
-                this.loadData()
-            },
-            back() {
-                this.$router.go(-1);
-            },
-            loadData() {
-                this.showLoading()
-                Http.get(Apis.USER.GET_DETAIL.replace('{userId}', this.id)).then((res) => {
-                    console.log(res)
-                    this.user.name = res.data.name
-                    this.user.photo = res.data.photoUrl
-                    this.user.gender = res.data.gender
-                    this.user.taskCount = res.data.taskCount
-                    this.user.address = res.data.address
-                    this.hideLoading()
-                }).catch((error) => {
-                    this.hideLoading()
-                    notify('error', '打开详情失败:' + error.data)
-                })
-            },
-            setUserInfo() {
-                this.user = storageGet('user')
-            },
-            showLoading() {
-                this.loading = true
-            },
-            hideLoading() {
-                this.loading = false
-            }
-        },
-        watch: {
-            userType(val) {
-                this.userType = val
-            }
-        }
+      }
+    },
+    mounted() {
+      this.$nextTick(() => {
+        this.init()
+      })
+    },
+    methods: {
+      init() {
+        this.id = this.$route.params.id
+        this.loadData()
+      },
+      back() {
+        this.$router.go(-1);
+      },
+      loadData() {
+        this.showLoading()
+        Http.get(Apis.USER.GET_DETAIL.replace('{userId}', this.id)).then((res) => {
+          console.log(res)
+          this.user.name = res.data.name
+          this.user.photo = res.data.photoUrl
+          this.user.gender = res.data.gender
+          this.user.taskCount = res.data.taskCount
+          this.user.address = res.data.address
+          this.hideLoading()
+        }).catch((error) => {
+          this.hideLoading()
+          notify('error', '打开详情失败:' + error.data)
+        })
+      },
+      setUserInfo() {
+        this.user = storageGet('user')
+      },
+      showLoading() {
+        this.loading = true
+      },
+      hideLoading() {
+        this.loading = false
+      }
+    },
+    watch: {
+      userType(val) {
+        this.userType = val
+      }
     }
+  }
 </script>
 
 <style>

+ 18 - 5
src/pages/Homepage/Homepage.vue

@@ -82,6 +82,7 @@
   import WaterfallSlot from 'vue-waterfall/lib/waterfall-slot'
   import {storageGet, getAllFields} from '@/js/index.js'
   import {notify} from "../../constants";
+  import Apis from '@/js/api'
   // console.log(commonData);
   export default {
     name: 'Homepage',
@@ -104,6 +105,7 @@
     },
     data() {
       return {
+        user:{},
         isLogin: false,
         loading: false,
         searchType:'0',
@@ -177,12 +179,19 @@
           })
       },
       checkLogin(){
-        if(!this.isLogin){
-            console.log("请登录后访问");
-            notify('warning','请登录后访问');
-        }else{
-            console.log("已登录");
+        this.checkCreateProjectAuth();
+      },
+      checkCreateProjectAuth() {
+        if (!this.isLogin) {
+          console.log("请登录后访问");
+          notify('warning', '请登录后访问');
+        }
+        else if(this.isLogin){
+          Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
             this.$router.push('/project/create');
+          }).catch((error) => {
+            notify('error', error.data)
+          })
         }
       },
       handleTabClick(tab){
@@ -221,10 +230,14 @@
       },
       hideLoading() {
           this.loading = false
+      },
+      setUserInfo(){
+        this.user = storageGet('user')&&storageGet('user').userVO;
       }
     },
 
     mounted() {
+      this.setUserInfo();
       this.loadData();
     }
   }

+ 7 - 1
src/pages/Homepage/HotCrowd.vue

@@ -6,7 +6,7 @@
       <el-button style="float: right; padding: 3px 0;line-height: 25px" type="text"  @click="getMore()">more>></el-button>
     </div>
     <div class="popular-list">
-      <el-row class="popular-list-item" v-for="item in applicationTypeRank" :key="item.id">
+      <el-row class="popular-list-item" v-for="item in applicationTypeRank" :key="item.id" @click.native="goToDetail(item.code)">
         <el-col :span="19">
           <img :src="item.image" alt="logo-project" class="pull-left project-logo-img">
           <div style="margin-left: 55px">
@@ -38,6 +38,12 @@
                 name: 'CrowdList',
             });
         },
+      goToDetail(code) {
+        this.$router.push({
+          name: 'CrowdDetail',
+          params: {code: code}
+        })
+      },
     }
   }
 </script>

+ 2 - 4
src/pages/Homepage/LoginCard.vue

@@ -27,7 +27,7 @@
 <script>
   import Http from '@/js/http.js'
   import Apis from '@/js/api.js'
-  import {storageGet} from '@/js/index.js'
+  import {storageGet,logout} from '@/js/index.js'
 
   export default {
     name: "LoginCard",
@@ -48,10 +48,8 @@
       userLogout() {
         this.isLogin = false
         logout().then((res) => {
-          location.reload();
-          this.$router.push('/home')
+          this.$router.go(0)
         })
-
       },
     },
     mounted() {

+ 4 - 1
src/pages/Square/PopularProject.vue

@@ -10,7 +10,7 @@
       <el-row class="popular-list-item" v-for="item in hotCrowdTestProjectVOs" :key="item.id">
         <el-col :span="19">
           <img src="../../assets/img/logo-project.png" alt="logo-project" class="pull-left project-logo-img">
-          <div style="margin-left: 55px">
+          <div style="margin-left: 55px; cursor: pointer;"  @click="goToProjectDetail(item.code)">
             <div class="list-item-title">
               {{item.name}}
             </div>
@@ -46,6 +46,9 @@
                 params: {type: "project"}
             })
         },
+        goToProjectDetail (id) {
+            this.$router.push({name: 'Project', params: {projectId: id}})
+        }
     }
   }
 </script>

+ 2 - 14
src/pages/Square/PopularProjectAndTaskList.vue

@@ -36,8 +36,8 @@
       <div>
       </div>
     </div>
-    <div class="mine-body" style="text-align: center;">
-      <el-tabs value="myProject" @tab-click="handleTabClick" v-loading="loading" style="width: 90%;margin-left: 5%">
+    <div class="mine-body container" style="text-align: center;">
+      <el-tabs value="myProject" @tab-click="handleTabClick" v-loading="loading">
         <el-tab-pane name="myProject" v-if="currTab == 'project'">
           <span v-if="projectAndTaskArr == null || projectAndTaskArr.length == 0"> 暂无项目 </span>
           <el-row v-if="projectAndTaskArr != null && projectAndTaskArr.length != 0" type="flex" align="middle" justify="center"
@@ -74,13 +74,6 @@
 
     <div class="container">
       <el-row>
-        <el-col :span="18" class="project-task">
-<!--          <el-row :gutter="15"  style="margin-bottom: 10px">-->
-<!--            <el-col :span="8" v-for="(item,index) in projectAndTaskArr" :key="index" style="margin-bottom: 15px">-->
-<!--              <SquareCard :card="item"></SquareCard>-->
-<!--            </el-col>-->
-<!--          </el-row>-->
-
           <el-pagination
             v-if="currTab!=='squareHome'&&projectAndTaskArr&&projectAndTaskArr.length"
             :page-size="12"
@@ -91,11 +84,6 @@
             class="pull-right"
           >
           </el-pagination>
-        </el-col>
-<!--        <el-col :span="6"  class="popular-modules" style="padding-left: 15px">-->
-<!--          <PopularProject :hotCrowdTestProjectVOs="hotCrowdTestProjectVOs" style="margin-bottom: 15px"/>-->
-<!--          <PopularTask :hotCrowdTaskVOs="hotCrowdTaskVOs"/>-->
-<!--        </el-col>-->
       </el-row>
     </div>
   </div>

+ 5 - 2
src/pages/Square/PopularTask.vue

@@ -9,8 +9,8 @@
       <el-row class="popular-list-item" v-for="item in hotCrowdTaskVOs" :key="item.id">
         <el-col :span="19">
           <img src="../../assets/img/logo-blue.png" alt="logo-project" class="pull-left project-logo-img">
-          <div style="margin-left: 55px">
-            <div class="list-item-title">
+          <div style="margin-left: 55px; cursor: pointer;"  @click="goToTaskDetail(item.projectId,item.code)">
+            <div class="list-item-title" >
               {{item.title}}
             </div>
             <div class="list-item-info">
@@ -43,6 +43,9 @@
                   params: {type: "task"}
               })
           },
+          goToTaskDetail (projectId, id) {
+              this.$router.push({name: 'Task', params: {projectId: projectId, taskId: id}})
+          },
       }
   }
 </script>

+ 64 - 41
src/pages/Square/SquareCard.vue

@@ -37,49 +37,72 @@
 </template>
 
 <script>
-    import {notify} from "../../constants";
-    import {storageGet} from '@/js/index.js'
-
-    export default {
-        name: 'SquareCard',
-        props: ['card'],
-        data() {
-            return {
-                isLogin: false,
-            }
-        },
-        methods: {
-            onload() {
-                if (storageGet('user') != null) {
-                    this.isLogin = true;
-                }
-            },
-            goToProjectDetail(id) {
-                if (!this.isLogin) {
-                    console.log("请登录后访问");
-                    notify('warning', '请登录后访问');
-                } else {
-                    console.log("已登录");
-                    this.$router.push({name: 'Project', params: {projectId: id}})
-                }
-            },
-            goToTaskDetail(projectId, taskId) {
-                if (!this.isLogin) {
-                    console.log("请登录后访问");
-                    notify('warning', '请登录后访问');
-                } else {
-                    console.log("已登录");
-                    this.$router.push({
-                        name: 'Task',
-                        params: {projectId: projectId, taskId: taskId}
-                    })
-                }
-            },
-        },
-        mounted() {
-            this.onload();
+  import {notify} from "../../constants";
+  import Http from '@/js/http.js';
+  import {storageGet} from '@/js/index.js'
+  import Apis from '@/js/api'
+  export default {
+    name: 'SquareCard',
+    props: ['card'],
+    data() {
+      return {
+        isLogin: false,
+        user:{}
+      }
+    },
+    methods: {
+      onload() {
+        if (storageGet('user') != null) {
+          this.isLogin = true;
+        }
+      },
+      checkCreateProjectAuth() {
+        if (!this.isLogin) {
+          console.log("请登录后访问");
+          notify('warning', '请登录后访问');
+        } else if (this.isLogin) {
+          Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
+            this.$router.push('/project/create');
+          }).catch((error) => {
+            notify('error', error.data)
+          })
+        }
+      },
+      goToProjectDetail(id) {
+        if (!this.isLogin) {
+          notify('warning', '请登录后访问');
+        } else if (this.isLogin) {
+          Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
+            this.$router.push({name: 'Project', params: {projectId: id}})
+          }).catch((error) => {
+            notify('error', error.data)
+          })
         }
+      },
+      goToTaskDetail(projectId, taskId) {
+        if (!this.isLogin) {
+          console.log("请登录后访问");
+          notify('warning', '请登录后访问');
+        } else if (this.isLogin) {
+          Http.get(Apis.USER.IS_AGENCY.replace('{userId}', this.user.id)).then((res) => {
+            this.$router.push({
+              name: 'Task',
+              params: {projectId: projectId, taskId: taskId}
+            })
+          }).catch((error) => {
+            notify('error', error.data)
+          })
+        }
+      },
+      setUserInfo() {
+        this.user = storageGet('user')&&storageGet('user').userVO;
+      }
+    },
+    mounted() {
+      this.onload();
+      this.setUserInfo();
     }
+  }
 </script>
 
 <style lang="less">

+ 15 - 4
src/pages/UserCenter/Authentication.vue

@@ -4,7 +4,7 @@
       <div class="right-modifyPsw-title">
         <span style="font-size: 18px;font-weight: bold">身份认证</span>
       </div>
-      <el-row :gutter="20">
+      <el-row :gutter="20" v-loading="loading">
         <el-col :span="12">
           <div class="authentication-card" :class="selectedCardImg"  @click="gotoPersonalAuth" v-if="authType<2">
             <div class="authentication-card-title">个人认证</div>
@@ -69,22 +69,31 @@
     name: "Authentication",
     data() {
       return {
+        loading: false,
         selectedCardImg:'',
         authType:-1,
         authDetail:{},
         authInfo:{},
-        authStatus:''
+        authStatus:'',
+        firstSubmit:0
       }
     },
     methods: {
+      showLoading() {
+        this.loading = true
+      },
+      hideLoading() {
+        this.loading = false
+      },
       gotoPersonalAuth(){
-        this.$router.push({path:'/personal/authentication/individual'})
+        this.$router.push({path:'/personal/authentication/individual',query:{type:this.firstSubmit}})
       },
       gotoEnterpriseAuth(){
-        this.$router.push({path:'/personal/authentication/enterprise'})
+        this.$router.push({path:'/personal/authentication/enterprise',query:{type:this.firstSubmit}})
       },
       //获取当前资质状态
       getAuthStatus(){
+        this.showLoading();
         let userId = storageGet('user')&&storageGet('user').userVO.id;
         Http.get(`/api/user/${userId}`).then(res=>{
           this.authInfo = res;
@@ -100,7 +109,9 @@
             this.selectedCardImg = 'authentication-card-select'
           }else if((!res.enterpriseAuthVO) || (!res.agencyVO)){
             this.authType = 0  //无
+            this.firstSubmit = 1
           }
+          this.hideLoading();
         })
       }
     },

+ 47 - 17
src/pages/UserCenter/BindingMail.vue

@@ -1,17 +1,17 @@
 <template>
-  <div style="margin-top: 20px">
+  <div style="margin-top: 20px" v-loading="loading">
     <el-form label-width="80px" style="width:400px" :rules="rules" :model="mailBindingForm">
       <el-form-item label="邮箱号" prop="mail">
         <el-input v-model="mailBindingForm.mail"></el-input>
       </el-form-item>
       <el-form-item label="验证码" prop="verifyCode">
         <el-input placeholder="验证码内容" v-model="mailBindingForm.verifyCode" class="input-with-select">
-          <el-button slot="append" @click="getVerifyCode">{{hasVerifyCode ? codeTime : '获取验证码'}}</el-button>
+          <el-button slot="append" @click="getVerifyCode" :disabled="hasVerifyCode">{{hasVerifyCode ? codeTime : '获取验证码'}}</el-button>
         </el-input>
         <span v-if="hasVerifyCode">验证码已发送到您邮箱上</span>
       </el-form-item>
       <el-form-item>
-        <el-button type="primary" plain  @click="bindingEmail">完成绑定</el-button>
+        <el-button type="primary" plain  @click="bindingEmail ">完成绑定</el-button>
       </el-form-item>
     </el-form>
   </div>
@@ -25,11 +25,25 @@
   export default {
     name: "BindingMail",
     data(){
+      let isEmail = (rule, value, callback) => {
+        if (!value) {
+          callback();
+        } else {
+          const reg = /^[A-Za-z0-9]+([_\.][A-Za-z0-9]+)*@([A-Za-z0-9\-]+\.)+[A-Za-z]{2,6}$/;
+          const email = reg.test(value);
+          if (!email) {
+            callback(new Error("请输入正确的邮箱格式"));
+          } else {
+            callback();
+          }
+        }
+      };
       return{
         mailBindingForm:{
           mail:'',
           verifyCode:''
         },
+        loading: false,
         hasVerifyCode:false,
         codeTime:60,
         user:{},
@@ -40,6 +54,7 @@
           ],
           mail: [
             {required: true, message: '请输入邮箱', trigger: 'blur'},
+            { validator: isEmail, trigger: "blur" }
           ],
         }
       }
@@ -78,22 +93,37 @@
         })
       },
       bindingEmail(){
-        let params = {
-          id:this.user.id,
-          email:this.mailBindingForm.mail,
-          verifyCode: this.mailBindingForm.verifyCode
-        };
-        Http.put('/api/user/email',params).then(res=>{
-          if(res.msg == "ERROR"){
-            notify('error', '重新绑定失败:' + res.data);
-          }else{
-            notify('success', '重新绑定成功');
-            this.$router.push({path:'/personal/mailBinding'});
+        this.$refs['mailBindingForm'].validate(valid => {
+          if (!valid) {
+            this.showLoading();
+            let params = {
+              id:this.user.id,
+              email:this.mailBindingForm.mail,
+              verifyCode: this.mailBindingForm.verifyCode
+            };
+            Http.put('/api/user/email',params).then(res=>{
+              this.hideLoading();
+              if(res.msg == "ERROR"){
+                notify('error', '重新绑定失败:' + res.data);
+                this.codeTime = 60;
+                this.hasVerifyCode = false;
+              }else{
+                notify('success', '重新绑定成功');
+                this.$router.push({path:'/personal/mailBinding'});
+              }
+            }).catch(err=> {
+              this.hideLoading();
+              notify('error', err.data);
+            })
           }
-        }).catch(err=> {
-          notify('error', err.data);
         })
-      }
+      },
+      showLoading() {
+        this.loading = true
+      },
+      hideLoading() {
+        this.loading = false
+      },
     },
     mounted() {
       this.setUserInfo()

+ 96 - 85
src/pages/UserCenter/BindingMobile.vue

@@ -1,12 +1,14 @@
 <template>
-  <div style="margin-top: 20px">
+  <div style="margin-top: 20px" v-loading="loading">
     <el-form label-width="80px" style="width:400px" :rules="rules" :model="phoneBindingForm">
       <el-form-item label="手机号码" prop="phone">
         <el-input v-model="phoneBindingForm.phone"></el-input>
       </el-form-item>
       <el-form-item label="验证码" prop="verifyCode">
         <el-input placeholder="验证码内容" v-model="phoneBindingForm.verifyCode" class="input-with-select">
-          <el-button slot="append" @click="getVerifyCode">{{hasVerifyCode ? codeTime : '获取验证码'}}</el-button>
+          <el-button slot="append" @click="getVerifyCode" :disabled="hasVerifyCode">{{hasVerifyCode ? codeTime :
+            '获取验证码'}}
+          </el-button>
         </el-input>
         <span v-if="hasVerifyCode">验证码已发送到您手机上</span>
       </el-form-item>
@@ -19,94 +21,103 @@
 </template>
 
 <script>
-    import Http from '@/js/http.js'
-    import {storageGet} from '@/js/index'
-    import {notify} from '@/constants/index'
+  import Http from '@/js/http.js'
+  import {storageGet} from '@/js/index'
+  import {notify} from '@/constants/index'
 
-    export default {
-        name: "BindingMobile",
-        data() {
-            return {
-                phoneBindingForm: {
-                    phone: '',
-                    verifyCode: ''
-                },
-                hasVerifyCode: false,
-                codeTime: 60,
-                user: {},
-                rules: {
-                    verifyCode: [
-                        {required: true, message: '请输入验证码', trigger: 'blur'},
-                        {min: 6, max: 6, message: '验证码长度为6个字符', trigger: 'blur'}
-                    ],
-                    phone: [
-                        {required: true, message: '请输入手机号', trigger: 'blur'},
-                        {min: 11, max: 11, message: '手机号长度为11个字符', trigger: 'blur'}
-                    ],
-                }
-            }
+  export default {
+    name: "BindingMobile",
+    data() {
+      return {
+        phoneBindingForm: {
+          phone: '',
+          verifyCode: ''
         },
-        methods: {
-            setUserInfo() {
-                let userId = storageGet('user') && storageGet('user').userVO.id;
-                Http.get(`/api/user/${userId}`).then(res => {
-                    this.user = res.userVO
-                })
-            },
-            getVerifyCode() {
-                let params = {
-                    id: this.user.id,
-                    mobile: this.phoneBindingForm.phone
-                }
-                Http.put('/api/verify/mobile', params).then((res) => {
-                    if (res.msg == "ERROR") {
-                        notify('error', res.data);
-                    } else {
-                        notify('success', res.data);
-                        this.hasVerifyCode = true;
-                        let _this = this;
-                        let codeTimer = setInterval(function () {
-                            if (_this.codeTime > 0) {
-                                _this.codeTime--;
-                            } else {
-                                clearInterval(codeTimer);
-                                _this.hasVerifyCode = false;
-                                this.codeTime = 10;
-                            }
-                        }, 1000)
-                    }
-                }).catch(err => {
-                    notify('error', '绑定手机失败:' + err.data);
-                })
-            },
-            bindingMobile() {
-                // this.$refs['phoneBindingForm'].validate(valid => {
-                //     if (valid) {
-                //
-                //     }
-                // })
-                let params = {
-                    id: this.user.id,
-                    mobile: this.phoneBindingForm.phone,
-                    verifyCode: this.phoneBindingForm.verifyCode
-                };
-                Http.put('/api/user/mobile', params).then(res => {
-                    if (res.msg == "ERROR") {
-                        notify('error', '重新绑定失败:' + res.data);
-                    } else {
-                        notify('success', '重新绑定成功');
-                        this.$router.push({path: '/personal/phoneBinding'});
-                    }
-                }).catch(err => {
-                    notify('error', err.data);
-                })
-            }
-        },
-        mounted() {
-            this.setUserInfo()
+        loading: false,
+        hasVerifyCode: false,
+        codeTime: 60,
+        user: {},
+        rules: {
+          verifyCode: [
+            {required: true, message: '请输入验证码', trigger: 'blur'},
+            {min: 6, max: 6, message: '验证码长度为6个字符', trigger: 'blur'}
+          ],
+          phone: [
+            {required: true, message: '请输入手机号', trigger: 'blur'},
+            {min: 11, max: 11, message: '手机号不合法', trigger: 'blur'}
 
+          ],
+        }
+      }
+    },
+    methods: {
+      setUserInfo() {
+        let userId = storageGet('user') && storageGet('user').userVO.id;
+        Http.get(`/api/user/${userId}`).then(res => {
+          this.user = res.userVO
+        })
+      },
+      getVerifyCode() {
+        let params = {
+          id: this.user.id,
+          mobile: this.phoneBindingForm.phone
         }
+        Http.put('/api/verify/mobile', params).then((res) => {
+          if (res.msg == "ERROR") {
+            notify('error', res.data);
+          } else {
+            notify('success', res.data);
+            this.hasVerifyCode = true;
+            let _this = this;
+            let codeTimer = setInterval(function () {
+              if (_this.codeTime > 0) {
+                _this.codeTime--;
+              } else {
+                clearInterval(codeTimer);
+                _this.hasVerifyCode = false;
+                this.codeTime = 10;
+              }
+            }, 1000)
+          }
+        }).catch(err => {
+          notify('error', '绑定手机失败:' + err.data);
+        })
+      },
+      bindingMobile() {
+        let params = {
+          id: this.user.id,
+          mobile: this.phoneBindingForm.phone,
+          verifyCode: this.phoneBindingForm.verifyCode
+        };
+
+        Http.put('/api/user/mobile', params).then(res => {
+          if (res.msg == "ERROR") {
+            notify('error', '重新绑定失败:' + res.data);
+            this.active = 1;
+            this.phoneBindingForm.phone = '';
+            this.phoneBindingForm.verifyCode = '';
+            this.codeTime = 60;
+            this.hasVerifyCode = false;
+          } else {
+            notify('success', '重新绑定成功');
+            this.$router.push({path: '/personal/phoneBinding'});
+          }
+        }).catch(err => {
+          notify('error', err.data);
+        })
+      },
+      showLoading() {
+        this.loading = true
+      },
+      hideLoading() {
+        this.loading = false
+      },
+    },
+    mounted() {
+      this.setUserInfo()
+
     }
+  }
 </script>
 
 <style scoped>

+ 205 - 104
src/pages/UserCenter/EnterpriseAuth.vue

@@ -1,10 +1,10 @@
 <template>
-  <div class="right-modifyPsw">
+  <div class="right-modifyPsw"  v-loading="loading">
     <div class="right-modifyPsw-title">
       <span style="font-size: 18px;font-weight: bold">企业认证</span>
       <el-tag :type="authStatus.style" v-if="authType===1">{{authStatus.text}}</el-tag>
       <el-tag type="danger" v-if="authType===0">未认证</el-tag>
-      <el-button type="primary" class="pull-right" size="small" v-if="!canEdit" @click="canEdit = true">编辑</el-button>
+<!--      <el-button type="primary" class="pull-right" size="small" v-if="canEdit" @click="canEdit = true">编辑</el-button>-->
     </div>
     <el-steps :active="active" process-status="finish" style="width: 400px;margin: 0 auto;margin-bottom: 20px;">
       <el-step title="上传企业信息"></el-step>
@@ -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 :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">
@@ -155,7 +156,7 @@
                     <li>核实手持证件与原件方向一致,对焦身份证 进行拍照</li>
                     <li>您提供的照片众测服务平台将予以保护,不 会用于其他用途</li>
                   </ul>
-                  <a class="authentication-detail-list-blue">实名认证帮助></a>
+<!--                  <a class="authentication-detail-list-blue">实名认证帮助></a>-->
                 </div>
               </el-row>
             </div>
@@ -163,10 +164,11 @@
         </el-row>
       </div>
     </div>
-    <div class="enterprise-brn-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="submitEnterpriseAuth" v-if="active===1 && authStatus.text !=='认证通过'">提交审核</button>
+    <div class="enterprise-btn-wrapper" >
+      <button class="enterprise-btn previousBtn" style="cursor: pointer" @click="active--" v-if="active>0">上一步</button>
+      <button class="enterprise-btn nextBtn" style="cursor: pointer" @click="nextStep" v-if="active===0">下一步</button>
+      <button class="enterprise-btn nextBtn" style="cursor: pointer" @click="submitEnterpriseAuth" v-if="active===1 && authType === 0">提交审核</button>
+      <button class="enterprise-btn nextBtn" style="cursor: pointer" @click="submitEnterpriseAuth" v-if="active===1 && authStatus.text =='审核中'">修改审核</button>
     </div>
   </div>
 </template>
@@ -182,44 +184,123 @@
     name: "EnterpriseAuth",
     data() {
       return {
+        loading: false,
         active: 0,
         user: {},
         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() {
-        Http.put(`/api/user/${this.user.id}/agency`, this.enterpriseForm).then(res => {
-          if (res) {
-            notify('success', '提交成功');
-            this.$router.push('/personal/authentication')
+        this.$refs['enterpriseForm'].validate(valid => {
+          if (!valid) {
+            notify('error', '信息填写不规范');
+            return false
           }
         })
+        if(!this.enterpriseForm.idCardPositivePhoto){
+          notify('error', '身份证正面照片上传不规范');
+          return false;
+        }
+        if(!this.enterpriseForm.idCardBackPhoto){
+            notify('error', '身份证反面照片上传不规范');
+            return false;
+        }
+        let firstSubmit = this.$route.query.type;
+        let data = {...this.enterpriseForm,...this.enterpriseForm1};
+        this.showLoading();
+        if(firstSubmit == 1){
+          Http.post(`/api/user/${this.user.id}/agency`,data).then(res => {
+            if (res) {
+              notify('success', '提交成功');
+              this.$router.push('/personal/authentication')
+            }
+          }).catch(err => {
+            this.hideLoading();
+            notify('error', err.data)
+          })
+        }else{
+          Http.put(`/api/user/${this.user.id}/agency`, data).then(res => {
+            if (res) {
+              notify('success', '修改成功');
+              this.$router.push('/personal/authentication')
+            }
+          }).catch(err => {
+            this.hideLoading();
+            notify('error', err.data)
+          })
+        }
       },
       //获取当前认证状态
       getAuthStatus() {
         Http.get(`/api/user/${this.user.id}`).then(res => {
           if (res.agencyVO) {
             this.authType = 1  //企业已参与认证
-            this.authStatus = res.agencyVO.authStatus
-            //成功和审核中状态不可编辑,认证失败状态可编辑
-            this.authStatus.style !== 'info' ? this.canEdit = true : null
+            this.authStatus = res.agencyVO.authStatus ? res.agencyVO.authStatus : {}
+            //成功不可编辑,认证失败状态和审核中状态可编辑
+            this.authStatus.style !== 'success' ? this.canEdit = true : null
             this.failureReason = res.agencyVO.explain
             this.setFormInfo(res.agencyVO);
           } else {
@@ -238,9 +319,9 @@
           this.enterpriseForm.idCardPositivePhoto = detail.idCardPositivePhoto,
           this.enterpriseForm.idCardBackPhoto = detail.idCardBackPhoto,
           this.enterpriseForm.idCardDeadTime = detail.idCardDeadTime
-          this.enterpriseForm.businessLicensePhoto = detail.businessLicensePhoto
-          this.enterpriseForm.evaluationAgencyName = detail.evaluationAgencyName
-          this.enterpriseForm.agencyPhoto = detail.agencyPhoto
+          this.enterpriseForm1.businessLicensePhoto = detail.businessLicensePhoto
+          this.enterpriseForm1.evaluationAgencyName = detail.evaluationAgencyName
+          this.enterpriseForm1.agencyPhoto = detail.agencyPhoto
       },
       setUserInfo() {
         this.user = storageGet('user') && storageGet('user').userVO;
@@ -277,13 +358,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
+            this.enterpriseForm.idCardBackPhoto = res.data
           }else if(param.data.type == 0){
-            this.enterpriseForm.IDCardPositivePhoto = res.data
+            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');
@@ -291,10 +372,16 @@
           notify('error', error.data)
         })
       },
+      showLoading() {
+        this.loading = true
+      },
+      hideLoading() {
+        this.loading = false
+      },
     },
     mounted() {
       this.setUserInfo();
-      this.getAuthStatus()
+      this.getAuthStatus();
     }
   }
 </script>
@@ -305,7 +392,7 @@
     cursor: pointer;
     position: relative;
     overflow: hidden;
-    margin-right: 30px;
+    margin-right: 20px;
     width: 170px;
     height: 170px;
   }
@@ -314,23 +401,36 @@
     cursor: pointer;
     position: relative;
     overflow: hidden;
-    margin-right: 30px;
+    margin-right: 20px;
     width: 270px;
-    height: 150px;
+    height: 170px;
   }
   .idcard-uploader .el-upload{
     width: 270px;
     height: 170px;
   }
+  .avatar-uploader .el-upload{
+    width: 170px;
+    height: 170px;
+  }
   .avatar-uploader .el-upload:hover {
     border-color: #409EFF;
   }
+
   .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: 178px;
+    line-height: 170px;
     text-align: center;
   }
   .avatar {
@@ -349,14 +449,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{
@@ -380,24 +479,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;

+ 95 - 30
src/pages/UserCenter/IndividualAuth.vue

@@ -1,10 +1,10 @@
 <template>
-  <div class="right-modifyPsw" id="individualAuth">
+  <div class="right-modifyPsw" id="individualAuth" v-loading="loading">
     <div class="right-modifyPsw-title">
       <span style="font-size: 18px;font-weight: bold;margin-right: 10px">个人认证</span>
       <el-tag :type="authStatus.style" v-if="authType===1">{{authStatus.text}}</el-tag>
       <el-tag type="danger" v-if="authType===0">未认证</el-tag>
-      <el-button type="primary" class="pull-right" size="small" v-if="!canEdit" @click="canEdit = true">编辑</el-button>
+<!--      <el-button type="primary" class="pull-right" size="small" v-if="canEdit" @click="canEdit = true">编辑</el-button>-->
     </div>
     <!--    <div class="individual-steps-wrapper">-->
     <!--      <el-steps :active="active" process-status="finish" style="margin-bottom: 20px;width: 300px">-->
@@ -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,13 +42,13 @@
           >
         </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>
+          <el-checkbox :label="0">发</el-checkbox>
+          <el-checkbox :label="1">接</el-checkbox>
         </el-checkbox-group>
       </el-form-item>
     </el-form>
@@ -66,8 +66,9 @@
               :disabled="!canEdit"
             >
               <img v-if="individualForm.idCardPositivePhoto" :src="individualForm.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>
         </el-col>
         <el-col :span="15">
@@ -86,7 +87,7 @@
                   <li>核实手持证件与原件方向一致,对焦身份证 进行拍照</li>
                   <li>您提供的照片众测服务平台将予以保护,不 会用于其他用途</li>
                 </ul>
-                <a class="authentication-detail-list-blue">实名认证帮助></a>
+<!--                <a class="authentication-detail-list-blue">实名认证帮助></a>-->
               </el-col>
             </el-row>
           </div>
@@ -104,9 +105,10 @@
               :data="{type:1}"
             >
               <img v-if="individualForm.idCardBackPhoto" :src="individualForm.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">
@@ -131,9 +133,9 @@
     </div>
     <div class="enterprise-brn-wrapper">
       <!--      <button class="enterprise-btn previousBtn">上一步</button>-->
-      <el-button type="primary" @click="submitIndividualAuth" v-if="canEdit">提交审核</el-button>
+      <el-button type="primary" style="cursor: pointer" @click="submitIndividualAuth" v-if="canEdit && authType === 0">提交审核</el-button>
+      <el-button type="primary" style="cursor: pointer" @click="submitIndividualAuth" v-if="canEdit && authType != 0">修改审核</el-button>
     </div>
-
   </div>
 </template>
 
@@ -149,6 +151,7 @@
     name: "IndividualAuth",
     data() {
       return {
+        loading: false,
         active: 0,
         user: {},
         individualForm: {
@@ -156,8 +159,8 @@
           realName: "",
           gender: "",
           idCard: "",
-          idCardPositivePhoto: idcardPositive,
-          idCardBackPhoto: idcardBack,
+          idCardPositivePhoto: '',
+          idCardBackPhoto: '',
           idCardDeadTime: "",
           address: ""
         },
@@ -165,22 +168,74 @@
         authType: -1,
         authDetail: {},
         authStatus: '',
-        canEdit: false
+        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: {
       setUserInfo() {
+        this.type = this.$route.query.type;
         this.user = storageGet('user') && storageGet('user').userVO;
       },
       submitIndividualAuth() {
-        Http.put(`/api/user/${this.user.id}/personalAuth`, this.individualForm).then(res => {
-          if (res) {
-            notify('success', '提交成功');
-            this.$router.push('/personal/authentication')
+        this.$refs['individualForm'].validate(valid => {
+          if (!valid) {
+            notify('error', '信息填写不规范');
+            return false
           }
-        }).catch(err => {
-          notify('error', err.data)
         })
+        if(!this.individualForm.idCardPositivePhoto){
+          notify('error', '身份证正面照片上传不规范');
+          return false;
+        }
+        if(!this.individualForm.idCardBackPhoto){
+          notify('error', '身份证反面照片上传不规范');
+          return false;
+        }
+        this.showLoading();
+        let firstSubmit = this.$route.query.type;
+        if(firstSubmit == 1){
+          Http.post(`/api/user/${this.user.id}/personalAuth`, this.individualForm).then(res => {
+            if (res) {
+              notify('success', '提交成功');
+              this.$router.push('/personal/authentication')
+            }
+          }).catch(err => {
+            this.hideLoading();
+            notify('error', err.data)
+          })
+        }else{
+          Http.put(`/api/user/${this.user.id}/personalAuth`, this.individualForm).then(res => {
+            if (res) {
+              notify('success', '修改成功');
+              this.$router.push('/personal/authentication')
+            }
+          }).catch(err => {
+            console.log("错误信息");
+            console.log(err);
+            this.hideLoading();
+            notify('error', err.data)
+          })
+        }
       },
       //获取当前认证状态
       getAuthStatus() {
@@ -188,8 +243,8 @@
           if (res.personalAuthVO) {
             this.authType = 1  //个人已参与认证
             this.authStatus = res.personalAuthVO.authStatus
-            //成功和审核中状态不可编辑,认证失败状态可编辑
-            // this.authStatus.style === 'info' ? this.canEdit = true : null
+            //成功状态不可编辑,认证失败和审核中状态可编辑
+            this.authStatus.style !== 'success' ? this.canEdit = true : null
             this.failureReason = res.personalAuthVO.explain
             this.setFormInfo(res.personalAuthVO);
           } else {
@@ -243,16 +298,21 @@
         //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 === 0) {
-            this.individualForm.IDCardPositivePhoto = res.data
+            this.individualForm.idCardPositivePhoto = res.data
           } else {
-            this.individualForm.IDCardBackPhoto = res.data
+            this.individualForm.idCardBackPhoto = res.data
           }
           notify('success', '上传成功')
-          // this.$refs['agency'].validateField('photoUrl');
         }).catch(error => {
           notify('error', error.data)
         })
       },
+      showLoading() {
+        this.loading = true
+      },
+      hideLoading() {
+        this.loading = false
+      },
     },
     mounted() {
       this.setUserInfo();
@@ -271,6 +331,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;

+ 11 - 2
src/pages/UserCenter/MailBinding.vue

@@ -5,7 +5,7 @@
         <div class="right-modifyPsw-title">
           <span style="font-size: 18px;font-weight: bold">邮箱绑定</span>
         </div>
-        <div>
+        <div v-loading="loading">
           <div v-if="!user.email">
             <div style="background-color: rgba(233,239,249,1);padding: 10px;margin-bottom: 30px">
               <img src="../../assets/img/phoneUnbinding.png"></img>
@@ -43,6 +43,7 @@
     name: "MailBinding",
     data() {
       return {
+        loading:false,
         hasVerifyCode: false,
         bindingEmail: false,
         codeTime: 10,
@@ -54,10 +55,18 @@
       }
     },
     methods: {
+      showLoading() {
+        this.loading = true
+      },
+      hideLoading() {
+        this.loading = false
+      },
       setUserInfo() {
+        this.showLoading()
         let userId = storageGet('user')&&storageGet('user').userVO.id;
         Http.get(`/api/user/${userId}`).then(res=>{
-          this.user = res.userVO
+          this.user = res.userVO;
+          this.hideLoading()
         })
       },
       handleBindingEmail(){

+ 25 - 21
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"
@@ -33,14 +33,15 @@
         </el-form-item>
         <el-form-item label="生日" prop="birthday">
           <el-date-picker type="date" placeholder="选择日期" v-model="userForm.birthday"
-                          style="width: 100%;" :disabled="!isModifyMode"></el-date-picker>
+                          style="width: 100%;" :disabled="!isModifyMode"
+                          :picker-options="pickerOptions"></el-date-picker>
         </el-form-item>
         <el-form-item label="地址" prop="address" style="width: 160%">
           <provincecity
             ref="addFormProvince"
             @selectChange="locationChange"
-            :provinceCode="userForm.location==null?'3200':userForm.location.provinceCode"
-            :cityCode="userForm.location==null?'3201':userForm.location.cityCode"
+            :provinceCode="location?location.provinceCode:'3200'"
+            :cityCode="location?location.cityCode:'3201'"
             :isModifyMode="!isModifyMode"
           ></provincecity>
         </el-form-item>
@@ -78,7 +79,13 @@
           unit:'',
           personalCompetence:[],
           province:'',
-          city:''
+          city:'',
+        },
+        location:{},
+        pickerOptions: {
+          disabledDate(time) {
+            return time.getTime() > Date.now();
+          }
         },
         rules: {
           photoUrl: [
@@ -106,16 +113,14 @@
       provincecity
     },
     methods: {
-      submitUserInfo(){
-
-          this.$refs['userForm'].validate(valid => {
-              if (valid) {
-                  Http.put(`/api/personal/update/${this.user.id}`,this.userForm).then(res=>{
-                      this.isModifyMode = false;
-                  })
-              }
-          })
-
+      submitUserInfo() {
+        this.$refs['userForm'].validate(valid => {
+          if (valid) {
+            Http.put(`/api/personal/update/${this.user.id}`, this.userForm).then(res => {
+              this.isModifyMode = false;
+            })
+          }
+        })
       },
       //联系地址改变
       locationChange (provinceId, cityId) {
@@ -169,14 +174,13 @@
           this.userForm.birthday = res.userVO.birthday ? res.userVO.birthday : new Date();
           this.userForm.userName = res.userVO.userName ? res.userVO.userName : '';
           this.userForm.unit = res.userVO.unit ? res.userVO.unit : '';
-          this.userForm.province = res.userVO.unit ? res.userVO.province : '';
-          this.userForm.city = res.userVO.unit ? res.userVO.city : '';
+          this.userForm.province = res.userVO.province ? res.userVO.province : '';
+          this.userForm.city = res.userVO.city ? res.userVO.city : '';
           this.userForm.personalCompetence = res.userVO.personalCompetence ? res.userVO.personalCompetence : [];
-          //获取省市code
           let location = getProvinceCodeByProvinceName(this.userForm.province, this.userForm.city);
-          this.userForm.province = location.provinceCode;
-          this.userForm.city = location.cityCode;
-          this.userForm.location=location;
+          this.userForm.province = location&&location.provinceCode;
+          this.userForm.city = location&&location.cityCode;
+          this.location = location;
         })
       },
       setUserInfo(){

+ 0 - 1
src/pages/UserCenter/MyQualification.vue

@@ -189,7 +189,6 @@
         this.deleteQualification = true;
       },
       handleDeleteQualification(item){
-        console.log('delete')
         Http.delete(`/api/personal/deletequalification/${this.form.id}/${this.user.id}`,{}).then((res) => {
           this.deleteQualification = false;
           this.addQualification = false;

+ 10 - 1
src/pages/UserCenter/PhoneBinding.vue

@@ -4,7 +4,7 @@
       <div class="right-modifyPsw-title">
         <span style="font-size: 18px;font-weight: bold">手机绑定</span>
       </div>
-      <div>
+      <div v-loading="loading">
         <div style="background-color: rgba(233,239,249,1);padding: 10px;margin-bottom: 30px" v-if="user.mobile">
           <img src="../../assets/img/phoneBinding.png"></img>
           <span style="font-size: 16px">您已绑定的手机号码是{{this.user.mobile}}</span>
@@ -35,6 +35,7 @@
     data() {
       return {
         active: 0,
+        loading:false,
         showBingWranning:false,
         user:{},
         phoneBindingForm: {
@@ -44,6 +45,12 @@
       }
     },
     methods: {
+      showLoading() {
+        this.loading = true
+      },
+      hideLoading() {
+        this.loading = false
+      },
       changePhoneNumber(){
         this.$router.push({
           path: '/personal/phoneBinding/rebinding',
@@ -55,9 +62,11 @@
         });
       },
       setUserInfo(){
+        this.showLoading()
         let userId = storageGet('user')&&storageGet('user').userVO.id;
         Http.get(`/api/user/${userId}`).then(res=>{
           this.user = res.userVO
+          this.hideLoading()
         })
       },
     },

+ 32 - 9
src/pages/UserCenter/ReBindingMail.vue

@@ -1,12 +1,12 @@
 <template>
-  <div>
-    <el-form label-width="80px" style="width:400px;" :rules="rules">
+  <div v-loading="loading">
+    <el-form label-width="80px" style="width:400px;" :rules="rules" :model="emailBindingForm" :ref="emailBindingForm">
       <el-form-item label="新邮箱号" prop="email">
         <el-input v-model="emailBindingForm.email"></el-input>
       </el-form-item>
       <el-form-item label="验证码" prop="verifyCode">
         <el-input placeholder="验证码内容" v-model="emailBindingForm.verifyCode" class="input-with-select">
-          <el-button slot="append" @click="getVerifyCode">{{hasVerifyCode ? codeTime : '获取验证码'}}</el-button>
+          <el-button slot="append" @click="getVerifyCode" :disabled="hasVerifyCode">{{hasVerifyCode ? codeTime : '获取验证码'}}</el-button>
         </el-input>
         <span v-if="hasVerifyCode">验证码已发送到您邮箱上</span>
       </el-form-item>
@@ -26,9 +26,23 @@
   export default {
     name: "ReBindingMail",
     data() {
+      let isEmail = (rule, value, callback) => {
+        if (!value) {
+          callback();
+        } else {
+          const reg = /^[A-Za-z0-9]+([_\.][A-Za-z0-9]+)*@([A-Za-z0-9\-]+\.)+[A-Za-z]{2,6}$/;
+          const email = reg.test(value);
+          if (!email) {
+            callback(new Error("请输入正确的邮箱格式"));
+          } else {
+            callback();
+          }
+        }
+      };
       return {
         active: 0,
         user: {},
+        loading: false,
         emailBindingForm: {
           email: '',
           verifyCode: ''
@@ -38,11 +52,13 @@
         rules: {
           verifyCode: [
             {required: true, message: '请输入验证码', trigger: 'blur'},
+              {min:6, max: 6, message: '验证码长度为6个字符', trigger: 'blur'}
           ],
-          phone: [
+          email: [
             {required: true, message: '请输入邮箱', trigger: 'blur'},
+            { validator: isEmail, trigger: "blur" }
           ],
-        }
+        },
       }
     },
     methods: {
@@ -53,23 +69,24 @@
         })
       },
       reBindingMail() {
+        this.showLoading();
         let params = {
           "id": this.user.id,
           "email": this.emailBindingForm.email,
           "verifyCode": this.emailBindingForm.verifyCode
         };
-        if (this.emailBindingForm.email == this.user.email) {
-          notify('error', '请使用其他邮箱,此邮箱您已绑定!');
-        }
         Http.put('/api/user/email', params).then((res) => {
-
+          this.hideLoading();
           if (res.msg == "ERROR") {
             notify('error', '重新绑定失败:' + res.data);
+            this.codeTime = 60;
+            this.hasVerifyCode = false;
           } else {
             notify('success', '重新绑定成功');
             this.$router.push({path: '/personal/mailBinding'});
           }
         })
+
       },
       getVerifyCode() {
         let params = {
@@ -92,6 +109,12 @@
           notify('error', '获取验证码失败:' + err.data);
         })
       },
+      showLoading() {
+        this.loading = true
+      },
+      hideLoading() {
+        this.loading = false
+      },
     },
 
     mounted() {

+ 83 - 28
src/pages/UserCenter/ReBindingMobile.vue

@@ -1,25 +1,26 @@
 <template>
-  <div>
+  <div v-loading="loading">
     <el-steps :active="active" process-status="finish" style="margin: 20px">
       <el-step title="验证原手机"></el-step>
       <el-step title="绑定新手机"></el-step>
     </el-steps>
-
-    <el-form label-width="80px" style="width:400px;" :rules="rules">
+    <el-form label-width="80px" style="width:400px;" :rules="rules" :model="phoneBindingForm" :ref="phoneBindingForm">
       <el-form-item label="原手机号" v-if="active===0" prop="phone">
         <span v-model="phoneBindingForm.phone">{{this.user.mobile}}</span>
       </el-form-item>
-      <el-form-item label="新手机号" v-if="active===1" prop="phone">
-        <el-input v-model="phoneBindingForm.phone"></el-input>
+      <el-form-item label="新手机号" v-if="active===1" prop="newPhone">
+        <el-input v-model="phoneBindingForm.newPhone"></el-input>
       </el-form-item>
       <el-form-item label="验证码" prop="verifyCode">
         <el-input placeholder="验证码内容" v-model="phoneBindingForm.verifyCode" class="input-with-select">
-          <el-button slot="append" @click="getVerifyCode">{{hasVerifyCode ? codeTime : '获取验证码'}}</el-button>
+          <el-button slot="append" @click="getVerifyCode" :disabled="hasVerifyCode">{{hasVerifyCode ? codeTime :
+            '获取验证码'}}
+          </el-button>
         </el-input>
         <span v-if="hasVerifyCode">验证码已发送到您手机上</span>
       </el-form-item>
       <el-form-item>
-        <el-button type="primary" plain  @click="reBindingMobile">{{this.active===0 ?
+        <el-button type="primary" plain @click="reBindingMobile">{{this.active===0 ?
           '下一步':'完成绑定'}}
         </el-button>
       </el-form-item>
@@ -37,21 +38,28 @@
     name: "ReBindingMobile",
     data() {
       return {
+        loading: false,
         active: 0,
         user: {},
         phoneBindingForm: {
           phone: '',
-          verifyCode: ''
+          verifyCode: '',
+          newPhone: '',
         },
         hasVerifyCode: false,
         codeTime: 60,
         rules: {
           verifyCode: [
             {required: true, message: '请输入验证码', trigger: 'blur'},
+            {min: 6, max: 6, message: '验证码长度为6个字符', trigger: 'blur'}
           ],
           phone: [
             {required: true, message: '请输入手机号', trigger: 'blur'},
           ],
+          newPhone: [
+            {required: true, message: '请输入手机号', trigger: 'blur'},
+            {min: 11, max: 11, message: '手机号不合法', trigger: 'blur'}
+          ],
         }
       }
     },
@@ -64,6 +72,7 @@
         })
       },
       reBindingMobile() {
+        this.showLoading();
         if (this.active === 0) {
           //1.验证原手机
           let params = {
@@ -72,23 +81,36 @@
             "verifyCode": this.phoneBindingForm.verifyCode
           }
           Http.put('/api/verify/old/mobile', params).then(res => {
+            this.hideLoading();
             if (res.code === 20000) {
               notify('success', '验证成功');
               this.active = 1;
               this.phoneBindingForm.phone = '';
               this.phoneBindingForm.verifyCode = '';
+              this.hasVerifyCode = false;
+              this.codeTime = 60;
               this.setUserInfo();
+            } else {
+              notify('error', '验证原手机失败:' + res.data);
+              this.codeTime = 60;
+              this.hasVerifyCode = false;
             }
           }).catch(err => {
+            this.phoneBindingForm.phone = '';
+            this.phoneBindingForm.verifyCode = '';
+            this.codeTime = 60;
+            this.hasVerifyCode = false;
+            this.hideLoading();
             notify('error', '验证原手机失败:' + err.data);
           })
         } else {
           let params = {
             "id": this.user.id,
-            "mobile": this.phoneBindingForm.phone,
+            "mobile": this.phoneBindingForm.newPhone,
             "verifyCode": this.phoneBindingForm.verifyCode
           };
           Http.put('/api/user/mobile', params).then(res => {
+            this.hideLoading();
             if (res.msg == "ERROR") {
               notify('error', '重新绑定失败:' + res.data);
             } else {
@@ -96,32 +118,65 @@
               this.$router.push({path: '/personal/phoneBinding'});
             }
           }).catch(err => {
+            this.hideLoading();
             notify('error', '重新绑定失败:' + err.data);
           })
         }
 
       },
       getVerifyCode() {
-        let params = {
-          id: this.user.id,
-          mobile: this.phoneBindingForm.phone
+        if (this.active === 0) {
+          //1.验证原手机
+          let params = {
+            id: this.user.id,
+            mobile: this.phoneBindingForm.phone
+          }
+          Http.put('/api/verify/mobile', params).then((res) => {
+            this.hasVerifyCode = true;
+            let _this = this;
+            let codeTimer = setInterval(function () {
+              if (_this.codeTime > 0) {
+                _this.codeTime--;
+              } else {
+                clearInterval(codeTimer);
+                _this.hasVerifyCode = false;
+                this.codeTime = 10;
+              }
+            }, 1000)
+          }).catch(err => {
+            notify('error', '获取验证码失败:' + err.data);
+          })
+        } else {
+          //2.验证新手机
+          let params = {
+            id: this.user.id,
+            mobile: this.phoneBindingForm.newPhone
+          }
+
+          Http.put('/api/verify/mobile', params).then((res) => {
+            this.hasVerifyCode = true;
+            let _this = this;
+            let codeTimer = setInterval(function () {
+              if (_this.codeTime > 0) {
+                _this.codeTime--;
+              } else {
+                clearInterval(codeTimer);
+                _this.hasVerifyCode = false;
+                this.codeTime = 10;
+              }
+            }, 1000)
+          }).catch(err => {
+            notify('error', '获取验证码失败:' + err.data);
+          })
         }
-        Http.put('/api/verify/mobile', params).then((res) => {
-          this.hasVerifyCode = true;
-          let _this = this;
-          let codeTimer = setInterval(function () {
-            if (_this.codeTime > 0) {
-              _this.codeTime--;
-            } else {
-              clearInterval(codeTimer);
-              _this.hasVerifyCode = false;
-              this.codeTime = 10;
-            }
-          }, 1000)
-        }).catch(err => {
-          notify('error', '获取验证码失败:' + err.data);
-        })
-      }
+      },
+      showLoading() {
+        this.loading = true
+      },
+      hideLoading() {
+        this.loading = false
+      },
+
     },
     mounted() {
       this.setUserInfo();