mirror of
https://github.com/PlayEdu/frontend.git
synced 2025-06-28 23:32:53 +08:00
重部署系统时部门storage存储优化以及error页面显示优化
This commit is contained in:
parent
8614d4ebaf
commit
b0d0063fc1
@ -14,8 +14,8 @@ const GoLogin = () => {
|
|||||||
window.location.href = "/login";
|
window.location.href = "/login";
|
||||||
};
|
};
|
||||||
|
|
||||||
const GoError = () => {
|
const GoError = (status: number) => {
|
||||||
window.location.href = "/error";
|
window.location.href = "/error?status=" + status;
|
||||||
};
|
};
|
||||||
|
|
||||||
export class HttpClient {
|
export class HttpClient {
|
||||||
@ -63,13 +63,13 @@ export class HttpClient {
|
|||||||
GoLogin();
|
GoLogin();
|
||||||
} else if (status === 404) {
|
} else if (status === 404) {
|
||||||
// 跳转到404页面
|
// 跳转到404页面
|
||||||
GoError();
|
GoError(404);
|
||||||
} else if (status === 403) {
|
} else if (status === 403) {
|
||||||
// 跳转到无权限页面
|
// 跳转到无权限页面
|
||||||
GoError();
|
GoError(403);
|
||||||
} else if (status === 500) {
|
} else if (status === 500) {
|
||||||
// 跳转到500异常页面
|
// 跳转到500异常页面
|
||||||
GoError();
|
GoError(500);
|
||||||
}
|
}
|
||||||
return Promise.reject(error.response);
|
return Promise.reject(error.response);
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,17 @@
|
|||||||
|
import { useState } from "react";
|
||||||
import { Button, Result } from "antd";
|
import { Button, Result } from "antd";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate, useLocation } from "react-router-dom";
|
||||||
import styles from "./index.module.scss";
|
import styles from "./index.module.scss";
|
||||||
|
|
||||||
const ErrorPage = () => {
|
const ErrorPage = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const result = new URLSearchParams(useLocation().search);
|
||||||
|
const [status, setStatus] = useState(String(result.get("status") || "404"));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Result
|
<Result
|
||||||
status="404"
|
status="404"
|
||||||
title="404"
|
title={status}
|
||||||
subTitle="您访问的页面不存在"
|
subTitle="您访问的页面不存在"
|
||||||
className={styles["main"]}
|
className={styles["main"]}
|
||||||
extra={
|
extra={
|
||||||
|
@ -31,7 +31,7 @@ const loginUserSlice = createSlice({
|
|||||||
stage.value.user = e.payload.user;
|
stage.value.user = e.payload.user;
|
||||||
stage.value.departments = e.payload.departments;
|
stage.value.departments = e.payload.departments;
|
||||||
stage.value.isLogin = true;
|
stage.value.isLogin = true;
|
||||||
if (e.payload.departments.length > 0 && stage.value.currentDepId === 0) {
|
if (e.payload.departments.length > 0 && !getDepKey()) {
|
||||||
stage.value.currentDepId = e.payload.departments[0].id;
|
stage.value.currentDepId = e.payload.departments[0].id;
|
||||||
setDepName(e.payload.departments[0].name);
|
setDepName(e.payload.departments[0].name);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user