添加账号修改,后台管理

This commit is contained in:
yoyuzh
2026-03-19 17:52:58 +08:00
parent c39fde6b19
commit ff8d47f44f
60 changed files with 4264 additions and 58 deletions

View File

@@ -1,4 +1,4 @@
import React from 'react';
import React, { Suspense } from 'react';
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
import { Layout } from './components/layout/Layout';
import { useAuth } from './auth/AuthProvider';
@@ -8,6 +8,8 @@ import Files from './pages/Files';
import School from './pages/School';
import Games from './pages/Games';
const PortalAdminApp = React.lazy(() => import('./admin/AdminApp'));
function AppRoutes() {
const { ready, session } = useAuth();
@@ -37,6 +39,24 @@ function AppRoutes() {
<Route path="school" element={<School />} />
<Route path="games" element={<Games />} />
</Route>
<Route
path="/admin/*"
element={
isAuthenticated ? (
<Suspense
fallback={
<div className="min-h-screen flex items-center justify-center bg-white text-slate-700">
...
</div>
}
>
<PortalAdminApp />
</Suspense>
) : (
<Navigate to="/login" replace />
)
}
/>
<Route
path="*"
element={<Navigate to={isAuthenticated ? '/overview' : '/login'} replace />}