xw 2 týždňov pred
rodič
commit
2483fbcdda

+ 40 - 24
src/views/qw/user/cuDeptIdIndex.vue

@@ -725,48 +725,60 @@ export default {
       })
     },
 
-	handleTwoCode(val){
-
-		twoCode({ qwUserId: val.id }).then(res => {
-		console.log(res)
-		this.qwLoginTwo.open=true;
-		this.qwLoginTwo.codeUrl=res.qrCode
-
-        });
-
-
+	showTwoCodeDialog() {
+	  twoCode({ qwUserId: this.qwUserId }).then(res => {
+	    if (res.qrCode) {
+	      this.qwLoginTwo.open = true;
+	      this.qwLoginTwo.codeUrl = res.qrCode;
+	      this.twoCodePolling();
+	    } else {
+	      this.$message.error(res.msg || '获取二次验证二维码失败');
+	    }
+	  });
+	},
+	handleTwoCode(val) {
+	  this.qwUserId = val.id;
+	  this.showTwoCodeDialog();
 	},
 	twoCodePolling() {
+	  if (this.twoCodeInterval) {
+	    clearInterval(this.twoCodeInterval);
+	  }
 	  this.twoCodeInterval = setInterval(() => {
 	    twoCodeStatus({ qwUserId: this.qwUserId }).then(res => {
-			console.log(res)
-
-	      if (res.msg==104001) {
-			this.$message.success('登录成功');
-			this.clearDl()
-	        clearInterval(this.loginQwInterval);
-	      }else if(res.msg==100004){
-			  this.clearDl()
-		  }
+	      if (res.msg == 104001) {
+	        this.$message.success('登录成功');
+	        clearInterval(this.twoCodeInterval);
+	        this.clearDl();
+	      } else if (res.msg == 22) {
+	        this.$message.error('账号企业不一致请重新扫码登录');
+	        clearInterval(this.twoCodeInterval);
+	        this.clearDl();
+	      } else if (res.msg == 23) {
+	        this.$message.error('账号不匹配,请同步信息后重新扫码登录');
+	        clearInterval(this.twoCodeInterval);
+	        this.clearDl();
+	      }
 	    });
 	  }, 3000);
 	},
     loginQwPolling() {
       this.loginQwInterval = setInterval(() => {
         qrCodeStatus({ qwUserId: this.qwUserId }).then(res => {
-			console.log(res)
 			if (res.msg==22) {
 				this.$message.success('账号企业不一致请重新扫码登录');
 				this.clearDl();
 			}
           if (res.msg==104001) {
 			this.$message.success('登录成功');
-			this.clearDl()
-
-          }else if(res.msg==100004){
+			this.clearDl();
+          } else if(res.msg==100004){
 			  this.qwCode.open=true;
 			  clearInterval(this.loginQwInterval);
-		  }
+		  } else if (res.msg == 100012) {
+            clearInterval(this.loginQwInterval);
+            this.showTwoCodeDialog();
+          }
         });
       }, 3000);
     },
@@ -791,6 +803,8 @@ export default {
 			         if (res.msg == 104001) {
 			             this.$message.success('登录成功');
 			             this.clearDl();
+			         } else if (res.msg == 100012) {
+			             this.showTwoCodeDialog();
 			         }
 			     });
 			 }, 4000);
@@ -800,7 +814,9 @@ export default {
 	clearDl(){
 		this.qwCode.open=false;
 		this.qwLogin.open=false;
+		this.qwLoginTwo.open = false;
 		clearInterval(this.loginQwInterval);
+		clearInterval(this.twoCodeInterval);
 		this.getList()
 	},
 

+ 34 - 18
src/views/qw/user/index.vue

@@ -959,28 +959,39 @@ export default {
       })
     },
 
-    handleTwoCode(val) {
-
-      twoCode({qwUserId: val.id}).then(res => {
-        console.log(res)
-        this.qwLoginTwo.open = true;
-        this.qwLoginTwo.codeUrl = res.qrCode
-
+    showTwoCodeDialog() {
+      twoCode({qwUserId: this.qwUserId}).then(res => {
+        if (res.qrCode) {
+          this.qwLoginTwo.open = true;
+          this.qwLoginTwo.codeUrl = res.qrCode;
+          this.twoCodePolling();
+        } else {
+          this.$message.error(res.msg || '获取二次验证二维码失败');
+        }
       });
-
-
+    },
+    handleTwoCode(val) {
+      this.qwUserId = val.id;
+      this.showTwoCodeDialog();
     },
     twoCodePolling() {
+      if (this.twoCodeInterval) {
+        clearInterval(this.twoCodeInterval);
+      }
       this.twoCodeInterval = setInterval(() => {
         twoCodeStatus({qwUserId: this.qwUserId}).then(res => {
-          console.log(res)
-
           if (res.msg == 104001) {
             this.$message.success('登录成功');
-            this.clearDl()
-            clearInterval(this.loginQwInterval);
-          } else if (res.msg == 100004) {
-            this.clearDl()
+            clearInterval(this.twoCodeInterval);
+            this.clearDl();
+          } else if (res.msg == 22) {
+            this.$message.error('账号企业不一致请重新扫码登录');
+            clearInterval(this.twoCodeInterval);
+            this.clearDl();
+          } else if (res.msg == 23) {
+            this.$message.error('账号不匹配,请同步信息后重新扫码登录');
+            clearInterval(this.twoCodeInterval);
+            this.clearDl();
           }
         });
       }, 3000);
@@ -988,7 +999,6 @@ export default {
     loginQwPolling() {
       this.loginQwInterval = setInterval(() => {
         qrCodeStatus({qwUserId: this.qwUserId}).then(res => {
-          console.log(res)
           if (res.msg == 22) {
             this.$message.success('账号企业不一致请重新扫码登录');
             this.clearDl();
@@ -999,11 +1009,13 @@ export default {
           }
           if (res.msg == 104001) {
             this.$message.success('登录成功');
-            this.clearDl()
-
+            this.clearDl();
           } else if (res.msg == 100004) {
             this.qwCode.open = true;
             clearInterval(this.loginQwInterval);
+          } else if (res.msg == 100012) {
+            clearInterval(this.loginQwInterval);
+            this.showTwoCodeDialog();
           }
         });
       }, 3000);
@@ -1029,6 +1041,8 @@ export default {
             if (res.msg == 104001) {
               this.$message.success('登录成功');
               this.clearDl();
+            } else if (res.msg == 100012) {
+              this.showTwoCodeDialog();
             }
           });
         }, 4000);
@@ -1038,7 +1052,9 @@ export default {
     clearDl() {
       this.qwCode.open = false;
       this.qwLogin.open = false;
+      this.qwLoginTwo.open = false;
       clearInterval(this.loginQwInterval);
+      clearInterval(this.twoCodeInterval);
       this.getList()
     },
 

+ 34 - 18
src/views/qw/user/myIndex.vue

@@ -831,28 +831,39 @@ export default {
       })
     },
 
-    handleTwoCode(val) {
-
-      twoCode({qwUserId: val.id}).then(res => {
-        console.log(res)
-        this.qwLoginTwo.open = true;
-        this.qwLoginTwo.codeUrl = res.qrCode
-
+    showTwoCodeDialog() {
+      twoCode({qwUserId: this.qwUserId}).then(res => {
+        if (res.qrCode) {
+          this.qwLoginTwo.open = true;
+          this.qwLoginTwo.codeUrl = res.qrCode;
+          this.twoCodePolling();
+        } else {
+          this.$message.error(res.msg || '获取二次验证二维码失败');
+        }
       });
-
-
+    },
+    handleTwoCode(val) {
+      this.qwUserId = val.id;
+      this.showTwoCodeDialog();
     },
     twoCodePolling() {
+      if (this.twoCodeInterval) {
+        clearInterval(this.twoCodeInterval);
+      }
       this.twoCodeInterval = setInterval(() => {
         twoCodeStatus({qwUserId: this.qwUserId}).then(res => {
-          console.log(res)
-
           if (res.msg == 104001) {
             this.$message.success('登录成功');
-            this.clearDl()
-            clearInterval(this.loginQwInterval);
-          } else if (res.msg == 100004) {
-            this.clearDl()
+            clearInterval(this.twoCodeInterval);
+            this.clearDl();
+          } else if (res.msg == 22) {
+            this.$message.error('账号企业不一致请重新扫码登录');
+            clearInterval(this.twoCodeInterval);
+            this.clearDl();
+          } else if (res.msg == 23) {
+            this.$message.error('账号不匹配,请同步信息后重新扫码登录');
+            clearInterval(this.twoCodeInterval);
+            this.clearDl();
           }
         });
       }, 3000);
@@ -860,18 +871,19 @@ export default {
     loginQwPolling() {
       this.loginQwInterval = setInterval(() => {
         qrCodeStatus({qwUserId: this.qwUserId}).then(res => {
-          console.log(res)
           if (res.msg == 22) {
             this.$message.success('账号企业不一致请重新扫码登录');
             this.clearDl();
           }
           if (res.msg == 104001) {
             this.$message.success('登录成功');
-            this.clearDl()
-
+            this.clearDl();
           } else if (res.msg == 100004) {
             this.qwCode.open = true;
             clearInterval(this.loginQwInterval);
+          } else if (res.msg == 100012) {
+            clearInterval(this.loginQwInterval);
+            this.showTwoCodeDialog();
           }
         });
       }, 3000);
@@ -897,6 +909,8 @@ export default {
             if (res.msg == 104001) {
               this.$message.success('登录成功');
               this.clearDl();
+            } else if (res.msg == 100012) {
+              this.showTwoCodeDialog();
             }
           });
         }, 4000);
@@ -906,7 +920,9 @@ export default {
     clearDl() {
       this.qwCode.open = false;
       this.qwLogin.open = false;
+      this.qwLoginTwo.open = false;
       clearInterval(this.loginQwInterval);
+      clearInterval(this.twoCodeInterval);
       this.getList()
     },