深圳或然科技官网
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.

88 lines
2.3 KiB

2 years ago
<template>
<div :class="['main', { channel: isHome, 'site-en': handleClass() }]">
<v-head ref="header"></v-head>
<div class="layout">
2 years ago
<transition name="move"
mode="out-in">
2 years ago
<router-view class="view"></router-view>
</transition>
<el-backtop target=".layout"></el-backtop>
<v-footer ref="footer"></v-footer>
</div>
</div>
</template>
<script>
import Util from '@/libs/util'
import Setting from '@/setting'
import vHead from '../header'
import vFooter from '../footer'
import { mapMutations } from 'vuex'
export default {
2 years ago
data () {
2 years ago
return {
enSite: [1, 4, 6] // 英文站点id
};
},
components: {
vHead,
vFooter
},
computed: {
2 years ago
isHome () {
2 years ago
return Util.isIndex()
},
},
2 years ago
mounted () {
2 years ago
this.$route.query.siteId && this.setSite(this.$route.query.siteId)
document.body.onclick = e => {
e.stopPropagation()
this.$refs.header.showSearch = false
}
2 years ago
// seo信息
this.$get(this.api.seoList, {
siteId: +this.$route.query.siteId || this.$store.state.content.site
}).then(({ data }) => {
if (data.length) {
document.querySelector('meta[name="keywords"]').setAttribute('content', data[0].keyword)
document.querySelector('meta[name="description"]').setAttribute('content', data[0].description)
document.querySelector('title').innerHTML = data[0].title
}
}).catch(err => { })
2 years ago
},
methods: {
...mapMutations('content', [
'setSite'
]),
2 years ago
handleClass () {
2 years ago
return this.enSite.includes(+this.$route.query.siteId || this.$store.state.content.site)
},
// 长时间未操作,自动退出登录
2 years ago
autoLogout () {
2 years ago
let lastTime = new Date().getTime();
document.onmousedown = () => {
lastTime = new Date().getTime();
};
setInterval(() => {
if (Util.local.get(Setting.tokenKey) && (new Date().getTime() - lastTime) > Setting.autoLogoutTime) {
Util.errorMsg("用户登录过期,请重新登录");
setTimeout(this.logout, 1500);
}
}, 1000);
}
}
};
</script>
<style lang="scss" scoped>
.main {
min-width: 1050px;
}
2 years ago
.main:not(.channel) {
2 years ago
min-height: calc(100% - 90px);
.layout {
padding-top: 90px;
}
2 years ago
}
</style>