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