<template>
|
<a-layout class="layout" :class="[device]"
|
:style="{backgroundImage:$route.meta.title==='首页'?`url(${require('../../assets/page/index/background.svg')}) !important`:`url(${require('../../assets/page/background.svg')})!important`}">
|
|
<!--<a-drawer-->
|
<!--v-if="device === 'mobile'"-->
|
<!--:wrapClassName="'drawer-sider ' + navTheme"-->
|
<!--placement="left"-->
|
<!--@close="() => this.collapsed = false"-->
|
<!--:closable="false"-->
|
<!--:visible="collapsed"-->
|
<!--width="200px"-->
|
<!-->-->
|
<!--<side-menu-->
|
<!--mode="inline"-->
|
<!--v-if="device === 'mobile'"-->
|
<!--:menus="menus"-->
|
<!--@menuSelect="menuSelect"-->
|
<!--@updateMenuTitle="handleUpdateMenuTitle"-->
|
<!--:theme="navTheme"-->
|
<!--:collapsed="false"-->
|
<!--:collapsible="true"></side-menu>-->
|
<!--</a-drawer>-->
|
|
<side-menu
|
mode="inline"
|
:menus="menus"
|
@menuSelect="myMenuSelect"
|
@updateMenuTitle="handleUpdateMenuTitle"
|
:collapsed="true"
|
:collapsible="true"></side-menu>
|
|
|
<a-layout
|
:class="[layoutMode, `content-width-${contentWidth}`]">
|
<!--<global-header></global-header>-->
|
|
<!-- layout content -->
|
<a-layout-content :style="{ height: '100%' }">
|
<slot></slot>
|
</a-layout-content>
|
|
<!-- layout footer -->
|
<a-layout-footer style="padding: 0px;background-color: transparent">
|
<global-footer/>
|
</a-layout-footer>
|
</a-layout>
|
|
<!-- update-start---- author:os_chengtgen -- date:20190830 -- for:issues/463 -编译主题颜色已生效,但还一直转圈,显示主题 正在编译 ---- -->
|
<!--<setting-drawer></setting-drawer>-->
|
<!-- update-end---- author:os_chengtgen -- date:20190830 -- for:issues/463 -编译主题颜色已生效,但还一直转圈,显示主题 正在编译 ---- -->
|
</a-layout>
|
</template>
|
|
<script>
|
import SideMenu from '@/components/menu/SideMenu'
|
import GlobalHeader from '@/components/page/GlobalHeader'
|
import GlobalFooter from '@/components/page/GlobalFooter'
|
import { triggerWindowResizeEvent } from '@/utils/util'
|
import { mapActions, mapState } from 'vuex'
|
import { mixin, mixinDevice } from '@/utils/mixin.js'
|
// update-start---- author:os_chengtgen -- date:20190830 -- for:issues/463 -编译主题颜色已生效,但还一直转圈,显示主题 正在编译 ------
|
// import SettingDrawer from '@/components/setting/SettingDrawer'
|
// 注释这个因为在个人设置模块已经加载了SettingDrawer页面
|
// update-end ---- author:os_chengtgen -- date:20190830 -- for:issues/463 -编译主题颜色已生效,但还一直转圈,显示主题 正在编译 ------
|
|
export default {
|
name: 'GlobalLayout',
|
components: {
|
SideMenu,
|
GlobalHeader,
|
GlobalFooter
|
// update-start---- author:os_chengtgen -- date:20190830 -- for:issues/463 -编译主题颜色已生效,但还一直转圈,显示主题 正在编译 ------
|
// // SettingDrawer
|
// 注释这个因为在个人设置模块已经加载了SettingDrawer页面
|
// update-end ---- author:os_chengtgen -- date:20190830 -- for:issues/463 -编译主题颜色已生效,但还一直转圈,显示主题 正在编译 ------
|
|
},
|
mixins: [mixin, mixinDevice],
|
data() {
|
return {
|
collapsed: false,
|
activeMenu: {},
|
menus: []
|
}
|
},
|
computed: {
|
...mapState({
|
// 主路由
|
mainRouters: state => state.permission.addRouters,
|
// 后台菜单
|
permissionMenuList: state => state.user.permissionList
|
})
|
},
|
watch: {
|
sidebarOpened(val) {
|
this.collapsed = !val
|
}
|
},
|
created() {
|
//--update-begin----author:scott---date:20190320------for:根据后台菜单配置,判断是否路由菜单字段,动态选择是否生成路由(为了支持参数URL菜单)------
|
//this.menus = this.mainRouters.find((item) => item.path === '/').children;
|
this.menus = this.permissionMenuList
|
|
//--update-begin----author:liusq---date:20210223------for:关于测边菜单遮挡内容问题详细说明 #2255
|
this.collapsed = !this.sidebarOpened
|
//--update-begin----author:liusq---date:20210223------for:关于测边菜单遮挡内容问题详细说明 #2255
|
|
// 根据后台配置菜单,重新排序加载路由信息
|
//console.log('----加载菜单逻辑----')
|
//console.log(this.mainRouters)
|
//console.log(this.permissionMenuList)
|
//console.log('----navTheme------'+this.navTheme)
|
//--update-end----author:scott---date:20190320------for:根据后台菜单配置,判断是否路由菜单字段,动态选择是否生成路由(为了支持参数URL菜单)------
|
},
|
methods: {
|
...mapActions(['setSidebar']),
|
toggle() {
|
this.collapsed = !this.collapsed
|
this.setSidebar(!this.collapsed)
|
triggerWindowResizeEvent()
|
},
|
menuSelect() {
|
if (!this.isDesktop()) {
|
this.collapsed = false
|
}
|
},
|
//update-begin-author:taoyan date:20190430 for:动态路由title显示配置的菜单title而不是其对应路由的title
|
myMenuSelect(value) {
|
//此处触发动态路由被点击事件
|
this.findMenuBykey(this.menus, value.key)
|
this.$emit('dynamicRouterShow', value.key, this.activeMenu.meta.title)
|
},
|
findMenuBykey(menus, key) {
|
for (let i of menus) {
|
if (i.path == key) {
|
this.activeMenu = { ...i }
|
} else if (i.children && i.children.length > 0) {
|
this.findMenuBykey(i.children, key)
|
}
|
}
|
},
|
//update-end-author:taoyan date:20190430 for:动态路由title显示配置的菜单title而不是其对应路由的title
|
|
// update-begin-author:sunjianlei date:20210409 for: 修复动态功能测试菜单、带参数菜单标题错误、展开错误的问题
|
handleUpdateMenuTitle(value) {
|
this.findMenuBykey(this.menus, value.path)
|
this.activeMenu.meta.title = value.meta.title
|
this.$emit('dynamicRouterShow', value.path, this.activeMenu.meta.title)
|
}
|
// update-end-author:sunjianlei date:20210409 for: 修复动态功能测试菜单、带参数菜单标题错误、展开错误的问题
|
|
}
|
}
|
|
</script>
|
|
<style lang="less">
|
body {
|
&.colorWeak {
|
filter: invert(80%);
|
}
|
}
|
|
.layout {
|
min-height: 100vh !important;
|
overflow-x: hidden;
|
background-size: cover !important;
|
background-repeat: no-repeat !important;
|
|
&.mobile {
|
.ant-layout-content {
|
.content {
|
margin: 24px 0 0;
|
}
|
}
|
|
&.ant-layout-has-sider {
|
flex-direction: row;
|
}
|
|
.trigger {
|
font-size: 22px;
|
line-height: 42px;
|
padding: 0 18px;
|
cursor: pointer;
|
transition: color 300ms, background 300ms;
|
|
&:hover {
|
background: rgba(255, 255, 255, 0.3);
|
}
|
}
|
|
}
|
|
.sidemenu {
|
background-color: transparent;
|
}
|
|
}
|
|
// drawer-sider 自定义
|
.ant-drawer.drawer-sider {
|
.sider {
|
box-shadow: none;
|
}
|
|
&.dark {
|
.ant-drawer-content {
|
background-color: rgb(0, 21, 41);
|
}
|
}
|
&.light {
|
box-shadow: none;
|
.ant-drawer-content {
|
background-color: #fff;
|
}
|
}
|
|
.ant-drawer-body {
|
padding: 0
|
}
|
}
|
|
// 外置的样式控制
|
.user-dropdown-menu-wrapper.ant-dropdown-menu {
|
padding: 4px 0;
|
|
.ant-dropdown-menu-item {
|
width: 160px;
|
}
|
|
.ant-dropdown-menu-item > .anticon:first-child,
|
.ant-dropdown-menu-item > a > .anticon:first-child,
|
.ant-dropdown-menu-submenu-title > .anticon:first-child
|
.ant-dropdown-menu-submenu-title > a > .anticon:first-child {
|
min-width: 12px;
|
margin-right: 8px;
|
}
|
|
}
|
|
.content {
|
|
.table-operator {
|
margin-bottom: 18px;
|
|
button {
|
margin-right: 8px;
|
}
|
}
|
}
|
</style>
|