import React from 'react';
|
import { HashRouter as Router, Routes, Route, Navigate } from 'react-router-dom';
|
import { useSelector } from 'react-redux';
|
import Login from './pages/Login';
|
import Layout from './components/Layout';
|
import Dashboard from './pages/Dashboard';
|
import PointTypeManagement from './pages/points/PointTypeManagement';
|
import PointProjectManagement from './pages/points/PointProjectManagement';
|
import DeclarationRuleManagement from './pages/points/DeclarationRuleManagement';
|
import ActivityList from './pages/activity/ActivityList';
|
import ActivityCreate from './pages/activity/ActivityCreate';
|
import ActivityEdit from './pages/activity/ActivityEdit';
|
import RegistrationManagement from './pages/activity/RegistrationManagement';
|
import RegistrationDetail from './pages/activity/RegistrationDetail';
|
import VolunteerList from './pages/volunteer/VolunteerList';
|
import VolunteerPoints from './pages/volunteer/VolunteerPoints';
|
import VolunteerDetail from './pages/volunteer/VolunteerDetail';
|
import StatisticsOverview from './pages/statistics/StatisticsOverview';
|
import StatisticsTrends from './pages/statistics/StatisticsTrends';
|
import ReportCenter from './pages/statistics/ReportCenter';
|
import UserManagement from './pages/system/UserManagement';
|
import AdminManagement from './pages/system/AdminManagement';
|
import PermissionManagement from './pages/system/PermissionManagement';
|
import SystemSettings from './pages/system/SystemSettings';
|
|
function App() {
|
const { isAuthenticated } = useSelector((state) => state.auth);
|
|
if (!isAuthenticated) {
|
return (
|
<Router>
|
<Routes>
|
<Route path="/login" element={<Login />} />
|
<Route path="*" element={<Navigate to="/login" replace />} />
|
</Routes>
|
</Router>
|
);
|
}
|
|
return (
|
<Router>
|
<Layout>
|
<Routes>
|
<Route path="/" element={<Navigate to="/dashboard" replace />} />
|
<Route path="/dashboard" element={<Dashboard />} />
|
|
{/* 积分管理 */}
|
{/* <Route path="/points/types" element={<PointTypeManagement />} />
|
<Route path="/points/projects" element={<PointProjectManagement />} /> */}
|
<Route path="/points/rules" element={<DeclarationRuleManagement />} />
|
|
{/* 活动管理 */}
|
<Route path="/activities" element={<ActivityList />} />
|
<Route path="/activities/create" element={<ActivityCreate />} />
|
<Route path="/activities/edit/:id" element={<ActivityEdit />} />
|
<Route path="/activities/registrations/:id" element={<RegistrationManagement />} />
|
<Route path="/activities/registrations/detail/:id" element={<RegistrationDetail />} />
|
|
{/* 志愿者管理 */}
|
<Route path="/volunteers" element={<VolunteerList />} />
|
<Route path="/volunteers/points" element={<VolunteerPoints />} />
|
<Route path="/volunteers/:id" element={<VolunteerDetail />} />
|
|
{/* 统计分析 */}
|
<Route path="/statistics/overview" element={<StatisticsOverview />} />
|
<Route path="/statistics/trends" element={<StatisticsTrends />} />
|
<Route path="/statistics/reports" element={<ReportCenter />} />
|
|
{/* 系统设置 */}
|
<Route path="/system/admins" element={<AdminManagement />} />
|
<Route path="/system/users" element={<UserManagement />} />
|
<Route path="/system/permissions" element={<PermissionManagement />} />
|
<Route path="/system/settings" element={<SystemSettings />} />
|
|
<Route path="*" element={<Navigate to="/dashboard" replace />} />
|
</Routes>
|
</Layout>
|
</Router>
|
);
|
}
|
|
export default App;
|