You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
912 B
36 lines
912 B
|
3 months ago
|
import React, { useState } from 'react';
|
||
|
|
import MainLayout from './components/layout/MainLayout';
|
||
|
|
import Dashboard from './pages/dashboard/Dashboard';
|
||
|
|
import Detail from './pages/detail/Detail';
|
||
|
|
import RiskControl from './pages/risk-control/RiskControl';
|
||
|
|
import Config from './pages/config/Config';
|
||
|
|
import './App.css';
|
||
|
|
|
||
|
|
function App() {
|
||
|
|
const [currentMenu, setCurrentMenu] = useState('dashboard');
|
||
|
|
|
||
|
|
// 渲染当前页面
|
||
|
|
const renderCurrentPage = () => {
|
||
|
|
switch (currentMenu) {
|
||
|
|
case 'dashboard':
|
||
|
|
return <Dashboard />;
|
||
|
|
case 'detail':
|
||
|
|
return <Detail />;
|
||
|
|
case 'risk-control':
|
||
|
|
return <RiskControl />;
|
||
|
|
case 'config':
|
||
|
|
return <Config />;
|
||
|
|
default:
|
||
|
|
return <Dashboard />;
|
||
|
|
}
|
||
|
|
};
|
||
|
|
|
||
|
|
return (
|
||
|
|
<MainLayout currentMenu={currentMenu} onMenuSelect={setCurrentMenu}>
|
||
|
|
{renderCurrentPage()}
|
||
|
|
</MainLayout>
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
export default App;
|