From c186b8f3bb359e0020d50557571f21cd31103073 Mon Sep 17 00:00:00 2001 From: Jerry Date: Thu, 19 Jun 2025 13:42:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E7=AE=A1=E7=90=86=E5=8F=B0?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/dashboard/FeatureCard.jsx | 43 +++++++ .../components/pages/dashboard/StatCard.jsx | 31 +++++ .../src/components/system/PageContainer.jsx | 2 +- src/frontend/src/pages/Dashboard.jsx | 110 +++++++++++++++++- 4 files changed, 179 insertions(+), 7 deletions(-) create mode 100644 src/frontend/src/components/pages/dashboard/FeatureCard.jsx create mode 100644 src/frontend/src/components/pages/dashboard/StatCard.jsx diff --git a/src/frontend/src/components/pages/dashboard/FeatureCard.jsx b/src/frontend/src/components/pages/dashboard/FeatureCard.jsx new file mode 100644 index 0000000..5da6c03 --- /dev/null +++ b/src/frontend/src/components/pages/dashboard/FeatureCard.jsx @@ -0,0 +1,43 @@ +import { Box, Button, Text } from '@chakra-ui/react'; +import React from 'react'; + +/** + * 特性卡片 + * @param title 标题 + * @param description 描述 + * @param buttonText 按钮文字 + * @param to 转向 + * @param disabled 按钮是否可用 + * @returns {JSX.Element} + * @constructor + */ +const FeatureCard = ({ title, description, buttonText, to, disabled }) => ( + + + {title} + + + {description} + + + +); + +export default FeatureCard; diff --git a/src/frontend/src/components/pages/dashboard/StatCard.jsx b/src/frontend/src/components/pages/dashboard/StatCard.jsx new file mode 100644 index 0000000..88b1937 --- /dev/null +++ b/src/frontend/src/components/pages/dashboard/StatCard.jsx @@ -0,0 +1,31 @@ +import { Box, Stat } from '@chakra-ui/react'; +import React from 'react'; + +/** + * 状态卡片 + * @param title 标题 + * @param value 内容 + * @param suffix 交换机数目 + * @param isTime 扫描时间 + * @returns {JSX.Element} + * @constructor + */ +const StatCard = ({ title, value, suffix, isTime }) => ( + + + {title} + {`${value}${suffix ? ` ${suffix}` : ''}`} + {isTime && {`上次扫描时间`}} + + +); + +export default StatCard; diff --git a/src/frontend/src/components/system/PageContainer.jsx b/src/frontend/src/components/system/PageContainer.jsx index 857c974..ba723a5 100644 --- a/src/frontend/src/components/system/PageContainer.jsx +++ b/src/frontend/src/components/system/PageContainer.jsx @@ -8,7 +8,7 @@ import { Box } from '@chakra-ui/react'; */ const PageContainer = ({ children }) => { return ( - + {children} ); diff --git a/src/frontend/src/pages/Dashboard.jsx b/src/frontend/src/pages/Dashboard.jsx index 964dd61..c1187c9 100644 --- a/src/frontend/src/pages/Dashboard.jsx +++ b/src/frontend/src/pages/Dashboard.jsx @@ -1,19 +1,117 @@ -import React from 'react'; -import { Box, Text } from '@chakra-ui/react'; +import React, { useEffect, useState } from 'react'; +import { Box, Text, VStack, HStack, SimpleGrid, Badge } from '@chakra-ui/react'; import DocumentTitle from '@/components/system/pages/DocumentTitle'; import PageContainer from '@/components/system/PageContainer'; import DashboardBackground from '@/components/system/pages/DashboardBackground'; import FadeInWrapper from '@/components/system/layout/FadeInWrapper'; +import FeatureCard from '@/components/pages/dashboard/FeatureCard'; +import StatCard from '@/components/pages/dashboard/StatCard'; +/** + * 控制台页面 + * @returns {JSX.Element} + * @constructor + */ const Dashboard = () => { + const [stats, setStats] = useState({ + totalDevices: 0, + onlineDevices: 0, + lastScan: '', + }); + + useEffect(() => {}, []); + return ( - - - 控制台奇怪的功能+1 - + + + + + {`欢迎使用智能交换机管理系统`} + + + {`实时监控您的网络设备状态,快速配置并掌控全局网络环境`} + + + + + + + + + + + + + {`网络健康状态`} + + + + {`网络连接正常`} + + + {`交换机正常运行`} + + + {`流量监控未启动`} + + + + + + + + + + + + + +