diff --git a/packages/app/src/components/pages/TopMenuLayout/index.tsx b/packages/app/src/components/pages/TopMenuLayout/index.tsx index 1747b62e7..3b1397968 100644 --- a/packages/app/src/components/pages/TopMenuLayout/index.tsx +++ b/packages/app/src/components/pages/TopMenuLayout/index.tsx @@ -1,10 +1,26 @@ import React from 'react'; -import { Layout, Menu } from 'antd'; -import { Link } from 'umi'; +import { Layout, Menu, Dropdown, Avatar } from 'antd'; import './style.less'; +import { history, Link, request, useModel } from 'umi'; +import { UserOutlined } from '@ant-design/icons'; + +const overlay = ( + + 个人资料 + + { + await request('/users:logout'); + localStorage.removeItem('NOCOBASE_TOKEN'); + (window as any).routesReload(); + history.push('/login');; + // window.location.href = '/login'; + }}>退出登录 + +); export function TopMenuLayout(props: any) { const { menu = [] } = props.page; + const { initialState = {}, loading, error, refresh, setInitialState } = useModel('@@initialState'); return ( @@ -16,6 +32,13 @@ export function TopMenuLayout(props: any) { ))} +
+ + e.preventDefault()}> + } style={{marginRight: 5}}/> {initialState.currentUser.nickname} + + +
{props.children}