zlisen 3 yıl önce
ebeveyn
işleme
2300fe25ba

+ 2
- 2
config/proxy.js Dosyayı Görüntüle

@@ -8,8 +8,8 @@
8 8
 export default {
9 9
   dev: {
10 10
     '/api/': {
11
-      // target: 'https://xlk.njyz.tech/',
12
-      target: 'http://localhost:8567/',
11
+      target: 'https://xlk.njyz.tech/',
12
+      // target: 'http://localhost:8567/',
13 13
       // target: 'https://xlj.newlandsh.com/',
14 14
       changeOrigin: true,
15 15
       pathRewrite: {

BIN
src/assets/xiaochengxu.png Dosyayı Görüntüle


+ 28
- 1
src/components/EchartsTest/EChart.jsx Dosyayı Görüntüle

@@ -17,10 +17,37 @@ import 'echarts/lib/component/dataZoom';
17 17
 import 'echarts/lib/component/geo';
18 18
 import 'echarts/lib/component/visualMap';
19 19
 
20
-import { ChinaData } from './china';
20
+// import china from 'echarts/map/json/china-cities.json'
21
+// echarts.registerMap('china', china)
22
+
23
+import china from 'echarts/map/json/china.json'
24
+echarts.registerMap('china', china)
25
+console.log(china,'chinachinachina')
26
+// import china from 'echarts/map/json/china.json'
27
+// echarts.registerMap('china', china)
28
+// import { ChinaData } from './china';
21 29
 
22 30
 // echarts.registerMap('china', ChinaData);
23 31
 
32
+// import * as echarts from 'echarts/core';
33
+// import {
34
+//     TitleComponent,
35
+//     TooltipComponent
36
+// } from 'echarts/components';
37
+// import {
38
+//     ScatterChart,
39
+//     EffectScatterChart,
40
+//     CustomChart
41
+// } from 'echarts/charts';
42
+// import {
43
+//     CanvasRenderer
44
+// } from 'echarts/renderers';
45
+
46
+// echarts.use(
47
+//     [TitleComponent, TooltipComponent, ScatterChart, EffectScatterChart, CustomChart, CanvasRenderer]
48
+// );
49
+
50
+
24 51
 class EchartsTest extends Component {
25 52
     chartRef = React.createRef();
26 53
     chart = undefined

+ 156
- 0
src/pages/statistics/dataReport/CityNums/index.jsx Dosyayı Görüntüle

@@ -0,0 +1,156 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Card, Slider } from 'antd';
3
+import Echart from '@/components/EchartsTest/EChart';
4
+import { fetch, apis } from '@/utils/request';
5
+// import  ECharts from './echarts';
6
+
7
+const geoOptions = {};
8
+
9
+const getCityData = fetch(apis.indexEcharts.personCity);
10
+
11
+const mapDataRange = x => {
12
+  // 映射区间 [1, 100000] => [rangeStart, rangeEnd]
13
+  const min = 1;
14
+  const max = 100000;
15
+  const rangeStart = 16;
16
+  const rangeEnd = 24;
17
+
18
+  return rangeStart + ((x - min) * (rangeEnd - rangeStart)) / (max - min);
19
+};
20
+
21
+const CityNums = props => {
22
+  const [data, setData] = useState([]);
23
+  const [zoom, setZoom] = useState(1.2);
24
+  const [option, setOption] = useState({});
25
+
26
+  useEffect(() => {
27
+    getCityData().then(response => {
28
+      const { selectCityUser = [] } = response || {};
29
+      const data = selectCityUser.map(item => {
30
+        return {
31
+          name: item.name,
32
+          value: [item.lng - 0, item.lat - 0, item.cityCount],
33
+        };
34
+      });
35
+      setData(data);
36
+    });
37
+  }, []);
38
+
39
+  useEffect(() => {
40
+    setOption({
41
+      tooltip: {
42
+        trigger: 'item',
43
+        formatter: params => {
44
+          return `${params.data.name}: ${params.data.value[2]}`;
45
+        },
46
+      },
47
+      geo: {
48
+        map: 'china',
49
+        roam: 'move',
50
+        zoom: zoom,
51
+        label: {
52
+          normal: {
53
+            show: true,
54
+            color: '#aaa',
55
+          },
56
+          emphasis: {
57
+            show: true,
58
+          },
59
+        },
60
+        itemStyle: {
61
+          normal: {
62
+            areaColor: '#f3f3f3',
63
+            borderColor: '#ddd',
64
+          },
65
+          emphasis: {
66
+            areaColor: '#eee',
67
+          },
68
+        },
69
+      },
70
+      series: [
71
+        {
72
+          name: '人数',
73
+          type: 'scatter',
74
+          coordinateSystem: 'geo',
75
+          data,
76
+          symbolSize: 10,
77
+          label: {
78
+            normal: {
79
+              formatter: '{b}',
80
+              position: 'right',
81
+              show: false,
82
+            },
83
+            emphasis: {
84
+              show: true,
85
+            },
86
+          },
87
+          itemStyle: {
88
+            normal: {
89
+              color: '#DB3C4B',
90
+            },
91
+          },
92
+        },
93
+        {
94
+          name: '前三',
95
+          type: 'effectScatter',
96
+          coordinateSystem: 'geo',
97
+          data: data
98
+            .sort(function(a, b) {
99
+              return b.value[2] - a.value[2];
100
+            })
101
+            .slice(0, 3),
102
+          symbolSize: function(val) {
103
+            return mapDataRange(val[2]);
104
+          },
105
+          showEffectOn: 'render',
106
+          rippleEffect: {
107
+            brushType: 'stroke',
108
+          },
109
+          hoverAnimation: true,
110
+          label: {
111
+            normal: {
112
+              formatter: '{b}',
113
+              position: 'right',
114
+              show: false,
115
+            },
116
+          },
117
+          itemStyle: {
118
+            normal: {
119
+              color: '#DB3C4B',
120
+              shadowBlur: 10,
121
+              shadowColor: '#333',
122
+            },
123
+          },
124
+          zlevel: 1,
125
+        },
126
+      ],
127
+    });
128
+  }, [data, zoom]);
129
+
130
+  const marks = [0.5,2];
131
+
132
+  return (
133
+    <Card
134
+      title={
135
+        <div>
136
+          城市分布
137
+          <span style={{ fontSize: '8px', color: '#c4c4c4' }}>(数据会存在一定时间延迟)</span>
138
+        </div>
139
+      }
140
+      headStyle={{ textAlign: 'left' }}
141
+      // extra={<TimeSelect onChange={onTimeChange}></TimeSelect>}
142
+    >
143
+      <div style={{ display: 'flex' }}>
144
+        <div style={{ width: '50px', display: 'inline-block', height: 300 }}>
145
+          <Slider value={zoom} vertical min={0.5} step={0.1} max={5} defaultValue={1} onChange={(value)=>{setZoom(value)}}/>
146
+        </div>
147
+        <div style={{flex:'1'}}>
148
+        <Echart options={option} style={{ width: '100%', height: '600px' }}></Echart>
149
+        </div>
150
+        
151
+      </div>
152
+    </Card>
153
+  );
154
+};
155
+
156
+export default CityNums;

+ 4
- 0
src/pages/statistics/dataReport/index.jsx Dosyayı Görüntüle

@@ -10,6 +10,7 @@ import SourceRole from './components/SourceRole';
10 10
 import UserSex from './components/UserSex';
11 11
 import UserConversion from './components/UserConversion';
12 12
 import BuildingStatistic from './BuildingStatistic';
13
+import CityNums from './CityNums';
13 14
 
14 15
 const DataReport = props => {
15 16
   const [data, setData] = useState([]);
@@ -19,6 +20,9 @@ const DataReport = props => {
19 20
       <div style={{ marginBottom: '20px' }}>
20 21
         <Count></Count>
21 22
       </div>
23
+      <div style={{ marginBottom: '20px' }}>
24
+        <CityNums></CityNums>
25
+      </div>
22 26
       <div style={{ marginBottom: '20px' }}>
23 27
         <Row gutter={16} style={{ textAlign: 'center' }}>
24 28
           <Col span={8}>