From 9ebae85b778a490ad7fb08de6f02ae78ea268204 Mon Sep 17 00:00:00 2001 From: linxd <544554903@qq.com> Date: Tue, 29 Jul 2025 09:09:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E6=94=BF=E7=AD=96=E6=B3=95?= =?UTF-8?q?=E8=A7=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/index/index.less | 7 +++ src/pages/index/index.tsx | 102 ++++++++++++++++++++++++++++++++++++- src/pages/login/login.tsx | 4 +- src/servers/api/index.ts | 39 ++++++++++++++ 4 files changed, 148 insertions(+), 4 deletions(-) create mode 100644 src/servers/api/index.ts diff --git a/src/pages/index/index.less b/src/pages/index/index.less index e69de29..ae83aea 100644 --- a/src/pages/index/index.less +++ b/src/pages/index/index.less @@ -0,0 +1,7 @@ +.flex{ + display: flex; + justify-content: space-around; +} +.card{ + margin-bottom: 30px; +} diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index 7016320..5453cdd 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -1,10 +1,108 @@ -import React from 'react'; +import React, { useState, useEffect } from 'react'; import styles from './index.less'; +import { + getNoticeCount, + getRegulationsCount, + getCustomerQandaCount, + getLinksCount, +} from '@/servers/api'; +import { Row, Col, Card, Statistic, Space } from 'antd'; const IndexPage: React.FC = () => { + // 通知中心数量 + const [noticeCount, setNoticeCount] = useState({ + publishCount: 0, + topCount: 0, + totalCount: 0, + }); + // 政策法规数量 + const [regulationsCount, setRegulationsCount] = useState({ + publishCount: 0, + topCount: 0, + totalCount: 0, + }); + // 用户提问数量 + const [customerQandaCount, setCustomerQandaCount] = useState({ + noticeCount: 0, + resolvedCount: 0, + totalCount: 0, + }); + // 友情链接数量 + const [linksCount, setLinksCount] = useState({ + publishCount: 0, + totalCount: 0, + }); + + useEffect(() => { + // 政策法规数量 + getRegulationsCount().then((res) => { + setRegulationsCount(res.data); + }); + // 通知中心数量 + getNoticeCount().then((res) => { + setNoticeCount(res.data); + }); + // 用户提问数量 + getCustomerQandaCount().then((res) => { + setCustomerQandaCount(res.data); + }); + // 友情链接数量 + getLinksCount().then((res) => { + setLinksCount(res.data); + }); + }, []); + + const valueStyleBySuccess = { + color: '#3f8600', + fontSize: 40, + }; + const valueStyleByError = { + color: '#cf1322', + fontSize: 40, + }; + const valueStyleByWarning = { + color: '#faad14', + fontSize: 40, + }; return (