fix(merge)
This commit is contained in:
parent
555b6abd32
commit
d36b600624
|
@ -32,6 +32,7 @@ const LayOut = (props: Store) => {
|
|||
const [collapsed, setCollapsed] = useState(false);
|
||||
const nav = useNavigate();
|
||||
const [muens, setMenus] = useState([])
|
||||
const [uName, setUname] = useState("")
|
||||
|
||||
const {
|
||||
token: { colorBgContainer, borderRadiusLG },
|
||||
|
@ -56,15 +57,17 @@ const LayOut = (props: Store) => {
|
|||
];
|
||||
const [stateOpenKeys, setStateOpenKeys] = useState(['2', '23']);
|
||||
useEffect(() => {
|
||||
const uData = window.localStorage.getItem("user") ?? '';
|
||||
setUname(JSON.parse(uData).user.user_name)
|
||||
usrStore.getMenu().then((res) => {
|
||||
const men: any = [];
|
||||
res.forEach(ele => {
|
||||
items.forEach((v: any) => {
|
||||
if (ele.router_path === v.key) {
|
||||
if (ele.children.length > 0) {
|
||||
if (ele.children?.length > 0) {
|
||||
const childs: any = []
|
||||
ele.children.forEach(eles => {
|
||||
v.children.forEach(vs => {
|
||||
ele.children?.forEach(eles => {
|
||||
v.children?.forEach(vs => {
|
||||
if (eles.router_path === vs.key) {
|
||||
childs.push(vs)
|
||||
}
|
||||
|
@ -97,6 +100,7 @@ const LayOut = (props: Store) => {
|
|||
setStateOpenKeys(openKeys);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Layout>
|
||||
<Header style={headStyle}>
|
||||
|
@ -111,7 +115,10 @@ const LayOut = (props: Store) => {
|
|||
nav(e.key)
|
||||
}
|
||||
}}>
|
||||
<Avatar icon={<UserOutlined />} />
|
||||
<div>
|
||||
<span style={{ color: "#fff" }}>欢迎回来 {uName}</span>
|
||||
<Avatar icon={<UserOutlined />} />
|
||||
</div>
|
||||
</Dropdown>
|
||||
</Header>
|
||||
<Layout>
|
||||
|
|
|
@ -4,6 +4,7 @@ import BaseStore from "./baseStore";
|
|||
import { UserDataType, UserInfos } from "@/model/userModel";
|
||||
import { message } from "antd";
|
||||
import { UserConfig } from "@/service/user_config";
|
||||
import { json } from "stream/consumers";
|
||||
|
||||
class UserStore extends BaseStore<UserDataType> {
|
||||
_userinfo: UserInfos = {}; // 用户信息
|
||||
|
@ -51,6 +52,7 @@ class UserStore extends BaseStore<UserDataType> {
|
|||
message.error(data.msg)
|
||||
return false
|
||||
}
|
||||
window.localStorage.setItem("user", JSON.stringify(data.data));
|
||||
window.localStorage.setItem("token", data.data.token ?? "");
|
||||
this.getMenu()
|
||||
return true
|
||||
|
|
Loading…
Reference in New Issue