lg_frontend/layouts/manager.vue

188 lines
4.2 KiB
Vue
Raw Normal View History

2024-02-18 11:15:17 +00:00
<template>
2024-06-26 16:52:06 +00:00
<a-locale-provider :locale="zh_CN">
<a-layout id="components-layout-demo-fixed-sider">
<a-layout-sider :trigger="null" v-model="collapsed" collapsible>
<div class="logo">
欢迎
</div>
<a-menu theme="dark" mode="inline" v-model="selectedKeys">
<a-menu-item key="1" v-for="item in menus" :key="item.key">
<a-icon :type="item.icon"/>
<span class="nav-text">{{ item.title }}</span>
</a-menu-item>
</a-menu>
</a-layout-sider>
<a-layout>
<a-layout-header
style="background: #fff; padding: 0"
ref="header"
:title="pageTitle"
:breadcrumb="{ props: { routes } }"
>
<div class="header-con">
2024-02-18 11:15:17 +00:00
2024-06-26 16:52:06 +00:00
<a-icon
class="trigger"
:type="collapsed ? 'menu-unfold' : 'menu-fold'"
@click="() => (collapsed = !collapsed)"
/>
<a-menu class="cus-menu">
<a-sub-menu>
2024-06-24 16:23:39 +00:00
<span slot="title" class="submenu-title-wrapper">
<a-icon type="setting"/>
操作
</span>
2024-06-26 16:52:06 +00:00
<a-menu-item key="setting:2">修改密码</a-menu-item>
<a-menu-item key="setting:1">退出</a-menu-item>
</a-sub-menu>
</a-menu>
2024-06-24 16:23:39 +00:00
2024-06-26 16:52:06 +00:00
</div>
2024-02-18 11:15:17 +00:00
2024-06-26 16:52:06 +00:00
</a-layout-header>
<a-layout-content :style="contentStyle">
<div :style="containerStyle">
<nuxt/>
</div>
</a-layout-content>
<!-- <a-layout-footer :style="{ textAlign: 'center' }" ref="footer">
Ant Design ©2018 Created by Ant UED
</a-layout-footer>-->
</a-layout>
2024-02-18 11:15:17 +00:00
</a-layout>
2024-06-26 16:52:06 +00:00
</a-locale-provider>
2024-02-18 11:15:17 +00:00
</template>
<script>
2024-06-26 16:52:06 +00:00
import zh_CN from 'ant-design-vue/lib/locale-provider/zh_CN';
import 'moment/locale/zh-cn';
2024-02-18 11:15:17 +00:00
export default {
name: "manager",
2024-06-24 16:23:39 +00:00
data() {
2024-02-18 11:15:17 +00:00
return {
2024-06-26 16:52:06 +00:00
zh_CN,
2024-02-18 11:15:17 +00:00
collapsed: false,
headerHeight: 0,
footerHeight: 0,
routes: [
{
path: 'index',
breadcrumbName: 'First-level Menu',
},
],
2024-06-24 16:23:39 +00:00
pageTitle: '123',
menus: [
{
link: '/manager/user',
title: '用户管理',
icon: 'user',
key: 'manager-user'
},
{
link: '/manager/role',
title: '角色管理',
2024-06-26 00:19:02 +00:00
icon: 'branches',
2024-06-24 16:23:39 +00:00
key: 'manager-role'
2024-06-26 00:19:02 +00:00
},
{
link: '/manager/menu',
title: '菜单管理',
icon: 'link',
key: 'manager-menu'
2024-06-26 16:52:06 +00:00
},
{
link: '/manager/device',
title: '设备管理',
icon: 'video-camera',
key: 'manager-device'
2024-06-24 16:23:39 +00:00
}
],
selectedKeys: []
}
},
watch: {
'$route': {
immediate: true,
2024-06-26 16:52:06 +00:00
handler(to) {
2024-06-24 16:23:39 +00:00
this.selectedKeys = [to.name]
}
2024-06-26 00:19:02 +00:00
},
2024-06-26 16:52:06 +00:00
selectedKeys([key]) {
this.$router.push({name: key})
2024-02-18 11:15:17 +00:00
}
},
computed: {
2024-06-24 16:23:39 +00:00
contentStyle() {
2024-02-18 11:15:17 +00:00
return {
margin: '24px 16px 24px',
overflow: 'inherit',
height: `calc(100vh - ${this.headerHeight + this.footerHeight + 48}px)`,
}
},
2024-06-24 16:23:39 +00:00
containerStyle() {
2024-02-18 11:15:17 +00:00
return {
padding: '24px',
background: '#fff',
textAlign: 'center',
height: `100%`,
overflow: 'auto',
}
}
},
2024-06-24 16:23:39 +00:00
mounted() {
this.$nextTick(() => {
2024-02-18 11:15:17 +00:00
if (this.$refs.header) {
this.headerHeight = this.$refs.header.$el.offsetHeight
// this.footerHeight = this.$refs.footer.$el.offsetHeight
}
})
}
}
</script>
<style scoped lang="less">
2024-06-24 16:23:39 +00:00
.cus-menu {
/deep/ .ant-menu-submenu-arrow {
display: none;
}
}
2024-06-26 16:52:06 +00:00
2024-02-18 11:15:17 +00:00
#components-layout-demo-fixed-sider {
.header-con {
2024-06-24 16:23:39 +00:00
width: 100%;
2024-02-18 11:15:17 +00:00
display: flex;
2024-06-24 16:23:39 +00:00
justify-content: space-between;
2024-02-18 11:15:17 +00:00
align-items: center;
}
2024-06-24 16:23:39 +00:00
2024-02-18 11:15:17 +00:00
.trigger:hover {
color: #1890ff;
}
2024-06-24 16:23:39 +00:00
2024-02-18 11:15:17 +00:00
.trigger {
font-size: 18px;
line-height: 64px;
padding: 0 24px;
cursor: pointer;
transition: color 0.3s;
}
2024-06-24 16:23:39 +00:00
2024-02-18 11:15:17 +00:00
.logo {
width: 80%;
padding: 0 10px;
height: 31px;
background: rgba(255, 255, 255, 0.2);
margin: 16px auto 16px;
line-height: 31px;
text-align: center;
color: #fff;
font-size: 18px;
overflow: inherit;
//
}
}
</style>