You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.5 KiB

4 years ago
<template>
1 year ago
<div class="wrapper">
<v-head></v-head>
<v-sidebar></v-sidebar>
<div class="content-box">
<div class="content">
6 months ago
<transition name="move" mode="out-in">
1 year ago
<!-- <keep-alive> -->
<router-view></router-view>
<!-- </keep-alive> -->
</transition>
<el-backtop target=".content"></el-backtop>
</div>
4 years ago
</div>
1 year ago
</div>
4 years ago
</template>
<script>
import vHead from '../components/Header.vue';
import vSidebar from '../components/Sidebar.vue';
1 year ago
import Setting from "@/setting";
import util from "@/libs/util";
4 years ago
export default {
1 year ago
data () {
return {
tagsList: [],
};
},
components: {
vHead,
vSidebar,
},
created () {
6 months ago
// this.autoLogout()
1 year ago
},
methods: {
// 长时间未操作,自动退出登录
autoLogout () {
let lastTime = new Date().getTime();
document.onmousedown = () => {
lastTime = new Date().getTime();
};
const timer = setInterval(() => {
if (sessionStorage.getItem('token') && (new Date().getTime() - lastTime) > Setting.autoLogoutTime) {
clearInterval(timer)
1 year ago
util.errorMsg("由于您已经有三个小时没有操作,系统自动登出,请重新登录。页面刷新到登录页。");
1 year ago
setTimeout(() => {
localStorage.removeItem('ms_username');
localStorage.removeItem('token');
sessionStorage.clear()
location.reload()
}, 1500);
}
}, 1000);
4 years ago
}
1 year ago
}
4 years ago
};
</script>