|
@@ -658,6 +658,8 @@ export default {
|
|
|
title:"",
|
|
title:"",
|
|
|
open:false,
|
|
open:false,
|
|
|
code:null,
|
|
code:null,
|
|
|
|
|
+ submitted:false,
|
|
|
|
|
+ waitCount:0,
|
|
|
},
|
|
},
|
|
|
cloudAPOpen:{
|
|
cloudAPOpen:{
|
|
|
open:false,
|
|
open:false,
|
|
@@ -814,6 +816,15 @@ export default {
|
|
|
if (val.appKey == null || val.appKey === '') {
|
|
if (val.appKey == null || val.appKey === '') {
|
|
|
return this.$message.warning("没有授权码,无法登录企业微信,请授权");
|
|
return this.$message.warning("没有授权码,无法登录企业微信,请授权");
|
|
|
}
|
|
}
|
|
|
|
|
+ // 二次登录前清掉上次验证码弹窗与轮询,避免残留
|
|
|
|
|
+ if (this.loginQwInterval) {
|
|
|
|
|
+ clearInterval(this.loginQwInterval);
|
|
|
|
|
+ this.loginQwInterval = null;
|
|
|
|
|
+ }
|
|
|
|
|
+ this.qwCode.open = false;
|
|
|
|
|
+ this.qwCode.code = null;
|
|
|
|
|
+ this.qwCode.submitted = false;
|
|
|
|
|
+ this.qwCode.waitCount = 0;
|
|
|
loginQwIpad({qwUserId: val.id}).then(res => {
|
|
loginQwIpad({qwUserId: val.id}).then(res => {
|
|
|
this.qwUserId = val.id;
|
|
this.qwUserId = val.id;
|
|
|
this.qwLogin.code = null;
|
|
this.qwLogin.code = null;
|
|
@@ -858,59 +869,75 @@ export default {
|
|
|
}, 3000);
|
|
}, 3000);
|
|
|
},
|
|
},
|
|
|
loginQwPolling() {
|
|
loginQwPolling() {
|
|
|
|
|
+ if (this.loginQwInterval) {
|
|
|
|
|
+ clearInterval(this.loginQwInterval);
|
|
|
|
|
+ this.loginQwInterval = null;
|
|
|
|
|
+ }
|
|
|
this.loginQwInterval = setInterval(() => {
|
|
this.loginQwInterval = setInterval(() => {
|
|
|
qrCodeStatus({qwUserId: this.qwUserId}).then(res => {
|
|
qrCodeStatus({qwUserId: this.qwUserId}).then(res => {
|
|
|
console.log(res)
|
|
console.log(res)
|
|
|
if (res.msg == 22) {
|
|
if (res.msg == 22) {
|
|
|
- this.$message.success('账号企业不一致请重新扫码登录');
|
|
|
|
|
|
|
+ this.$message.error('扫码企微与员工所属企业不一致,请重新点击登录,使用正确企微扫码');
|
|
|
this.clearDl();
|
|
this.clearDl();
|
|
|
- }
|
|
|
|
|
- if (res.msg == 23) {
|
|
|
|
|
- this.$message.success('账号不匹配,请同步信息后重新扫码登录');
|
|
|
|
|
|
|
+ } else if (res.msg == 23) {
|
|
|
|
|
+ this.$message.error('扫码账号与员工不一致,请同步信息后重新点击登录扫码');
|
|
|
this.clearDl();
|
|
this.clearDl();
|
|
|
- }
|
|
|
|
|
- if (res.msg == 104001) {
|
|
|
|
|
|
|
+ } else if (res.msg == 104001) {
|
|
|
this.$message.success('登录成功');
|
|
this.$message.success('登录成功');
|
|
|
this.clearDl()
|
|
this.clearDl()
|
|
|
-
|
|
|
|
|
} else if (res.msg == 100004) {
|
|
} else if (res.msg == 100004) {
|
|
|
- this.qwCode.open = true;
|
|
|
|
|
- clearInterval(this.loginQwInterval);
|
|
|
|
|
|
|
+ // 已提交过验证码则不再弹窗;进入验证码后关闭二维码,避免同一码换主体再扫
|
|
|
|
|
+ if (!this.qwCode.open && !this.qwCode.submitted) {
|
|
|
|
|
+ this.qwLogin.open = false;
|
|
|
|
|
+ this.qwCode.code = null;
|
|
|
|
|
+ this.qwCode.open = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (this.qwCode.submitted) {
|
|
|
|
|
+ // 验码后等待终态,超时则提示重试,避免一直空转
|
|
|
|
|
+ this.qwCode.waitCount = (this.qwCode.waitCount || 0) + 1;
|
|
|
|
|
+ if (this.qwCode.waitCount >= 20) {
|
|
|
|
|
+ this.$message.warning('登录确认超时,请重新点击登录后再扫码');
|
|
|
|
|
+ this.clearDl();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- });
|
|
|
|
|
|
|
+ }).catch(() => {});
|
|
|
}, 3000);
|
|
}, 3000);
|
|
|
},
|
|
},
|
|
|
submitCodeForm() {
|
|
submitCodeForm() {
|
|
|
-
|
|
|
|
|
|
|
+ if (!this.qwCode.code) {
|
|
|
|
|
+ return this.$message.warning('请输入验证码');
|
|
|
|
|
+ }
|
|
|
qrCodeVerify({code: this.qwCode.code, qwUserId: this.qwUserId}).then(res => {
|
|
qrCodeVerify({code: this.qwCode.code, qwUserId: this.qwUserId}).then(res => {
|
|
|
console.log(res)
|
|
console.log(res)
|
|
|
-
|
|
|
|
|
- this.$message.success('验证成功账号信息确认中。。。。');
|
|
|
|
|
this.qwCode.open = false;
|
|
this.qwCode.open = false;
|
|
|
- this.loginQwInterval = setTimeout(() => {
|
|
|
|
|
- qrCodeStatus({qwUserId: this.qwUserId}).then(res => {
|
|
|
|
|
- console.log(res);
|
|
|
|
|
- if (res.msg == 23) {
|
|
|
|
|
- this.$message.error('账号不一致请重新扫码登录');
|
|
|
|
|
- this.clearDl();
|
|
|
|
|
- }
|
|
|
|
|
- if (res.msg == 22) {
|
|
|
|
|
- this.$message.error('账号企业不一致请重新扫码登录');
|
|
|
|
|
- this.clearDl();
|
|
|
|
|
- }
|
|
|
|
|
- if (res.msg == 104001) {
|
|
|
|
|
- this.$message.success('登录成功');
|
|
|
|
|
- this.clearDl();
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }, 4000);
|
|
|
|
|
|
|
+ this.qwCode.code = null;
|
|
|
|
|
+ this.qwCode.submitted = true;
|
|
|
|
|
+ this.qwCode.waitCount = 0;
|
|
|
|
|
+ if (res.msg === 'NOT_NEED_VERIFY') {
|
|
|
|
|
+ this.$message.info('当前无需验证码,正在确认登录状态...');
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$message.success('验证成功,账号信息确认中...');
|
|
|
|
|
+ }
|
|
|
|
|
+ this.loginQwPolling();
|
|
|
|
|
+ }).catch(err => {
|
|
|
|
|
+ const msg = (err && err.message) ? err.message : '';
|
|
|
|
|
+ // 需要重新发起登录的错误,直接收掉弹窗
|
|
|
|
|
+ if (msg.indexOf('重新点击登录') !== -1 || msg.indexOf('已过期') !== -1 || msg.indexOf('企业不一致') !== -1) {
|
|
|
|
|
+ this.clearDl();
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
clearDl() {
|
|
clearDl() {
|
|
|
this.qwCode.open = false;
|
|
this.qwCode.open = false;
|
|
|
|
|
+ this.qwCode.code = null;
|
|
|
|
|
+ this.qwCode.submitted = false;
|
|
|
|
|
+ this.qwCode.waitCount = 0;
|
|
|
this.qwLogin.open = false;
|
|
this.qwLogin.open = false;
|
|
|
- clearInterval(this.loginQwInterval);
|
|
|
|
|
|
|
+ if (this.loginQwInterval) {
|
|
|
|
|
+ clearInterval(this.loginQwInterval);
|
|
|
|
|
+ this.loginQwInterval = null;
|
|
|
|
|
+ }
|
|
|
this.getList()
|
|
this.getList()
|
|
|
},
|
|
},
|
|
|
|
|
|