左侧菜单和右上角管理员模块优化

This commit is contained in:
禺狨
2023-03-09 16:22:14 +08:00
parent 67fa3093ab
commit f14a81138e
10 changed files with 56 additions and 65 deletions

View File

@@ -1,10 +1,14 @@
import React from "react";
import styles from "./index.module.less";
import { Layout, Button, Dropdown, MenuProps } from "antd";
import { Layout, Button, Dropdown, MenuProps, Image } from "antd";
import { useSelector } from "../../store/hooks";
import { useDispatch } from "react-redux";
import { useNavigate } from "react-router-dom";
import { LoginOutActionCreator } from "../../store/user/userActions";
import avatar from "../../assets/images/commen/avatar.png";
import edit from "../../assets/images/commen/edit.png";
import logout from "../../assets/images/commen/logout.png";
import { PoweroffOutlined, UnlockOutlined } from "@ant-design/icons";
export const Header: React.FC = () => {
const dispatch = useDispatch();
@@ -23,10 +27,12 @@ export const Header: React.FC = () => {
{
label: "修改密码",
key: "change_password",
icon: <UnlockOutlined style={{ color: "#ff4d4f" }} />,
},
{
label: "退出登录",
key: "login_out",
icon: <PoweroffOutlined style={{ color: "#ff4d4f" }} />,
},
];
return (
@@ -35,8 +41,14 @@ export const Header: React.FC = () => {
<div></div>
<Button.Group className={styles["button-group"]}>
<Dropdown menu={{ items, onClick }} placement="bottomRight">
<Button type="link" danger>
{user.name}
<Button type="link">
<Image
preview={false}
width={30}
height={30}
src={avatar}
></Image>
<span className="ml-8 c-default">{user.name}</span>
</Button>
</Dropdown>
</Button.Group>

View File

@@ -21,19 +21,13 @@ function getItem(label: any, key: any, icon: any, children: any, type: any) {
}
const items = [
getItem("首页概览", "/", <SettingOutlined />, null, null),
getItem(
"课程内容",
"8",
<AppstoreOutlined />,
[getItem("课程", "/course", null, null, null)],
null
),
getItem("分类管理", "/resource-category", <MailOutlined />, null, null),
getItem("课程管理", "/course", <AppstoreOutlined />, null, null),
getItem(
"资源管理",
"3",
<MailOutlined />,
[
getItem("资源分类", "/resource-category", null, null, null),
getItem("视频", "/videos", null, null, null),
getItem("图片", "/images", null, null, null),
],
@@ -43,21 +37,20 @@ const items = [
"学员管理",
"4",
<AppstoreOutlined />,
[getItem("学员", "/member", null, null, null)],
null
),
getItem(
"部门管理",
"7",
<AppstoreOutlined />,
[getItem("部门", "/department", null, null, null)],
[
getItem("学员", "/member", null, null, null),
getItem("部门", "/department", null, null, null),
],
null
),
getItem(
"系统设置",
"6",
<SettingOutlined />,
[getItem("管理人员", "/system/administrator", null, null, null)],
[
getItem("管理人员", "/system/administrator", null, null, null),
getItem("角色配置", "/system/adminroles", null, null, null),
],
null
),
];
@@ -85,7 +78,6 @@ export const LeftMenu: React.FC = () => {
style={{
width: 200,
background: "#ffffff",
}}
openKeys={openKeys}
onOpenChange={onOpenChange}