feat: 修改着陆页
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
/** @format */
|
||||
|
||||
import { message } from "antd";
|
||||
import { useEffect } from "react";
|
||||
import {
|
||||
Location,
|
||||
@@ -10,7 +9,6 @@ import {
|
||||
useNavigate,
|
||||
useRoutes,
|
||||
} from "react-router-dom";
|
||||
import { getStorageFromKey } from "@/utils/localStorage/config.ts";
|
||||
|
||||
/**
|
||||
* 递归查询对应的路由
|
||||
@@ -45,20 +43,20 @@ async function guard(location: Location, navigate: NavigateFunction, routes: Rou
|
||||
return false;
|
||||
}
|
||||
//如果需要权限验证
|
||||
if (
|
||||
routerDetail.path !== "/login" &&
|
||||
routerDetail.path !== "/register" &&
|
||||
routerDetail.path !== "/" &&
|
||||
routerDetail.path !== "/404" &&
|
||||
routerDetail.path !== "/forget"
|
||||
) {
|
||||
const token: string | null = getStorageFromKey("token");
|
||||
if (!token) {
|
||||
message.warning("请先登录!").then();
|
||||
navigate("/login");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// if (
|
||||
// routerDetail.path !== "/login" &&
|
||||
// routerDetail.path !== "/register" &&
|
||||
// routerDetail.path !== "/" &&
|
||||
// routerDetail.path !== "/404" &&
|
||||
// routerDetail.path !== "/forget"
|
||||
// ) {
|
||||
// const token: string | null = getStorageFromKey("token");
|
||||
// if (!token) {
|
||||
// message.warning("请先登录!").then();
|
||||
// navigate("/login");
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,16 +5,16 @@ import type { RouteObject } from "react-router-dom";
|
||||
import NoFound from "@/views/404/404";
|
||||
import Login from "./modules/login/index.ts";
|
||||
import Register from "./modules/register/index.ts";
|
||||
import home from "./modules/home/index.ts";
|
||||
import Main from "./modules/main/index.ts";
|
||||
import ComponentLoading from "@/components/ComponentLoading";
|
||||
import Loading from "./modules/loading";
|
||||
import Forget from "@/router/modules/forget";
|
||||
import Home from "@/router/modules/home";
|
||||
|
||||
const routes: RouteObject[] = [
|
||||
{
|
||||
path: "/",
|
||||
Component: (props) => ComponentLoading(home, props),
|
||||
Component: (props) => ComponentLoading(Home, props),
|
||||
},
|
||||
{
|
||||
path: "/register",
|
||||
@@ -36,6 +36,10 @@ const routes: RouteObject[] = [
|
||||
path: "/main",
|
||||
Component: (props) => ComponentLoading(Main, props),
|
||||
},
|
||||
{
|
||||
path: "/home",
|
||||
Component: (props) => ComponentLoading(Home, props),
|
||||
},
|
||||
{
|
||||
path: "/loading",
|
||||
Component: Loading,
|
||||
|
||||
Reference in New Issue
Block a user