|
@ -1,6 +1,7 @@ |
|
|
<template> |
|
|
<template> |
|
|
<el-container class="layout-cont"> |
|
|
|
|
|
<el-container> |
|
|
|
|
|
|
|
|
<el-container class="layout-cont" > |
|
|
|
|
|
<el-container :class="[isSider?'openside':'hideside',isMobile ? 'mobile': '']"> |
|
|
|
|
|
<el-row :class="[isShadowBg?'shadowBg':'']" @click.native="changeShadow()"></el-row> |
|
|
<el-aside class="main-cont main-left"> |
|
|
<el-aside class="main-cont main-left"> |
|
|
<Aside class="aside" /> |
|
|
<Aside class="aside" /> |
|
|
</el-aside> |
|
|
</el-aside> |
|
@ -56,21 +57,42 @@ export default { |
|
|
name: 'Layout', |
|
|
name: 'Layout', |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
isCollapse: false |
|
|
|
|
|
|
|
|
isCollapse: false, |
|
|
|
|
|
isSider: true, |
|
|
|
|
|
isMobile: false, |
|
|
|
|
|
isShadowBg: false |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
components: { |
|
|
components: { |
|
|
Aside |
|
|
Aside |
|
|
}, |
|
|
}, |
|
|
|
|
|
created(){ |
|
|
|
|
|
let screenWidth = document.body.clientWidth |
|
|
|
|
|
if(screenWidth<1000){ |
|
|
|
|
|
this.isMobile = true |
|
|
|
|
|
this.isSider = false |
|
|
|
|
|
this.isCollapse = !this.isCollapse |
|
|
|
|
|
}else{ |
|
|
|
|
|
this.isMobile = false |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
...mapActions('user', ['LoginOut']), |
|
|
...mapActions('user', ['LoginOut']), |
|
|
totalCollapse() { |
|
|
totalCollapse() { |
|
|
this.isCollapse = !this.isCollapse |
|
|
this.isCollapse = !this.isCollapse |
|
|
|
|
|
this.isSider = !this.isCollapse |
|
|
|
|
|
this.isShadowBg = !this.isCollapse |
|
|
this.$bus.emit('totalCollapse') |
|
|
this.$bus.emit('totalCollapse') |
|
|
}, |
|
|
}, |
|
|
toPerson() { |
|
|
toPerson() { |
|
|
this.$router.push({ name: 'person' }) |
|
|
this.$router.push({ name: 'person' }) |
|
|
|
|
|
}, |
|
|
|
|
|
changeShadow(){ |
|
|
|
|
|
this.isShadowBg = !this.isShadowBg |
|
|
|
|
|
this.isSider = !!this.isCollapse |
|
|
|
|
|
this.totalCollapse() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
computed: { |
|
|
computed: { |
|
|
...mapGetters('user', ['userInfo']), |
|
|
...mapGetters('user', ['userInfo']), |
|
@ -80,6 +102,29 @@ export default { |
|
|
matched() { |
|
|
matched() { |
|
|
return this.$route.matched |
|
|
return this.$route.matched |
|
|
} |
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
mounted() { |
|
|
|
|
|
window.onresize = () => { |
|
|
|
|
|
return (() => { |
|
|
|
|
|
let screenWidth = document.body.clientWidth |
|
|
|
|
|
if(!this.screenWidth && this.isSider){ |
|
|
|
|
|
if(screenWidth < 1000){ |
|
|
|
|
|
this.isMobile = true |
|
|
|
|
|
this.isSider = false |
|
|
|
|
|
this.isCollapse = true |
|
|
|
|
|
this.$bus.emit('collapse',this.isCollapse) |
|
|
|
|
|
} |
|
|
|
|
|
}else { |
|
|
|
|
|
if(screenWidth < 1000){ |
|
|
|
|
|
this.isMobile = true |
|
|
|
|
|
this.isSider = false |
|
|
|
|
|
this.isCollapse = true |
|
|
|
|
|
} else { |
|
|
|
|
|
this.isMobile = false |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
})() |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
@ -152,7 +197,7 @@ $mainHight: 100vh; |
|
|
} |
|
|
} |
|
|
.aside { |
|
|
.aside { |
|
|
overflow: auto; |
|
|
overflow: auto; |
|
|
background: #fff; |
|
|
|
|
|
|
|
|
// background: #fff; |
|
|
&::-webkit-scrollbar { |
|
|
&::-webkit-scrollbar { |
|
|
display: none; |
|
|
display: none; |
|
|
} |
|
|
} |
|
|