Commit ce4130ad authored by xhx's avatar xhx

layout

parent 88e907e3
...@@ -44,7 +44,7 @@ export default class UserService { ...@@ -44,7 +44,7 @@ export default class UserService {
*/ */
logout() { logout() {
return baseAxios({ return baseAxios({
url: '/login', url: '/logout',
method: 'get', method: 'get',
}) })
} }
......
<template> <template>
<div> <div>
<a-layout id="components-layout-demo-fixed-sider"> <a-layout id="components-layout-demo-fixed-sider">
<a-layout-header> sdlkfj </a-layout-header> <a-layout-header>
<div class="flex justify-between items-center h-full">
<div class="text-center text-lg my-3">中小企业协会综合服务平台</div>
<div>
<!-- <a-popover> -->
<!-- <template slot="content">
<p>退出账户</p>
</template> -->
<div class="flex justify-between items-center">
<img class="w-5 h-7 mr-3" src="@/assets/images/avatar.png" alt="头像">
{{ phone }}
<span class="inline-block ml-3 cursor-pointer" @click="logout">退出</span>
</div>
<!-- </a-popover> -->
</div>
</div>
</a-layout-header>
<a-layout style="min-height: 100vh"> <a-layout style="min-height: 100vh">
<a-layout-sider width="256" style="background: white"> <a-layout-sider width="256" style="background: white">
<div class="text-center text-lg my-3">中小企业协会综合服务平台</div>
<a-menu <a-menu
style="width: 256px" style="width: 256px"
:open-keys.sync="openKeys" :open-keys.sync="openKeys"
...@@ -60,11 +75,14 @@ import { iMenuItem, iMenuList } from "./types"; ...@@ -60,11 +75,14 @@ import { iMenuItem, iMenuList } from "./types";
import { Fragment } from "vue-fragment"; import { Fragment } from "vue-fragment";
import { getUserMsg } from "@/utils/userMsg/userMsg"; import { getUserMsg } from "@/utils/userMsg/userMsg";
import { getOldRoleFromUserMsg } from "@/utils/user"; import { getOldRoleFromUserMsg } from "@/utils/user";
import UserService from '@/service/UserManagementService'
Vue.use(Menu); Vue.use(Menu);
Vue.use(Icon); Vue.use(Icon);
Vue.use(Layout); Vue.use(Layout);
const userService = new UserService()
export default Vue.extend({ export default Vue.extend({
components: { components: {
Fragment, Fragment,
...@@ -94,6 +112,9 @@ export default Vue.extend({ ...@@ -94,6 +112,9 @@ export default Vue.extend({
selectedKeys(): Array<String> { selectedKeys(): Array<String> {
return [(this.$route.meta as { selectedName: string }).selectedName]; return [(this.$route.meta as { selectedName: string }).selectedName];
}, },
phone() {
return JSON.parse(window.localStorage.getItem('USER_MSG') as any).phone
}
}, },
methods: { methods: {
getMenuChildren(menu: iMenuItem) { getMenuChildren(menu: iMenuItem) {
...@@ -122,6 +143,14 @@ export default Vue.extend({ ...@@ -122,6 +143,14 @@ export default Vue.extend({
hasChildren(menu: iMenuItem) { hasChildren(menu: iMenuItem) {
return menu.children && menu.children.length !== 0; return menu.children && menu.children.length !== 0;
}, },
logout() {
userService.logout().then(res => {
if (res.code === 200) {
window.localStorage.clear()
this.$router.push('/login')
}
})
}
}, },
}); });
</script> </script>
...@@ -130,4 +159,7 @@ export default Vue.extend({ ...@@ -130,4 +159,7 @@ export default Vue.extend({
/deep/a { /deep/a {
color: #1890ff; color: #1890ff;
} }
/deep/ .ant-layout-header {
background: #fff;
}
</style> </style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment