diff --git a/src/components/TestPanel.vue b/src/components/TestPanel.vue index d127ebe..ab1eb5a 100644 --- a/src/components/TestPanel.vue +++ b/src/components/TestPanel.vue @@ -163,7 +163,7 @@ export default { data() { return { test: [], - ishow: false, + ishow: true, grade: "00", exampleData: "", codeid: "", @@ -212,7 +212,7 @@ export default { deep: true, handler: function(val, oldVal) { let vm = this; - console.log(11,vm) + // console.log(11,vm) if (vm.needSendSunc) { vm.passToParent(val); } diff --git a/src/config/index.js b/src/config/index.js index ff1be13..a052fde 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -12,5 +12,9 @@ export default { /** * @description 跳转子系统链接 */ - systemId: 1 + systemId: 1, + /** + * @description 长时间未操作,自动退出登录时间 + */ + autoLogoutTime: 3600000 } \ No newline at end of file diff --git a/src/views/Home.vue b/src/views/Home.vue index 5bc198b..87446e3 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -129,6 +129,7 @@ export default { this.leavePage() }, mounted() { + this.autoLogout() this.assessmentId = this.getCookie("assessmentId"); if (window.history && window.history.pushState) { // 向历史记录中插入了当前页 @@ -154,6 +155,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()