From 8efa4eed57b82ca02cdb0226489b039e38470ba6 Mon Sep 17 00:00:00 2001 From: licuizhu <1065490369@qq.com> Date: Mon, 16 Oct 2023 21:48:16 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=A4=A7=E7=9B=98=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/index.js | 7 +++++++ src/components/Guide/Guide.tsx | 25 +++++++++++++++++++------ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 385441fb..cb5e03b0 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -31,3 +31,10 @@ export function getLayerPoints( params ) { params: params }); } + +// 获取大盘统计数据 +export function getDashboardData() { + return request('/api/dashboard/getDashboardData', { + method: 'GET', + }); +} diff --git a/src/components/Guide/Guide.tsx b/src/components/Guide/Guide.tsx index 05a3c708..1a5e327d 100644 --- a/src/components/Guide/Guide.tsx +++ b/src/components/Guide/Guide.tsx @@ -1,6 +1,7 @@ import { Layout, Row, Col, Select } from 'antd'; -import React, { useEffect } from 'react'; +import React, { useEffect, useState } from 'react'; import styles from './Guide.less'; +import { getDashboardData } from '../../api'; import { GaodeMap ,Scene } from '@antv/l7'; import { Choropleth } from '@antv/l7plot'; @@ -14,7 +15,11 @@ interface Props { // 脚手架示例组件 const Guide: React.FC = (props) => { const { name } = props; - useEffect(() => { + const [registerDays, setRegisterDays] = useState(0); + const [createLayerCount, setCreateLayerCount] = useState(0); + const [createPointCount, setCreatePointCount] = useState(0); + + useEffect(() => {debugger const scene = new Scene({ id: 'map', map: new GaodeMap({ @@ -25,7 +30,6 @@ const Guide: React.FC = (props) => { }) }); scene.on('loaded', () => { - const areadata = areaList; const data = areaList // .filter(({ level, parent }) => level === 'city' && parent === 330000) .map((item) => ({ ...item, value: Math.random() * 5000 })); @@ -86,6 +90,15 @@ const Guide: React.FC = (props) => { choropleth.addToScene(scene); }); + + //大盘统计数据 + getDashboardData().then((e) => { + const data = e.data || {}; + data.registerDays && setRegisterDays(data.registerDays); + data.createLayerCount && setCreateLayerCount(data.createLayerCount); + data.createPointCount && setCreatePointCount(data.createPointCount); + }); + }, []); let onLayerSelectChange = (e:any) => { @@ -102,9 +115,9 @@ const Guide: React.FC = (props) => { {/* 顶部信息 */}
-
您已注册125
-
已创建图层项目125
-
已创建点位项目125
+
您已注册{registerDays}
+
已创建图层数目{createLayerCount}
+
已创建点位数目{createPointCount}
{/* 下拉框 全国自定义点位数目图 */}