许静 5 years ago
parent
commit
6aeb5cc9cc

+ 1
- 1
config/config.js View File

337
 
337
 
338
   proxy: {
338
   proxy: {
339
     '/api/': {
339
     '/api/': {
340
-      target: 'http://localhost:8080/',
340
+      target: 'http://192.168.0.84:8080/',
341
       changeOrigin: true,
341
       changeOrigin: true,
342
       // pathRewrite: { '^/server': '' },
342
       // pathRewrite: { '^/server': '' },
343
     },
343
     },

+ 1
- 0
package.json View File

46
     "antd": "^3.20.0",
46
     "antd": "^3.20.0",
47
     "classnames": "^2.2.6",
47
     "classnames": "^2.2.6",
48
     "dva": "^2.4.1",
48
     "dva": "^2.4.1",
49
+    "echarts": "^4.3.0",
49
     "lodash": "^4.17.11",
50
     "lodash": "^4.17.11",
50
     "md5": "^2.2.1",
51
     "md5": "^2.2.1",
51
     "moment": "^2.24.0",
52
     "moment": "^2.24.0",

+ 49
- 0
src/components/EchartsTest/EChart.jsx View File

1
+import React, { Component } from 'react';
2
+
3
+// 引入 ECharts 主模块
4
+import echarts from 'echarts/lib/echarts';
5
+// 引入柱状图
6
+import  'echarts/lib/chart/bar';
7
+// 引入提示框和标题组件
8
+import 'echarts/lib/component/tooltip';
9
+import 'echarts/lib/component/title';
10
+
11
+class EchartsTest extends Component {
12
+    chartRef = undefined
13
+    chart = undefined
14
+    defaultChartOption = {}
15
+
16
+    componentDidMount() {
17
+        this.chart = echarts.init(this.chartRef.current)
18
+
19
+        // 绘制图表
20
+        this.chart.setOption({
21
+            ...this.defaultChartOption,
22
+            ...this.props.options || {},
23
+        });
24
+    }
25
+
26
+    componentDidUpdate(preProps) {
27
+        if (preProps.options != this.props.options) {
28
+            this.chart.setOption({
29
+                ...this.defaultChartOption,
30
+                ...this.props.options || {},
31
+            });
32
+        }
33
+    }
34
+
35
+    handleDom = ref => this.chartRef = ref
36
+
37
+    render() {
38
+        const style = {
39
+            width: '600px',
40
+            ...this.props.style || {}
41
+        }
42
+
43
+        return (
44
+            <div ref={this.handleDom} style={style}></div>
45
+        );
46
+    }
47
+}
48
+
49
+export default EchartsTest;

+ 37
- 0
src/components/EchartsTest/Line.jsx View File

1
+import React, { useEffect } from 'react';
2
+import EChart from './EChart';
3
+
4
+
5
+const Line = (props) => {
6
+
7
+  const {person_realty_consultant, person_estate_agent, person_null} = xxx
8
+
9
+  const options = {
10
+    xAxis: {},
11
+    legend: {
12
+      left: '70%',
13
+      data: ['来源置业顾问', '来源全民经纪人', '自主进入'],
14
+    },
15
+    series: [
16
+      {
17
+        type: 'pie',
18
+        datasetIndex: 1,
19
+        center: ['75%', '50%'],
20
+        radius: [0, '50%'],
21
+      },
22
+    ],
23
+    dataset: {
24
+      id: 'pie',
25
+      source: [
26
+        { form: '来源置业顾问', value: person_realty_consultant },
27
+        { form: '来源全民经纪人', value: person_estate_agent },
28
+        { form: '自主进入', value: person_null },
29
+      ]
30
+    },
31
+  }
32
+
33
+  return (
34
+    <EChart options={options} />
35
+  )
36
+
37
+}

+ 17
- 0
src/components/EchartsTest/index.jsx View File

1
+import React, { Component } from 'react';
2
+
3
+// 引入 ECharts 主模块
4
+import echarts from 'echarts/lib/echarts';
5
+// 引入柱状图
6
+import  'echarts/lib/chart/bar';
7
+// 引入提示框和标题组件
8
+import 'echarts/lib/component/tooltip';
9
+import 'echarts/lib/component/title';
10
+class Chart extends Component {
11
+
12
+  render() { 
13
+    return ( <div></div> );
14
+  }
15
+}
16
+ 
17
+export default Chart;

+ 17
- 16
src/pages/Welcome.jsx View File

1
 import React from 'react';
1
 import React from 'react';
2
 import { Card, Typography, Alert, Row, Col } from 'antd';
2
 import { Card, Typography, Alert, Row, Col } from 'antd';
3
 import { FormattedMessage } from 'umi-plugin-react/locale';
3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4
-
5
-// const CodePreview = ({ children }) => (
6
-//   <pre
7
-//     style={{
8
-//       background: '#f2f4f5',
9
-//       padding: '12px 20px',
10
-//       margin: '12px 0',
11
-//     }}
12
-//   >
13
-//     <code>
14
-//       <Typography.Text copyable>{children}</Typography.Text>
15
-//     </code>
16
-//   </pre>
17
-// );
18
-
4
+import EchartsTest from '../components/EchartsTest'
5
+const option = {
6
+  xAxis: {
7
+    type: 'category',
8
+    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
9
+  },
10
+  yAxis: {
11
+    type: 'value'
12
+  },
13
+  series: [{
14
+    data: [820, 932, 901, 934, 1290, 1330, 1320],
15
+    type: 'line'
16
+  }]
17
+};
19
 export default () => (
18
 export default () => (
20
   <>
19
   <>
21
     <div style={{ display: 'flex' }}>
20
     <div style={{ display: 'flex' }}>
44
         <span style={{ fontSize: '52px', color: '#fff', marginLeft: '26px', fontFamily: 'fantasy' }}>91</span>
43
         <span style={{ fontSize: '52px', color: '#fff', marginLeft: '26px', fontFamily: 'fantasy' }}>91</span>
45
       </div>
44
       </div>
46
     </div>
45
     </div>
47
-    <div>11111111111111</div>
46
+    <EchartsTest style={{width: 500, height:500}}></EchartsTest>
47
+
48
   </>
48
   </>
49
 );
49
 );
50
+

+ 0
- 1
src/pages/customer/report/index.jsx View File

159
           </Button>
159
           </Button>
160
         </Form.Item>
160
         </Form.Item>
161
       </Form>
161
       </Form>
162
-
163
       <Table dataSource={dataSource.records} columns={columns} pagination={{ total: dataSource.total, onChange }} />
162
       <Table dataSource={dataSource.records} columns={columns} pagination={{ total: dataSource.total, onChange }} />
164
     </>
163
     </>
165
   );
164
   );