import { getStat } from '@/services/api'; import type { TinyRingConfig } from '@ant-design/charts'; import { Tiny } from '@ant-design/charts'; import { PageContainer, ProCard, StatisticCard } from '@ant-design/pro-components'; import { Card, Statistic, message } from 'antd'; import RcResizeObserver from 'rc-resize-observer'; import { useLayoutEffect, useState } from 'react'; import { Stat } from './stat'; const percentRing = (percent: number, frontColor: string): React.JSX.Element => { const TinyRing = Tiny.Ring as (props: TinyRingConfig) => JSX.Element; const config: TinyRingConfig = { percent: percent / 100, width: 120, height: 120, color: ['#E8EFF5', frontColor], annotations: [ { type: 'text', style: { text: `${percent}%`, x: '50%', y: '50%', textAlign: 'center', fontSize: 16, fontStyle: 'bold', }, }, ], }; return ; }; const Logs: React.FC = () => { const [responsive, setResponsive] = useState(false); const [messageApi, contextHolder] = message.useMessage(); const [stat, setStat] = useState({ todayPT: 0, totalPT: 0, oreo: 0, report: 0, allSuccess: 0, all: 0, }); const [loading, setLoading] = useState(true); useLayoutEffect(() => { getStat() .then((res) => { setStat(res.data); setLoading(false); }) .catch((err) => { messageApi.open({ type: 'error', content: '获取失败!' + err, }); }); }, []); return ( {contextHolder} {!loading && ( { setResponsive(offset.width < 596); }} > 左侧内容 ), }} /> , }} chartPlacement="left" /> , }} chartPlacement="left" /> )} ); }; export default Logs;