import React, { useState, useEffect } from 'react' import { Card, Row, Col, Statistic, Spin } from 'antd' import { UserOutlined, ShoppingOutlined, DollarOutlined } from '@ant-design/icons' import statsApi from '../api/modules/stats' function Home() { const [stats, setStats] = useState({ totalUsers: 0, todayOrders: 0, todayRevenue: 0, }) const [loading, setLoading] = useState(true) useEffect(() => { fetchStats() }, []) const fetchStats = async () => { try { const response = await statsApi.getDashboardStats() if (response.code === 0) { setStats(response.data) } } catch (error) { console.error('Failed to fetch stats:', error) } finally { setLoading(false) } } return (

欢迎来到 Atlas Console

{loading ? (
) : ( } // @ts-ignore - antd v5 types incomplete styles={{ value: { color: '#3f8600' } }} /> } // @ts-ignore styles={{ value: { color: '#1890ff' } }} /> } precision={2} suffix="元" /> )}
) } const styles = { title: { marginBottom: '24px', }, loading: { display: 'flex', justifyContent: 'center', alignItems: 'center', minHeight: '200px', }, } export default Home