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.

94 lines
2.3 KiB

4 years ago
<template>
1 year ago
<div class="wrapper">
<v-head></v-head>
3 months ago
<Navbar></Navbar>
<div class="layout">
3 months ago
<Sidebar :class="{ show: showSidebar }" :path.sync="path" />
3 months ago
<div class="content-box">
6 months ago
<transition name="move" mode="out-in">
1 year ago
<router-view></router-view>
</transition>
<el-backtop target=".content-box"></el-backtop>
1 year ago
</div>
4 years ago
</div>
1 year ago
</div>
4 years ago
</template>
<script>
3 months ago
import vHead from '../components/Header.vue'
import Navbar from '../components/Navbar.vue'
import Sidebar from '../components/Sidebar.vue'
import Setting from "@/setting"
import util from "@/libs/util"
4 years ago
export default {
1 year ago
data () {
return {
3 months ago
showSidebar: false,
3 months ago
path: '',
1 year ago
};
},
components: {
vHead,
3 months ago
Navbar,
Sidebar,
},
watch: {
'$route.path': {
handler (val) {
3 months ago
this.path = val
3 months ago
// 是否显示左侧导航
3 months ago
this.showSidebar = ['/configure', '/curriculum', '/information', '/shop', '/market', '/parnerOperation', '/parner', '/match', '/data', '/review', '/theoreticalCourse', '/resourse'].includes(val)
3 months ago
},
immediate: true
}
1 year ago
},
created () {
3 months ago
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>
3 months ago
<style lang="scss" scoped>
.layout {
display: flex;
background: #f5f7fa;
.content-box {
flex: 1;
height: calc(100vh - 116px);
padding: 20px;
box-sizing: border-box;
-webkit-transition: left 0.3s ease-in-out;
transition: left 0.3s ease-in-out;
overflow: auto;
}
3 months ago
.sidebar:not(.show) {
margin-left: -200px;
}
3 months ago
}
</style>