|
|
|
@ -130,6 +130,7 @@ export default { |
|
|
|
|
this.leavePage() |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
this.autoLogout() |
|
|
|
|
this.assessmentId = this.getCookie("assessmentId"); |
|
|
|
|
if (window.history && window.history.pushState) { |
|
|
|
|
// 向历史记录中插入了当前页 |
|
|
|
@ -155,6 +156,20 @@ export default { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
autoLogout(){ |
|
|
|
|
let lastTime = new Date().getTime() |
|
|
|
|
let logout = false |
|
|
|
|
document.onmousedown = () => { |
|
|
|
|
lastTime = new Date().getTime() |
|
|
|
|
} |
|
|
|
|
setInterval(() => { |
|
|
|
|
if((new Date().getTime() - lastTime) > this.$config.autoLogoutTime){ |
|
|
|
|
logout || this.$message.error('用户登录过期,请重新登录') |
|
|
|
|
logout = true |
|
|
|
|
setTimeout(this.back,1500) |
|
|
|
|
} |
|
|
|
|
},1000) |
|
|
|
|
}, |
|
|
|
|
goBack() { |
|
|
|
|
this.leavePage() |
|
|
|
|
history.back() |
|
|
|
|