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

refactor:服务对象加锁

zhanghui пре 2 година
родитељ
комит
959f81b0aa

+ 15 - 2
myPages/serviceObjectAllInfo/index.vue

@@ -204,6 +204,7 @@
         data() {
             return {
                 userInfo: {
+
                     auth: true,
                     nickName: '',
                     sex: '1',
@@ -231,7 +232,8 @@
                         {gender:'未知',id:'2'}
                     ],
                 ],
-                imgUrl1: ''
+                imgUrl1: '',
+                requestStatus : false,
             };
         },
         mounted() {
@@ -292,6 +294,7 @@
             // 保存用户信息
             saveUserInfo(){
 
+
                 if(!this.userInfo.nickName){
                     uni.showToast({
                         title: "请认真填写宝贝昵称"
@@ -311,6 +314,11 @@
                     return;
                 }
 
+                if(this.requestStatus){
+                    return;
+                }
+                this.requestStatus=true
+
                 this.userInfo.auth = true;
 
                 if (this.userInfo.id){
@@ -322,11 +330,14 @@
                             title: "修改成功"
                         })
                         setTimeout(()=>{
+                            this.requestStatus=false
                             uni.redirectTo({
                                 url: '/myPages/ServiceObjectManagement/index'
                             });
                         },2000)
 
+                    }).catch(()=>{
+                        this.requestStatus=false
                     })
 
                 }else{
@@ -338,12 +349,14 @@
                             title: "保存成功"
                         })
                         setTimeout(()=>{
-
+                            this.requestStatus=false
                             uni.redirectTo({
                                 url: '/myPages/ServiceObjectManagement/index'
                             });
                         },2000)
 
+                    }).catch(()=>{
+                        this.requestStatus=false
                     })
                 }
 

+ 8 - 0
myPages/serviceObjectFaceAuth/index.vue

@@ -43,6 +43,7 @@
     },
     data() {
       return {
+        requestStatus:false,
         selectIcon:false,
         ossId:'',
         facePhotoUrl:'',
@@ -89,6 +90,11 @@
       verifyFace(){
         let that  = this;
 
+        if(this.requestStatus){
+          return;
+        }
+        this.requestStatus=true
+
         if(!this.selectIcon){
           uni.$u.toast('请阅读并同意《人脸识别服务协议》')
          return;
@@ -104,6 +110,7 @@
         })
 
         this.$api.verifyFace(that.reqParm).then((res)=>{
+          this.requestStatus=true
           uni.hideLoading();
           if(res.data.data.code == '500'){ //人脸不存在
             let serviceObject = {}
@@ -124,6 +131,7 @@
             })
           }
         }).catch((err) =>{
+          this.requestStatus=true
           uni.$u.toast('识别失败,请重新上传照片')
         });
 

+ 11 - 2
myPages/serviceObjectInfo/index.vue

@@ -83,6 +83,7 @@
     export default {
         data() {
             return {
+                requestStatus:false,
                 userInfo: {
                     auth: true,
                     nickName: '',
@@ -140,7 +141,10 @@
                     })
                     return;
                 }
-
+                if(this.requestStatus){
+                    return;
+                }
+                this.requestStatus=true
                 this.userInfo.auth = true;
 
                 if(this.userInfo.opType == '1'){ // 绑定
@@ -157,10 +161,13 @@
                         }
                         // 去服务对象列表页
                         setTimeout(()=>{
+                            this.requestStatus=false
                             uni.redirectTo({
                                 url: '/myPages/ServiceObjectManagement/index',
                             })
                         },3000)
+                    }).catch(()=>{
+                        this.requestStatus=false
                     })
                 }else if(this.userInfo.opType == '2'){ // 修改
                     // 修改数据
@@ -170,11 +177,13 @@
                         })
                         // 去服务对象列表页
                         setTimeout(()=>{
+                            this.requestStatus=false
                             uni.redirectTo({
                                 url: '/myPages/ServiceObjectManagement/index',
                             })
                         },3000)
-
+                    }).catch(()=>{
+                        this.requestStatus=false
                     })
                 }
             },