98 lines
3.5 KiB
JavaScript
Executable File
98 lines
3.5 KiB
JavaScript
Executable File
// src/layouts/Home.js
|
|
import React from "react";
|
|
import { Routes, Route } from "react-router-dom";
|
|
import { Box } from '@chakra-ui/react';
|
|
|
|
// 导航栏已由 MainLayout 提供,此处不再导入
|
|
// import HomeNavbar from "../components/Navbars/HomeNavbar";
|
|
|
|
// 导入页面组件
|
|
import HomePage from "views/Home/HomePage";
|
|
import ProfilePage from "views/Profile/ProfilePage";
|
|
import SettingsPage from "views/Settings/SettingsPage";
|
|
import CenterDashboard from "views/Dashboard/Center";
|
|
import Subscription from "views/Pages/Account/Subscription";
|
|
|
|
// 懒加载隐私政策、用户协议、微信回调和模拟交易页面
|
|
const PrivacyPolicy = React.lazy(() => import("views/Pages/PrivacyPolicy"));
|
|
const UserAgreement = React.lazy(() => import("views/Pages/UserAgreement"));
|
|
const WechatCallback = React.lazy(() => import("views/Pages/WechatCallback"));
|
|
const TradingSimulation = React.lazy(() => import("views/TradingSimulation"));
|
|
|
|
// 导入保护路由组件
|
|
import ProtectedRoute from "../components/ProtectedRoute";
|
|
|
|
export default function Home() {
|
|
return (
|
|
<Box minH="100vh">
|
|
{/* 导航栏已由 MainLayout 提供,此处不再渲染 */}
|
|
|
|
{/* 主要内容区域 */}
|
|
<Box>
|
|
<Routes>
|
|
{/* 首页默认路由 */}
|
|
<Route path="/" element={<HomePage />} />
|
|
<Route
|
|
path="/center"
|
|
element={
|
|
<ProtectedRoute>
|
|
<CenterDashboard />
|
|
</ProtectedRoute>
|
|
}
|
|
/>
|
|
|
|
{/* 需要登录保护的页面 */}
|
|
<Route
|
|
path="/profile"
|
|
element={
|
|
<ProtectedRoute>
|
|
<ProfilePage />
|
|
</ProtectedRoute>
|
|
}
|
|
/>
|
|
|
|
<Route
|
|
path="/settings"
|
|
element={
|
|
<ProtectedRoute>
|
|
<SettingsPage />
|
|
</ProtectedRoute>
|
|
}
|
|
/>
|
|
|
|
{/* 订阅管理页面 */}
|
|
<Route
|
|
path="/pages/account/subscription"
|
|
element={
|
|
<ProtectedRoute>
|
|
<Subscription />
|
|
</ProtectedRoute>
|
|
}
|
|
/>
|
|
|
|
{/* 模拟盘交易页面 */}
|
|
<Route
|
|
path="/trading-simulation"
|
|
element={
|
|
<ProtectedRoute>
|
|
<TradingSimulation />
|
|
</ProtectedRoute>
|
|
}
|
|
/>
|
|
|
|
{/* 隐私政策页面 - 无需登录 */}
|
|
<Route path="/privacy-policy" element={<PrivacyPolicy />} />
|
|
|
|
{/* 用户协议页面 - 无需登录 */}
|
|
<Route path="/user-agreement" element={<UserAgreement />} />
|
|
|
|
{/* 微信授权回调页面 - 无需登录 */}
|
|
<Route path="/wechat-callback" element={<WechatCallback />} />
|
|
|
|
{/* 其他可能的路由 */}
|
|
<Route path="*" element={<HomePage />} />
|
|
</Routes>
|
|
</Box>
|
|
</Box>
|
|
);
|
|
} |