import { useLocation, useModel ,history} from "@umijs/max";
import PropTypes from "prop-types";
import { useEffect } from "react";
// @mui
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
import { Avatar, Box, Button, Drawer, Stack, Typography } from "@mui/material";
// mock
// hooks
import useResponsive from "@/hooks/useResponsive";
// components
import Logo from "@/components/logo";
import NavSection from "@/components/nav-section";
import { Scrollbars } from "react-custom-scrollbars";
import navConfig from "./config";
Nav.propTypes = {
openNav: PropTypes.bool,
onCloseNav: PropTypes.func,
};
export default function Nav({ openNav, onCloseNav }) {
const { pathname } = useLocation();
const isDesktop = useResponsive("up", "lg");
const {
initialState: { nav, currentUser },
setInitialState,
} = useModel("@@initialState");
const setnav = (fn) => {
const res = fn(nav);
setInitialState((s) => ({
...s,
nav: res,
}));
};
useEffect(() => {
if (openNav) {
onCloseNav();
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [pathname]);
const ifs = nav === 88;
const renderContent = (
{!ifs && (
精密测量虚拟仿真实训平台
)}
{
history.push("/work/usercenter")
}}
/>
{!ifs && (
{currentUser?.name}
角色:{currentUser?.typeName}
)}
);
return (
{isDesktop ? (
{renderContent}
) : (
{renderContent}
)}
);
}