<template>
<div id="app" @click="handleTime">
<router-view></router-view>
</div>
</template>
<script>
import {megError, megSuc} from "@/utils/notice";
export default {
name: 'APP',
data() {
return {
timmer: null,
lastTime: null
}
},
methods: {
handleTime() {
const curTime = new Date();
if (curTime - this.lastTime > 1000 * 60 * 30) {
//退出
if (this.$route.path == '/login') {
return
}
megError('登录超时,将返回登录页');
setTimeout(() => {
this.$store.dispatch('FedLogOut').then(() => {
this.$router.push({path: '/login'})
location.reload()
})
}, 2000)
} else {
this.lastTime = curTime;
VUE中30分钟无操作返回登录页
最新推荐文章于 2024-10-19 21:20:48 发布