Files
Mycontent/soul-admin/src/App.tsx
卡若 6d11fb295d feat: 同步本地三端改动并清理上传凭证风险
整合小程序、管理端与后端的最新本地改动,补齐用户管理与首页入口相关能力;提交前已完成敏感信息扫描,并移除本地 gitea 远程 URL 中的明文凭证,避免隐私信息进入远程仓库。

Made-with: Cursor
2026-04-06 15:59:34 +08:00

70 lines
5.2 KiB
TypeScript

import { lazy, Suspense } from 'react'
import { Routes, Route, Navigate } from 'react-router-dom'
import { AdminLayout } from './layouts/AdminLayout'
import { LoginPage } from './pages/login/LoginPage'
import { NotFoundPage } from './pages/not-found/NotFoundPage'
const DashboardPage = lazy(() => import('./pages/dashboard/DashboardPage').then(m => ({ default: m.DashboardPage })))
const OrdersPage = lazy(() => import('./pages/orders/OrdersPage').then(m => ({ default: m.OrdersPage })))
const UsersPage = lazy(() => import('./pages/users/UsersPage').then(m => ({ default: m.UsersPage })))
const DistributionPage = lazy(() => import('./pages/distribution/DistributionPage').then(m => ({ default: m.DistributionPage })))
const WithdrawalsPage = lazy(() => import('./pages/withdrawals/WithdrawalsPage').then(m => ({ default: m.WithdrawalsPage })))
const ContentPage = lazy(() => import('./pages/content/ContentPage').then(m => ({ default: m.ContentPage })))
const ReferralSettingsPage = lazy(() => import('./pages/referral-settings/ReferralSettingsPage').then(m => ({ default: m.ReferralSettingsPage })))
const SettingsPage = lazy(() => import('./pages/settings/SettingsPage').then(m => ({ default: m.SettingsPage })))
const PaymentPage = lazy(() => import('./pages/payment/PaymentPage').then(m => ({ default: m.PaymentPage })))
const SitePage = lazy(() => import('./pages/site/SitePage').then(m => ({ default: m.SitePage })))
const QRCodesPage = lazy(() => import('./pages/qrcodes/QRCodesPage').then(m => ({ default: m.QRCodesPage })))
const MatchPage = lazy(() => import('./pages/match/MatchPage').then(m => ({ default: m.MatchPage })))
const MatchRecordsPage = lazy(() => import('./pages/match-records/MatchRecordsPage').then(m => ({ default: m.MatchRecordsPage })))
const VipRolesPage = lazy(() => import('./pages/vip-roles/VipRolesPage').then(m => ({ default: m.VipRolesPage })))
const MentorsPage = lazy(() => import('./pages/mentors/MentorsPage').then(m => ({ default: m.MentorsPage })))
const MentorConsultationsPage = lazy(() => import('./pages/mentor-consultations/MentorConsultationsPage').then(m => ({ default: m.MentorConsultationsPage })))
const FindPartnerPage = lazy(() => import('./pages/find-partner/FindPartnerPage').then(m => ({ default: m.FindPartnerPage })))
const ApiDocsPage = lazy(() => import('./pages/api-docs/ApiDocsPage').then(m => ({ default: m.ApiDocsPage })))
function PageLoader() {
return (
<div className="flex items-center justify-center py-32">
<div className="w-6 h-6 border-2 border-[#38bdac] border-t-transparent rounded-full animate-spin" />
<span className="ml-2 text-gray-400 text-sm">...</span>
</div>
)
}
function App() {
return (
<Routes>
<Route path="/login" element={<LoginPage />} />
<Route path="/" element={<AdminLayout />}>
<Route index element={<Navigate to="/dashboard" replace />} />
<Route path="dashboard" element={<Suspense fallback={<PageLoader />}><DashboardPage /></Suspense>} />
<Route path="orders" element={<Suspense fallback={<PageLoader />}><OrdersPage /></Suspense>} />
<Route path="users" element={<Suspense fallback={<PageLoader />}><UsersPage /></Suspense>} />
<Route path="distribution" element={<Suspense fallback={<PageLoader />}><DistributionPage /></Suspense>} />
<Route path="withdrawals" element={<Suspense fallback={<PageLoader />}><WithdrawalsPage /></Suspense>} />
<Route path="content" element={<Suspense fallback={<PageLoader />}><ContentPage /></Suspense>} />
<Route path="referral-settings" element={<Suspense fallback={<PageLoader />}><ReferralSettingsPage /></Suspense>} />
<Route path="author-settings" element={<Navigate to="/settings?tab=author" replace />} />
<Route path="vip-roles" element={<Suspense fallback={<PageLoader />}><VipRolesPage /></Suspense>} />
<Route path="mentors" element={<Suspense fallback={<PageLoader />}><MentorsPage /></Suspense>} />
<Route path="mentor-consultations" element={<Suspense fallback={<PageLoader />}><MentorConsultationsPage /></Suspense>} />
<Route path="admin-users" element={<Navigate to="/settings?tab=admin" replace />} />
<Route path="settings" element={<Suspense fallback={<PageLoader />}><SettingsPage /></Suspense>} />
<Route path="payment" element={<Suspense fallback={<PageLoader />}><PaymentPage /></Suspense>} />
<Route path="site" element={<Suspense fallback={<PageLoader />}><SitePage /></Suspense>} />
<Route path="qrcodes" element={<Suspense fallback={<PageLoader />}><QRCodesPage /></Suspense>} />
<Route path="find-partner" element={<Suspense fallback={<PageLoader />}><FindPartnerPage /></Suspense>} />
<Route path="match" element={<Suspense fallback={<PageLoader />}><MatchPage /></Suspense>} />
<Route path="match-records" element={<Suspense fallback={<PageLoader />}><MatchRecordsPage /></Suspense>} />
<Route path="api-doc" element={<Navigate to="/api-docs" replace />} />
<Route path="api-docs" element={<Suspense fallback={<PageLoader />}><ApiDocsPage /></Suspense>} />
<Route path="open-platform" element={<Navigate to="/settings?tab=open-platform" replace />} />
</Route>
<Route path="*" element={<NotFoundPage />} />
</Routes>
)
}
export default App