|
@@ -137,28 +137,45 @@ export default {
|
|
"心跳",
|
|
"心跳",
|
|
"失败10次-退出",
|
|
"失败10次-退出",
|
|
]);
|
|
]);
|
|
- const redirectUrl = sessionStorage.getItem("redirectUrl");
|
|
|
|
this.logger({
|
|
this.logger({
|
|
action: "发出心跳",
|
|
action: "发出心跳",
|
|
error: "心跳失败",
|
|
error: "心跳失败",
|
|
detail: `失败10次-退出`,
|
|
detail: `失败10次-退出`,
|
|
});
|
|
});
|
|
console.log(`失败10次-退出`);
|
|
console.log(`失败10次-退出`);
|
|
|
|
+ // this.logout('心跳失败10次-退出');
|
|
|
|
+ // const redirectUrl = sessionStorage.getItem("redirectUrl");
|
|
|
|
+ // this.$Modal.error({
|
|
|
|
+ // title: "网络连接异常",
|
|
|
|
+ // content: "退出考试",
|
|
|
|
+ // onOk: () => {
|
|
|
|
+ // if (redirectUrl) {
|
|
|
|
+ // window.location = redirectUrl;
|
|
|
|
+ // } else {
|
|
|
|
+ // this.$router.push(
|
|
|
|
+ // "/login/" +
|
|
|
|
+ // localStorage.getItem("domain") +
|
|
|
|
+ // "?LogoutReason=心跳失败10次-退出"
|
|
|
|
+ // );
|
|
|
|
+ // }
|
|
|
|
+ // },
|
|
|
|
+ // });
|
|
|
|
+ let clicked = false;
|
|
this.$Modal.error({
|
|
this.$Modal.error({
|
|
title: "网络连接异常",
|
|
title: "网络连接异常",
|
|
content: "退出考试",
|
|
content: "退出考试",
|
|
onOk: () => {
|
|
onOk: () => {
|
|
- if (redirectUrl) {
|
|
|
|
- window.location = redirectUrl;
|
|
|
|
- } else {
|
|
|
|
- this.$router.push(
|
|
|
|
- "/login/" +
|
|
|
|
- localStorage.getItem("domain") +
|
|
|
|
- "?LogoutReason=心跳失败10次-退出"
|
|
|
|
- );
|
|
|
|
- }
|
|
|
|
|
|
+ clicked = true;
|
|
|
|
+ this.logout("?LogoutReason=心跳失败10次-退出-clicked");
|
|
},
|
|
},
|
|
});
|
|
});
|
|
|
|
+ // 心跳失败后,定时退出,否则长期停留在此界面,会发出很多无用请求
|
|
|
|
+ this.exitTimeout = setTimeout(() => {
|
|
|
|
+ if (!clicked) {
|
|
|
|
+ this.$Modal.remove();
|
|
|
|
+ this.logout("?LogoutReason=心跳失败10次-退出-timeout");
|
|
|
|
+ }
|
|
|
|
+ }, 90 * 1000);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
this.retryHeartbeatTimeout = setTimeout(() => {
|
|
this.retryHeartbeatTimeout = setTimeout(() => {
|
|
@@ -175,6 +192,7 @@ export default {
|
|
clearInterval(this.remainTimeInterval);
|
|
clearInterval(this.remainTimeInterval);
|
|
clearTimeout(this.retryHeartbeatTimeout);
|
|
clearTimeout(this.retryHeartbeatTimeout);
|
|
clearInterval(this.enhancedRemainTimeInterval);
|
|
clearInterval(this.enhancedRemainTimeInterval);
|
|
|
|
+ clearTimeout(this.exitTimeout);
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|
|
};
|