重部署系统时部门storage存储优化以及error页面显示优化

This commit is contained in:
unknown 2024-02-01 09:50:00 +08:00
parent 8614d4ebaf
commit b0d0063fc1
3 changed files with 11 additions and 8 deletions

View File

@ -14,8 +14,8 @@ const GoLogin = () => {
window.location.href = "/login";
};
const GoError = () => {
window.location.href = "/error";
const GoError = (status: number) => {
window.location.href = "/error?status=" + status;
};
export class HttpClient {
@ -63,13 +63,13 @@ export class HttpClient {
GoLogin();
} else if (status === 404) {
// 跳转到404页面
GoError();
GoError(404);
} else if (status === 403) {
// 跳转到无权限页面
GoError();
GoError(403);
} else if (status === 500) {
// 跳转到500异常页面
GoError();
GoError(500);
}
return Promise.reject(error.response);
}

View File

@ -1,14 +1,17 @@
import { useState } from "react";
import { Button, Result } from "antd";
import { useNavigate } from "react-router-dom";
import { useNavigate, useLocation } from "react-router-dom";
import styles from "./index.module.scss";
const ErrorPage = () => {
const navigate = useNavigate();
const result = new URLSearchParams(useLocation().search);
const [status, setStatus] = useState(String(result.get("status") || "404"));
return (
<Result
status="404"
title="404"
title={status}
subTitle="您访问的页面不存在"
className={styles["main"]}
extra={

View File

@ -31,7 +31,7 @@ const loginUserSlice = createSlice({
stage.value.user = e.payload.user;
stage.value.departments = e.payload.departments;
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;
setDepName(e.payload.departments[0].name);
}