feat: 修改着陆页

This commit is contained in:
landaiqing
2024-06-08 23:21:41 +08:00
parent 01b24d27b6
commit 479ad3cc63
167 changed files with 1468 additions and 5451 deletions

View File

@@ -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;
}

View File

@@ -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,