Преглед изворни кода

优化验证手机号邮箱

guo00guo пре 5 година
родитељ
комит
361aeffc30

+ 148 - 120
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  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="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="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 label="审核通过时间" prop="checkTime">
+          <span>{{dateFormat(new Date(authentication.checkTime),'yyyy-MM-dd HH:mm:ss')}}</span>
         </el-form-item>
-        <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>

+ 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>

+ 31 - 19
src/pages/UserCenter/BindingMail.vue

@@ -1,5 +1,5 @@
 <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>
@@ -43,6 +43,7 @@
           mail:'',
           verifyCode:''
         },
+        loading: false,
         hasVerifyCode:false,
         codeTime:60,
         user:{},
@@ -92,26 +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);
-            this.emailBindingForm.email = '';
-            this.emailBindingForm.verifyCode = '';
-            this.codeTime = 60;
-            this.hasVerifyCode = false;
-          }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()

+ 10 - 2
src/pages/UserCenter/BindingMobile.vue

@@ -1,5 +1,5 @@
 <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>
@@ -33,6 +33,7 @@
           phone: '',
           verifyCode: ''
         },
+        loading: false,
         hasVerifyCode: false,
         codeTime: 60,
         user: {},
@@ -88,6 +89,7 @@
           mobile: this.phoneBindingForm.phone,
           verifyCode: this.phoneBindingForm.verifyCode
         };
+
         Http.put('/api/user/mobile', params).then(res => {
           if (res.msg == "ERROR") {
             notify('error', '重新绑定失败:' + res.data);
@@ -103,7 +105,13 @@
         }).catch(err => {
           notify('error', err.data);
         })
-      }
+      },
+      showLoading() {
+        this.loading = true
+      },
+      hideLoading() {
+        this.loading = false
+      },
     },
     mounted() {
       this.setUserInfo()

+ 28 - 9
src/pages/UserCenter/EnterpriseAuth.vue

@@ -1,5 +1,5 @@
 <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>
@@ -164,10 +164,11 @@
         </el-row>
       </div>
     </div>
-    <div class="enterprise-btn-wrapper">
-      <button class="enterprise-btn previousBtn" @click="active--" v-if="active>0">上一步</button>
-      <button class="enterprise-btn nextBtn" @click="nextStep" v-if="active===0">下一步</button>
-      <button class="enterprise-btn nextBtn" @click="submitEnterpriseAuth" v-if="active===1 && authStatus.text !=='认证通过'">提交审核</button>
+    <div 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>
@@ -183,6 +184,7 @@
     name: "EnterpriseAuth",
     data() {
       return {
+        loading: false,
         active: 0,
         user: {},
         canEdit:false,
@@ -258,25 +260,36 @@
             return false
           }
         })
-        if(!this.enterpriseForm.idCardPositivePhoto || !this.enterpriseForm.idCardBackPhoto){
-          notify('error', '身份证照片上传不规范');
+        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};
-        if(firstSubmit==1){
+        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`, this.enterpriseForm).then(res => {
+          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)
           })
         }
       },
@@ -359,6 +372,12 @@
           notify('error', error.data)
         })
       },
+      showLoading() {
+        this.loading = true
+      },
+      hideLoading() {
+        this.loading = false
+      },
     },
     mounted() {
       this.setUserInfo();

+ 22 - 5
src/pages/UserCenter/IndividualAuth.vue

@@ -1,5 +1,5 @@
 <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>
@@ -133,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>
 
@@ -151,6 +151,7 @@
     name: "IndividualAuth",
     data() {
       return {
+        loading: false,
         active: 0,
         user: {},
         individualForm: {
@@ -192,6 +193,7 @@
     },
     methods: {
       setUserInfo() {
+        this.type = this.$route.query.type;
         this.user = storageGet('user') && storageGet('user').userVO;
       },
       submitIndividualAuth() {
@@ -201,10 +203,15 @@
             return false
           }
         })
-        if(!this.individualForm.idCardPositivePhoto || !this.individualForm.idCardBackPhoto){
-          notify('error', '身份证照片上传不规范');
+        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 => {
@@ -213,6 +220,7 @@
               this.$router.push('/personal/authentication')
             }
           }).catch(err => {
+            this.hideLoading();
             notify('error', err.data)
           })
         }else{
@@ -222,6 +230,9 @@
               this.$router.push('/personal/authentication')
             }
           }).catch(err => {
+            console.log("错误信息");
+            console.log(err);
+            this.hideLoading();
             notify('error', err.data)
           })
         }
@@ -296,6 +307,12 @@
           notify('error', error.data)
         })
       },
+      showLoading() {
+        this.loading = true
+      },
+      hideLoading() {
+        this.loading = false
+      },
     },
     mounted() {
       this.setUserInfo();

+ 12 - 6
src/pages/UserCenter/ReBindingMail.vue

@@ -1,5 +1,5 @@
 <template>
-  <div>
+  <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>
@@ -42,6 +42,7 @@
       return {
         active: 0,
         user: {},
+        loading: false,
         emailBindingForm: {
           email: '',
           verifyCode: ''
@@ -68,25 +69,24 @@
         })
       },
       reBindingMail() {
+        this.showLoading();
         let params = {
           "id": this.user.id,
           "email": this.emailBindingForm.email,
           "verifyCode": this.emailBindingForm.verifyCode
         };
         Http.put('/api/user/email', params).then((res) => {
+          this.hideLoading();
           if (res.msg == "ERROR") {
             notify('error', '重新绑定失败:' + res.data);
-            this.emailBindingForm.email = '';
-            this.emailBindingForm.verifyCode = '';
             this.codeTime = 60;
             this.hasVerifyCode = false;
           } else {
             notify('success', '重新绑定成功');
-            if(confirm('重新绑定成功,即将跳转至邮箱绑定页面...')){
-              this.$router.push({path: '/personal/mailBinding'});
-            }
+            this.$router.push({path: '/personal/mailBinding'});
           }
         })
+
       },
       getVerifyCode() {
         let params = {
@@ -109,6 +109,12 @@
           notify('error', '获取验证码失败:' + err.data);
         })
       },
+      showLoading() {
+        this.loading = true
+      },
+      hideLoading() {
+        this.loading = false
+      },
     },
 
     mounted() {

+ 15 - 5
src/pages/UserCenter/ReBindingMobile.vue

@@ -1,5 +1,5 @@
 <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>
@@ -38,6 +38,7 @@
     name: "ReBindingMobile",
     data() {
       return {
+        loading: false,
         active: 0,
         user: {},
         phoneBindingForm: {
@@ -71,6 +72,7 @@
         })
       },
       reBindingMobile() {
+        this.showLoading();
         if (this.active === 0) {
           //1.验证原手机
           let params = {
@@ -79,6 +81,7 @@
             "verifyCode": this.phoneBindingForm.verifyCode
           }
           Http.put('/api/verify/old/mobile', params).then(res => {
+            this.hideLoading();
             if (res.code === 20000) {
               notify('success', '验证成功');
               this.active = 1;
@@ -97,6 +100,7 @@
             this.phoneBindingForm.verifyCode = '';
             this.codeTime = 60;
             this.hasVerifyCode = false;
+            this.hideLoading();
             notify('error', '验证原手机失败:' + err.data);
           })
         } else {
@@ -106,15 +110,15 @@
             "verifyCode": this.phoneBindingForm.verifyCode
           };
           Http.put('/api/user/mobile', params).then(res => {
+            this.hideLoading();
             if (res.msg == "ERROR") {
               notify('error', '重新绑定失败:' + res.data);
             } else {
               notify('success', '重新绑定成功');
-              if (confirm('重新绑定成功,即将跳转至手机绑定页面...')) {
-                this.$router.push({path: '/personal/mailBinding'});
-              }
+              this.$router.push({path: '/personal/phoneBinding'});
             }
           }).catch(err => {
+            this.hideLoading();
             notify('error', '重新绑定失败:' + err.data);
           })
         }
@@ -165,7 +169,13 @@
             notify('error', '获取验证码失败:' + err.data);
           })
         }
-      }
+      },
+      showLoading() {
+        this.loading = true
+      },
+      hideLoading() {
+        this.loading = false
+      },
 
     },
     mounted() {