Former-commit-id: 8a9ca84d14eb84dc4e1b9a4e133bd6cfffa3ca5c [formerly 8a9ca84d14eb84dc4e1b9a4e133bd6cfffa3ca5c [formerly 8a9ca84d14eb84dc4e1b9a4e133bd6cfffa3ca5c [formerly 8a9ca84d14eb84dc4e1b9a4e133bd6cfffa3ca5c [formerly 9621536a7a80c42195b37951007c99e03aa3cadd [formerly 17e387559a5a115b8d5dc78736e44b18e3e75e92]]]]] Former-commit-id: abc8ed86cb533c85faa94a262af8c1b3f3e30459 Former-commit-id: 21220fadf5b5d8a32286ccea7e95f784d04dc687 Former-commit-id: ec4dbab4a4d7b177746f58da3a22386da5baa8a8 [formerly 04bb40e0dbba45d6c74c7778c15bf55240f7fc13] Former-commit-id: e2c15ec309988b9c73d5044d8caeb3a41290deec Former-commit-id: 089eb39c9ca4aa27c65f36db3193bc0ec3a3b017 Former-commit-id: b93dcb094f0af0ad26f326da4d9b875ad236065d Former-commit-id: ab9c290388603587cab3bf0dd2712c47a98e7d1f Former-commit-id: 3fdd316ac6748fcd100ea4b62ab56681f525f5e2
117 lines
3.6 KiB
Vue
117 lines
3.6 KiB
Vue
<template>
|
|
<div
|
|
class="d2-layout-main-group"
|
|
:style="styleLayoutMainGroup"
|
|
:class="{grayMode: isGrayMode}">
|
|
<!-- 半透明遮罩 -->
|
|
<div class="d2-layout-main-mask"></div>
|
|
<!-- 主体内容 -->
|
|
<el-container class="d2-layout-main-content">
|
|
<!-- 顶栏 -->
|
|
<el-header class="d2-theme-header">
|
|
<div class="logo-group" :style="{width: collapse ? asideWidthCollapse : asideWidth}">
|
|
<img v-if="collapse" :src="`${$assetsPublicPath}static/image/theme/${themeActiveSetting.name}/logo/icon-only.png`">
|
|
<img v-else :src="`${$assetsPublicPath}static/image/theme/${themeActiveSetting.name}/logo/all.png`">
|
|
</div>
|
|
<div class="toggle-aside-btn" @click="collapse = !collapse">
|
|
<d2-icon name="bars"/>
|
|
</div>
|
|
<d2-layout-main-menu-header/>
|
|
<!-- 顶栏右侧 -->
|
|
<div class="d2-header-right">
|
|
<d2-layout-main-header-github/>
|
|
<d2-layout-main-header-help/>
|
|
<d2-layout-main-header-full-screen/>
|
|
<d2-layout-main-header-theme/>
|
|
<d2-layout-main-header-user/>
|
|
</div>
|
|
</el-header>
|
|
<!-- 下面 主体 -->
|
|
<el-container class="d2-theme-container">
|
|
<!-- 主体 侧边栏 -->
|
|
<el-aside ref="aside" class="d2-theme-container-aside" :style="{width: collapse ? asideWidthCollapse : asideWidth}">
|
|
<d2-layout-main-menu-side :collapse="collapse"/>
|
|
</el-aside>
|
|
<!-- 主体 -->
|
|
<el-main class="d2-theme-container-main">
|
|
<div class="d2-theme-container-main-header">
|
|
<d2-multiple-page-control/>
|
|
</div>
|
|
<div class="d2-theme-container-main-body">
|
|
<transition name="fade-transverse">
|
|
<keep-alive>
|
|
<router-view v-if="alive"/>
|
|
</keep-alive>
|
|
</transition>
|
|
<transition name="fade-transverse">
|
|
<router-view v-if="!alive"/>
|
|
</transition>
|
|
</div>
|
|
</el-main>
|
|
</el-container>
|
|
</el-container>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { mapState, mapGetters, mapMutations } from 'vuex'
|
|
export default {
|
|
name: 'd2-layout-main',
|
|
components: {
|
|
'd2-layout-main-menu-side': () => import('./components/-menu-side'),
|
|
'd2-layout-main-menu-header': () => import('./components/-menu-header'),
|
|
'd2-layout-main-header-full-screen': () => import('./components/-full-screen'),
|
|
'd2-layout-main-header-theme': () => import('./components/-theme'),
|
|
'd2-layout-main-header-user': () => import('./components/-user'),
|
|
'd2-layout-main-header-help': () => import('./components/-help'),
|
|
'd2-layout-main-header-github': () => import('./components/-github')
|
|
},
|
|
data () {
|
|
return {
|
|
collapse: false,
|
|
// [侧边栏宽度] 正常状态
|
|
asideWidth: '200px',
|
|
// [侧边栏宽度] 折叠状态
|
|
asideWidthCollapse: '65px'
|
|
}
|
|
},
|
|
computed: {
|
|
...mapState({
|
|
isGrayMode: state => state.d2admin.isGrayMode
|
|
}),
|
|
...mapGetters([
|
|
'themeActiveSetting'
|
|
]),
|
|
styleLayoutMainGroup () {
|
|
return {
|
|
...this.themeActiveSetting.backgroundImage ? {
|
|
backgroundImage: `url('${this.$assetsPublicPath}${this.themeActiveSetting.backgroundImage}')`
|
|
} : {}
|
|
}
|
|
},
|
|
alive () {
|
|
if (this.$route.meta) {
|
|
if (this.$route.meta.alive) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
},
|
|
mounted () {
|
|
// 加载主题
|
|
this.d2adminThemeLoad()
|
|
},
|
|
methods: {
|
|
...mapMutations([
|
|
'd2adminThemeLoad'
|
|
])
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
// 注册主题
|
|
@import '~@/assets/style/theme/register.scss';
|
|
</style>
|