曾国涛
authored
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
import { postAdminClientGetStatisticalData } from '@/services';
import { StatisticCard } from '@ant-design/pro-components';
import { useEffect, useState } from 'react';
export default () => {
const [clientStatistic, setClientStatistic] = useState([]);
useEffect(() => {
const pullStatistic = async () => {
let statisticalData = await postAdminClientGetStatisticalData();
console.log('stati' + JSON.stringify(statisticalData.data));
setClientStatistic(statisticalData.data);
};
pullStatistic();
}, []);
return (
<StatisticCard.Group>
{clientStatistic.map((stat, index) => (
<StatisticCard
key={index}
statistic={{
title: stat.title,
tip: stat.tip || '', // 如果tip不存在,则使用空字符串
value: stat.value,
status: stat.status || 'default', // 如果status不存在,则使用'default'
}}
/>
))}
</StatisticCard.Group>
);
};
|