diff --git a/src/router/index.tsx b/src/router/index.tsx index fb5070371d15c71eef19de8fce8bd25c2e3109ce..4f9ee4097b8bf8f68152262a8e331b8ce5edbd9f 100644 --- a/src/router/index.tsx +++ b/src/router/index.tsx @@ -5,30 +5,35 @@ import ManagementMain from "@/pages/Management/Main"; import PendingReviewList from "@/pages/Management/PendingReviewList"; import Root from "./root"; -const router = createBrowserRouter([ - { - path: "/approval", - element: , - children: [ - { - path: "/approval/apply", +const router = createBrowserRouter( + [ + { + path: "/", + element: , + children: [ + { + path: "/apply", - element: , - }, - { - path: "/approval/apply-record", - element: , - }, - { - path: "/approval/management", - element: , - }, - { - path: "/approval/management/:thingId", - element: , - }, - ], - }, -]); + element: , + }, + { + path: "/apply-record", + element: , + }, + { + path: "/management", + element: , + }, + { + path: "/management/:thingId", + element: , + }, + ], + }, + ], + { + basename: "/approval", + } +); export default router; diff --git a/src/router/root.tsx b/src/router/root.tsx index 7ed1f36e772cbfbbd396b0b394a8a2dfce1c7812..ed10bbc002b8e877b63b3bd4656b7666a5014916 100644 --- a/src/router/root.tsx +++ b/src/router/root.tsx @@ -2,7 +2,7 @@ import service from "@/service"; import useUserStore from "@/store/useUserStore"; import autofit from "autofit.js"; import { useEffect } from "react"; -import { Navigate, Outlet } from "react-router-dom"; +import { Navigate, Outlet, useLocation } from "react-router-dom"; const Root = () => { autofit.init({ @@ -12,6 +12,7 @@ const Root = () => { resize: true, }); const { updateAdminInfo, updateUserInfo } = useUserStore(); + const location = useLocation(); const adminToken = localStorage.getItem("admin_token"); const userToken = localStorage.getItem("user_token"); @@ -36,9 +37,7 @@ const Root = () => { return ( <> - {location.pathname === "/approval" && ( - - )} + {location.pathname === "/" && } ); diff --git a/vite.config.ts b/vite.config.ts index f38f8a4d154ae5a96661bb37de31c993cc6572b6..70ad1eac1d6ae938b0056986a0f069a8b335aa98 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -23,9 +23,9 @@ export default defineConfig({ // target: "http://172.23.0.46:21610", // target: "http://192.168.31.172:21610", // target: "http://192.168.31.172:33011", - // target: "http://171.217.92.33:33011", + target: "http://171.217.92.33:33011", // target: "http://192.168.2.21:21601/approval", // 测试服务 - target: "http://172.23.0.140:33011", // 唐 + // target: "http://172.23.0.140:33011", // 唐 changeOrigin: true, rewrite: (path) => path.replace(/^\/apis/, ""), },