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

231 lines
8.4 KiB
TypeScript
Raw Normal View History

import React, { useEffect, useState } from 'react';
import { Card, Space, Typography, Row, Col, Statistic, Progress, Button } from 'antd';
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(() => {
let isMounted = true;
const timer = setInterval(() => {
if (isMounted) {
setTime(new Date());
}
}, 1000);
return () => {
isMounted = false;
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' },
{ 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 }}>
{/* 欢迎横幅 */}
<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 }}>
<RocketOutlined style={{ marginRight: 12 }} />
欢迎使用 Go-Fly Admin
</Title>
<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>
<TenantScopeFilter />
</Col>
</Row>
</Card>
{/* 数据统计卡片 */}
<Row gutter={[24, 24]} style={{ marginBottom: 24 }}>
{stats.map((stat, index) => (
<Col xs={12} sm={12} md={6} key={index}>
<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}>
<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}>
<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"
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>
{/* 功能介绍 */}
<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 }}>
<div style={{ fontSize: 32, color: '#667eea', marginBottom: 12 }}>
<RocketOutlined />
</div>
<Title level={4} style={{ color: 'var(--text-primary)' }}>高性能架构</Title>
<Paragraph style={{ color: 'var(--text-secondary)' }}>
基于微服务架构,支持高并发访问,确保系统稳定运行
</Paragraph>
</div>
</Col>
<Col xs={24} sm={12} md={8}>
<div style={{ textAlign: 'center', padding: 16 }}>
<div style={{ fontSize: 32, color: '#764ba2', marginBottom: 12 }}>
<SafetyOutlined />
</div>
<Title level={4} style={{ color: 'var(--text-primary)' }}>安全可靠</Title>
<Paragraph style={{ color: 'var(--text-secondary)' }}>
多层安全防护,数据加密传输,保障业务数据安全
</Paragraph>
</div>
</Col>
<Col xs={24} sm={12} md={8}>
<div style={{ textAlign: 'center', padding: 16 }}>
<div style={{ fontSize: 32, color: '#f093fb', marginBottom: 12 }}>
<ThunderboltOutlined />
</div>
<Title level={4} style={{ color: 'var(--text-primary)' }}>智能运维</Title>
<Paragraph style={{ color: 'var(--text-secondary)' }}>
实时监控预警,自动化运维管理,降低运维成本
</Paragraph>
</div>
</Col>
</Row>
</Card>
</div>
);
};
export default Welcome;