对接政策法规

This commit is contained in:
linxd
2025-07-29 09:09:22 +08:00
parent 55fa2cf919
commit 9ebae85b77
4 changed files with 148 additions and 4 deletions

View File

@ -0,0 +1,7 @@
.flex{
display: flex;
justify-content: space-around;
}
.card{
margin-bottom: 30px;
}

View File

@ -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 (
<div className="common-container">
<Row gutter={30}>
<Col span={12}>
<Card title="政策法规数量" className={styles.card}>
<div className={styles.flex}>
<Statistic title="发布" valueStyle={valueStyleBySuccess} value={regulationsCount.publishCount} />
<Statistic title="置顶" valueStyle={valueStyleByWarning} value={regulationsCount.topCount} />
<Statistic title="总数" valueStyle={valueStyleByError} value={regulationsCount.totalCount} />
</div>
</Card>
</Col>
<Col span={12}>
<Card title="通知中心数量" className={styles.card}>
<div className={styles.flex}>
<Statistic title="发布" valueStyle={valueStyleBySuccess} value={noticeCount.publishCount} />
<Statistic title="置顶" valueStyle={valueStyleByWarning} value={noticeCount.topCount} />
<Statistic title="总数" valueStyle={valueStyleByError} value={noticeCount.totalCount} />
</div>
</Card>
</Col>
<Col span={12}>
<Card title="用户提问数量" className={styles.card}>
<div className={styles.flex}>
<Statistic title="未解决" valueStyle={valueStyleByWarning} value={customerQandaCount.noticeCount} />
<Statistic title="已解决" valueStyle={valueStyleBySuccess} value={customerQandaCount.resolvedCount} />
<Statistic title="总数" valueStyle={valueStyleByError} value={customerQandaCount.totalCount} />
</div>
</Card>
</Col>
<Col span={12}>
<Card title="友情链接数量" className={styles.card}>
<div className={styles.flex}>
<Statistic title="发布" valueStyle={valueStyleBySuccess} value={linksCount.publishCount} />
<Statistic title="总数" valueStyle={valueStyleByError} value={linksCount.totalCount} />
</div>
</Card>
</Col>
</Row>
</div>
);
};

View File

@ -101,11 +101,11 @@ const LoginPage: React.FC<PageProps> = ({ user, dispatch }) => {
return (
<div className="login-page">
<div className="login-container">
<div className="back-home">
{/*<div className="back-home">
<a onClick={() => history.push('/index')}>
<HomeOutlined /> {intl.formatMessage({ id: 'login.back.home' })}
</a>
</div>
</div>*/}
<div className="login-title">{intl.formatMessage({ id: 'login.title' })}</div>

39
src/servers/api/index.ts Normal file
View File

@ -0,0 +1,39 @@
// 首页接口
import request from '@/utils/request';
/*
通知中心数量首页查询
/backendHomepage/getNoticeCount get
政策法规数量首页查询
/backendHomepage/getRegulationsCount
用户提问数量查询
/backendHomepage/getCustomerQandaCount
友情链接数量查询
/backendHomepage/getLinksCount
*/
export async function getNoticeCount() {
return request(`/backendHomepage/getNoticeCount`, {
method: 'GET',
});
}
export async function getRegulationsCount() {
return request(`/backendHomepage/getRegulationsCount`, {
method: 'GET',
});
}
export async function getCustomerQandaCount() {
return request(`/backendHomepage/getCustomerQandaCount`, {
method: 'GET',
});
}
export async function getLinksCount() {
return request(`/backendHomepage/getLinksCount`, {
method: 'GET',
});
}