mirror of
https://github.com/PlayEdu/frontend.git
synced 2025-06-11 22:27:48 +08:00
首页头部初步
This commit is contained in:
parent
a3da93be82
commit
872f5baca8
@ -1,8 +1,8 @@
|
||||
@font-face {
|
||||
font-family: "iconfont"; /* Project id 3943555 */
|
||||
src: url('iconfont.woff2?t=1679275935231') format('woff2'),
|
||||
url('iconfont.woff?t=1679275935231') format('woff'),
|
||||
url('iconfont.ttf?t=1679275935231') format('truetype');
|
||||
src: url('iconfont.woff2?t=1679564530649') format('woff2'),
|
||||
url('iconfont.woff?t=1679564530649') format('woff'),
|
||||
url('iconfont.ttf?t=1679564530649') format('truetype');
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
@ -13,6 +13,18 @@
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.icon-icon-tips:before {
|
||||
content: "\e74a";
|
||||
}
|
||||
|
||||
.icon-icon-fold:before {
|
||||
content: "\e749";
|
||||
}
|
||||
|
||||
.icon-icon-12:before {
|
||||
content: "\e748";
|
||||
}
|
||||
|
||||
.icon-waterprint:before {
|
||||
content: "\e747";
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
27
src/compenents/header/index.module.scss
Normal file
27
src/compenents/header/index.module.scss
Normal file
@ -0,0 +1,27 @@
|
||||
.app-header {
|
||||
width: 100%;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 60px;
|
||||
background: #ffffff;
|
||||
box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.04);
|
||||
.main-header {
|
||||
width: 1200px;
|
||||
height: 60px;
|
||||
line-height: 60px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin: 0 auto;
|
||||
.App-logo {
|
||||
width: auto;
|
||||
height: 40px;
|
||||
img {
|
||||
width: auto;
|
||||
height: 40px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
79
src/compenents/header/index.tsx
Normal file
79
src/compenents/header/index.tsx
Normal file
@ -0,0 +1,79 @@
|
||||
import React from "react";
|
||||
import styles from "./index.module.scss";
|
||||
import { Button, Dropdown, MenuProps } from "antd";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { Link, useNavigate } from "react-router-dom";
|
||||
import { logoutAction } from "../../store/user/loginUserSlice";
|
||||
|
||||
export const Header: React.FC = () => {
|
||||
const dispatch = useDispatch();
|
||||
const navigate = useNavigate();
|
||||
const user = useSelector((state: any) => state.loginUser.value.user);
|
||||
const config = useSelector((state: any) => state.systemConfig.value);
|
||||
|
||||
const onClick: MenuProps["onClick"] = ({ key }) => {
|
||||
if (key === "login_out") {
|
||||
dispatch(logoutAction());
|
||||
navigate("/login");
|
||||
} else if (key === "change_password") {
|
||||
navigate("/change-password");
|
||||
}
|
||||
};
|
||||
|
||||
const items: MenuProps["items"] = [
|
||||
{
|
||||
label: "个人中心",
|
||||
key: "user_center",
|
||||
icon: (
|
||||
<i className="iconfont icon-icon-12 c-red" style={{ fontSize: 16 }} />
|
||||
),
|
||||
},
|
||||
{
|
||||
label: "修改密码",
|
||||
key: "change_password",
|
||||
icon: (
|
||||
<i
|
||||
className="iconfont icon-icon-password c-red"
|
||||
style={{ fontSize: 16 }}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
label: "退出登录",
|
||||
key: "login_out",
|
||||
icon: (
|
||||
<i
|
||||
className="iconfont icon-a-icon-logout c-red"
|
||||
style={{ fontSize: 16 }}
|
||||
/>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<div className={styles["app-header"]}>
|
||||
<div className={styles["main-header"]}>
|
||||
<div className="d-flex">
|
||||
<Link to="/" className={styles["App-logo"]}>
|
||||
<img src={config.systemLogo} />
|
||||
</Link>
|
||||
</div>
|
||||
<div className="d-flex">
|
||||
<Button.Group className={styles["button-group"]}>
|
||||
<Dropdown menu={{ items, onClick }} placement="bottomRight">
|
||||
<div className="d-flex">
|
||||
{user.name && (
|
||||
<img
|
||||
style={{ width: 36, height: 36, borderRadius: "50%" }}
|
||||
src={user.avatar}
|
||||
/>
|
||||
)}
|
||||
<span className="ml-8 c-admin">{user.name}</span>
|
||||
</div>
|
||||
</Dropdown>
|
||||
</Button.Group>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
@ -1,2 +1,3 @@
|
||||
export * from "./footer";
|
||||
export * from "./no-header";
|
||||
export * from "./no-header";
|
||||
export * from "./header";
|
@ -30,7 +30,7 @@ a:hover {
|
||||
body {
|
||||
margin: 0;
|
||||
display: flex;
|
||||
place-items: center;
|
||||
// place-items: center;
|
||||
min-width: 320px;
|
||||
min-height: 100vh;
|
||||
}
|
||||
@ -252,3 +252,14 @@ button:focus-visible {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.c-admin {
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
color: rgba(0, 0, 0, 0.88);
|
||||
line-height: 24px;
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
|
3
src/pages/init/index.module.scss
Normal file
3
src/pages/init/index.module.scss
Normal file
@ -0,0 +1,3 @@
|
||||
.cont-top{
|
||||
width: 100%;
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
import { useDispatch } from "react-redux";
|
||||
import { Outlet } from "react-router-dom";
|
||||
import styles from "./index.module.scss";
|
||||
import { saveConfigAction } from "../../store/system/systemConfigSlice";
|
||||
import { Header } from "../../compenents";
|
||||
|
||||
interface Props {
|
||||
config: Map<string, string>;
|
||||
@ -12,7 +14,10 @@ export const InitPage = (props: Props) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Outlet />
|
||||
<div>
|
||||
<Header></Header>
|
||||
<Outlet />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
@ -19,7 +19,6 @@ const loginUserSlice = createSlice({
|
||||
},
|
||||
reducers: {
|
||||
loginAction(stage, e) {
|
||||
console.log(e);
|
||||
stage.value.user = e.payload.user;
|
||||
stage.value.departments = e.payload.departments;
|
||||
stage.value.isLogin = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user