Files
gofly-platform-services/zlt-web/react-web-next/src/pages/Welcome.tsx
T

126 lines
6.3 KiB
TypeScript
Raw Normal View History

2025-09-26 18:42:41 +08:00
import React, { useEffect, useState } from 'react';
import { Card, Space, Typography, Row, Col, Statistic, Progress, Button } from 'antd';
2025-09-26 18:42:41 +08:00
import { RocketOutlined, TeamOutlined, AppstoreOutlined, CloudServerOutlined, TrophyOutlined, ThunderboltOutlined, GlobalOutlined, SafetyOutlined } from '@ant-design/icons';
import TenantScopeFilter from '@/components/TenantScopeFilter';
const { Title, Paragraph } = Typography;
const Welcome: React.FC = () => {
const [time, setTime] = useState(new Date());
useEffect(() => {
2025-09-26 18:42:41 +08:00
const timer = setInterval(() => setTime(new Date()), 1000);
return () => clearInterval(timer);
}, []);
const stats = [
{ title: '今日订单', value: 1234, icon: <AppstoreOutlined />, color: '#667eea' },
{ title: '活跃用户', value: 856, icon: <TeamOutlined />, color: '#764ba2' },
{ title: '设备在线', value: 98, suffix: '%', icon: <CloudServerOutlined />, color: '#f093fb' },
2025-09-26 18:42:41 +08:00
{ title: '系统可用率', value: 99.9, suffix: '%', icon: <SafetyOutlined />, color: '#4facfe' },
];
const quickActions = [
{ title: '新增订单', icon: <AppstoreOutlined />, color: '#667eea' },
{ title: '用户管理', icon: <TeamOutlined />, color: '#764ba2' },
{ title: '设备监控', icon: <CloudServerOutlined />, color: '#f093fb' },
{ title: '系统设置', icon: <SafetyOutlined />, color: '#4facfe' },
];
return (
<div className="page-enter" style={{ padding: 24 }}>
2025-09-26 18:42:41 +08:00
<Card className="modern-card" style={{ background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)', border: 'none', marginBottom: 24, color: 'white' }}>
<Row align="middle" justify="space-between">
<Col>
<Space direction="vertical" size={8}>
<Title level={2} style={{ color: 'white', margin: 0 }}>
2025-09-26 18:42:41 +08:00
<RocketOutlined style={{ marginRight: 12 }} /> 欢迎使用 Go-Fly Admin
</Title>
2025-09-26 18:42:41 +08:00
<Paragraph style={{ color: 'rgba(255,255,255,0.8)', margin: 0, fontSize: 16 }}>现代化的智能管理平台 · 科技驱动未来</Paragraph>
<Paragraph style={{ color: 'rgba(255,255,255,0.6)', margin: 0 }}>当前时间:{time.toLocaleString()}</Paragraph>
</Space>
</Col>
<Col>
2025-09-29 19:29:41 +08:00
<TenantScopeFilter useSwitchTenant onChanged={() => { /* 切换后由后端上下文生效 */ }} />
</Col>
</Row>
</Card>
<Row gutter={[24, 24]} style={{ marginBottom: 24 }}>
{stats.map((stat, index) => (
<Col xs={12} sm={12} md={6} key={index}>
2025-09-26 18:42:41 +08:00
<Card className="modern-card" style={{ textAlign: 'center', borderLeft: `4px solid ${stat.color}`, background: 'var(--bg-card)' }}>
<div style={{ color: stat.color, fontSize: 24, marginBottom: 8 }}>{stat.icon}</div>
<Statistic title={stat.title} value={stat.value} suffix={stat.suffix} valueStyle={{ color: 'var(--text-primary)', fontSize: 28, fontWeight: 'bold' }} />
</Card>
</Col>
))}
</Row>
<Row gutter={[24, 24]}>
<Col xs={24} md={12}>
2025-09-26 18:42:41 +08:00
<Card className="modern-card" title={<span style={{ color: 'var(--text-primary)' }}><ThunderboltOutlined style={{ marginRight: 8, color: '#667eea' }} />系统状态</span>}>
<Space direction="vertical" style={{ width: '100%' }} size={16}>
<div>
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 8 }}>
<span style={{ color: 'var(--text-secondary)' }}>CPU 使用率</span>
<span style={{ color: 'var(--text-primary)' }}>45%</span>
</div>
<Progress percent={45} strokeColor="#667eea" />
</div>
<div>
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 8 }}>
<span style={{ color: 'var(--text-secondary)' }}>内存使用率</span>
<span style={{ color: 'var(--text-primary)' }}>68%</span>
</div>
<Progress percent={68} strokeColor="#764ba2" />
</div>
<div>
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 8 }}>
<span style={{ color: 'var(--text-secondary)' }}>磁盘使用率</span>
<span style={{ color: 'var(--text-primary)' }}>32%</span>
</div>
<Progress percent={32} strokeColor="#f093fb" />
</div>
</Space>
</Card>
</Col>
<Col xs={24} md={12}>
2025-09-26 18:42:41 +08:00
<Card className="modern-card" title={<span style={{ color: 'var(--text-primary)' }}><TrophyOutlined style={{ marginRight: 8, color: '#667eea' }} />快捷操作</span>}>
<Row gutter={[16, 16]}>
{quickActions.map((action, index) => (
<Col span={12} key={index}>
<Button
block
size="large"
className="tech-button"
2025-09-26 18:42:41 +08:00
style={{ height: 64, background: `linear-gradient(135deg, ${action.color}33, ${action.color}11)`, border: `1px solid ${action.color}44`, color: action.color, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }}
>
<div style={{ fontSize: 20, marginBottom: 4 }}>{action.icon}</div>
<div style={{ fontSize: 12 }}>{action.title}</div>
</Button>
</Col>
))}
</Row>
</Card>
</Col>
</Row>
2025-09-26 18:42:41 +08:00
<Card className="modern-card" style={{ marginTop: 24 }} title={<span style={{ color: 'var(--text-primary)' }}><GlobalOutlined style={{ marginRight: 8, color: '#667eea' }} />平台特性</span>}>
<Row gutter={[24, 24]}>
<Col xs={24} sm={12} md={8}>
<div style={{ textAlign: 'center', padding: 16 }}>
2025-09-26 18:42:41 +08:00
<div style={{ fontSize: 32, color: '#667eea', marginBottom: 12 }}><RocketOutlined /></div>
<Title level={4} style={{ color: 'var(--text-primary)' }}>高性能架构</Title>
2025-09-26 18:42:41 +08:00
<Paragraph style={{ color: 'var(--text-secondary)' }}>基于微服务架构,支持高并发访问,确保系统稳定运行</Paragraph>
</div>
</Col>
</Row>
</Card>
</div>
);
};
2025-09-29 19:29:41 +08:00
export default Welcome;