mirror of
https://github.com/PlayEdu/frontend.git
synced 2025-06-29 09:44:39 +08:00
登录学员后检测部门逻辑优化
This commit is contained in:
parent
09707c1fff
commit
244bf68c65
@ -73,8 +73,7 @@ export const Header: React.FC = () => {
|
||||
cancelText: "取消",
|
||||
onOk() {
|
||||
dispatch(logoutAction());
|
||||
clearToken();
|
||||
navigate("/login");
|
||||
navigate("/login", { replace: true });
|
||||
},
|
||||
onCancel() {
|
||||
console.log("Cancel");
|
||||
|
@ -43,7 +43,6 @@
|
||||
box-sizing: border-box;
|
||||
padding-top: 30px;
|
||||
margin-top: 60px;
|
||||
animation: scaleBig 0.3s;
|
||||
.video-title {
|
||||
width: 100%;
|
||||
height: 36px;
|
||||
|
@ -15,6 +15,8 @@ interface Props {
|
||||
}
|
||||
|
||||
export const InitPage = (props: Props) => {
|
||||
const pathname = useLocation().pathname;
|
||||
const params = useParams();
|
||||
const dispatch = useDispatch();
|
||||
if (props.loginData) {
|
||||
dispatch(loginAction(props.loginData));
|
||||
@ -43,9 +45,6 @@ export const InitPage = (props: Props) => {
|
||||
dispatch(saveConfigAction(config));
|
||||
}
|
||||
|
||||
const pathname = useLocation().pathname;
|
||||
const params = useParams();
|
||||
|
||||
return (
|
||||
<>
|
||||
<div>
|
||||
|
@ -1,5 +1,11 @@
|
||||
import { createSlice } from "@reduxjs/toolkit";
|
||||
import { getDepKey } from "../../utils/index";
|
||||
import {
|
||||
getDepKey,
|
||||
clearDepKey,
|
||||
clearDepName,
|
||||
setDepName,
|
||||
clearToken,
|
||||
} from "../../utils/index";
|
||||
|
||||
type UserStoreInterface = {
|
||||
user: null;
|
||||
@ -27,6 +33,7 @@ const loginUserSlice = createSlice({
|
||||
stage.value.isLogin = true;
|
||||
if (e.payload.departments.length > 0 && stage.value.currentDepId === 0) {
|
||||
stage.value.currentDepId = e.payload.departments[0].id;
|
||||
setDepName(e.payload.departments[0].name);
|
||||
}
|
||||
},
|
||||
logoutAction(stage) {
|
||||
@ -34,6 +41,9 @@ const loginUserSlice = createSlice({
|
||||
stage.value.departments = [];
|
||||
stage.value.isLogin = false;
|
||||
stage.value.currentDepId = 0;
|
||||
clearToken();
|
||||
clearDepKey();
|
||||
clearDepName();
|
||||
},
|
||||
saveCurrentDepId(stage, e) {
|
||||
stage.value.currentDepId = e.payload;
|
||||
|
Loading…
x
Reference in New Issue
Block a user