|
|
@@ -2,10 +2,11 @@ import { CollaspedType } from '@/types/LayoutType';
|
|
|
import { Outlet, useModel } from '@umijs/max';
|
|
|
import {Avatar, Layout, Popover} from 'antd';
|
|
|
import { Header } from 'antd/es/layout/layout';
|
|
|
-import React, {useState} from 'react';
|
|
|
+import React, { useEffect, useState } from 'react';
|
|
|
import SideMenu from './SideMenu';
|
|
|
import UserPopover from './UserPopContent';
|
|
|
import './styles/index.less';
|
|
|
+import { UserInfoType } from '@/types/UserType';
|
|
|
const { Sider, Content } = Layout;
|
|
|
|
|
|
const contentStyle: React.CSSProperties = {
|
|
|
@@ -29,7 +30,11 @@ const layoutStyle = {
|
|
|
|
|
|
const App: React.FC = () => {
|
|
|
const [menuWidth] = useState(CollaspedType.OPEN);
|
|
|
- const { userInfo } = useModel('global');
|
|
|
+ const [userInfo, setUserInfo] = useState<UserInfoType>({ expertName: '', expertId: ''});
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ setUserInfo(JSON.parse(localStorage.getItem('userInfo') || '{}'))
|
|
|
+ }, []);
|
|
|
return (
|
|
|
<Layout style={layoutStyle}>
|
|
|
<Sider theme="light" width={menuWidth} style={siderStyle}>
|
|
|
@@ -43,9 +48,9 @@ const App: React.FC = () => {
|
|
|
<Popover placement="bottom" content={<UserPopover />}>
|
|
|
<div className="header-user">
|
|
|
<Avatar style={{ backgroundColor: '#fde3cf', color: '#f56a00' }}>
|
|
|
- {userInfo.realName.charAt(0)}
|
|
|
+ {userInfo.expertName.charAt(0)}
|
|
|
</Avatar>
|
|
|
- <span className="header-user-name"> {userInfo.realName}</span>
|
|
|
+ <span className="header-user-name"> {userInfo.expertName}</span>
|
|
|
</div>
|
|
|
</Popover>
|
|
|
</Header>
|