Ver código fonte

feat(home): home

lind 3 anos atrás
pai
commit
50633ff8e5

+ 4 - 0
src/pages/home/device/index.tsx

@@ -0,0 +1,4 @@
+const Device = () => {
+  return <div>设备接入视图</div>;
+};
+export default Device;

+ 24 - 0
src/pages/home/index.tsx

@@ -0,0 +1,24 @@
+import { PageContainer } from '@ant-design/pro-layout';
+import { Button } from 'antd';
+import { useState } from 'react';
+import Device from './device';
+import Init from './init';
+import Ops from './ops';
+
+const ViewMap = {
+  init: <Init />,
+  device: <Device />,
+  ops: <Ops />,
+};
+
+const Home = () => {
+  const [current, setCurrent] = useState<'init' | 'device' | 'ops'>('init');
+
+  return (
+    <PageContainer>
+      <Button onClick={() => setCurrent('device')}>切换视图</Button>
+      {ViewMap[current]}
+    </PageContainer>
+  );
+};
+export default Home;

+ 4 - 0
src/pages/home/init/index.tsx

@@ -0,0 +1,4 @@
+const Init = () => {
+  return <div>初始化视图</div>;
+};
+export default Init;

+ 4 - 0
src/pages/home/ops/index.tsx

@@ -0,0 +1,4 @@
+const Ops = () => {
+  return <div>运维管理视图</div>;
+};
+export default Ops;

+ 1 - 0
src/utils/menu/router.ts

@@ -1,5 +1,6 @@
 /** 路由Code */
 export enum MENUS_CODE {
+  'home' = 'home',
   'Analysis/CPU' = 'Analysis/CPU',
   'Analysis/DeviceChart' = 'Analysis/DeviceChart',
   'Analysis/DeviceMessage' = 'Analysis/DeviceMessage',