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.

68 lines
1.6 KiB

4 years ago
<template>
<div class="main">
<v-head></v-head>
<div class="layout">
<div class="content">
<transition name="move" mode="out-in">
<router-view class="view"></router-view>
</transition>
<el-backtop target=".content"></el-backtop>
<v-footer ref="footer"></v-footer>
</div>
</div>
</div>
</template>
<script>
4 years ago
import { mapState, mapActions } from "vuex";
import util from "@/libs/util";
import Setting from "@/setting";
import vHead from "../header";
import vFooter from "../footer";
4 years ago
export default {
data() {
return {
4 years ago
};
},
components: {
vHead,
vFooter
},
4 years ago
computed: {},
4 years ago
mounted() {
4 years ago
this.autoLogout();
4 years ago
},
methods: {
4 years ago
...mapActions("user", [
"logout"
4 years ago
]),
// 长时间未操作,自动退出登录
4 years ago
autoLogout() {
let lastTime = new Date().getTime();
4 years ago
document.onmousedown = () => {
4 years ago
lastTime = new Date().getTime();
};
4 years ago
setInterval(() => {
4 years ago
if (util.local.get(Setting.tokenKey) && (new Date().getTime() - lastTime) > Setting.autoLogoutTime) {
util.errorMsg("用户登录过期,请重新登录");
setTimeout(this.logout, 1500);
4 years ago
}
4 years ago
}, 1000);
4 years ago
}
}
};
</script>
<style lang="scss" scoped>
.main{
min-height: calc(100% - 64px);
.layout{
padding-top: 64px;
}
.index{
padding: 0;
4 years ago
}
4 years ago
}
4 years ago
</style>