许静 5 vuotta sitten
vanhempi
commit
37f562cd90

+ 2
- 4
config/config.js Näytä tiedosto

@@ -416,12 +416,11 @@ export default {
416 416
                 },
417 417
               ],
418 418
             },
419
-
420
-
421 419
             {
422 420
               path: '/indexEcharts',
423 421
               name: '首页报表',
424 422
               component: '../layouts/SecurityLayout',
423
+              hideInMenu: true,
425 424
               routes: [
426 425
                 {
427 426
                   path: '/indexEcharts/index',
@@ -446,8 +445,7 @@ export default {
446 445
                 
447 446
               ],
448 447
             },
449
-            
450
-
448
+          
451 449
             
452 450
             {
453 451
               component: './404',

+ 1
- 1
src/components/EchartsTest/EChart.jsx Näytä tiedosto

@@ -56,7 +56,7 @@ class EchartsTest extends Component {
56 56
         }
57 57
 
58 58
         return (
59
-            <div ref={this.chartRef} style={style}></div>
59
+            <div onClick={this.props.onClick} ref={this.chartRef} style={style}></div>
60 60
         );
61 61
     }
62 62
 }

+ 4
- 0
src/global.less Näytä tiedosto

@@ -95,6 +95,10 @@ ol {
95 95
 .ant-card-body{
96 96
   padding: 0;
97 97
 }
98
+.antd-pro-pages-index-echarts-styles-pie,.antd-pro-pages-index-echarts-styles-bar{
99
+  padding: 0.1rem;
100
+  margin-bottom: 25px;
101
+}
98 102
 .ant-breadcrumb{
99 103
   font-size: 0.1rem;
100 104
   .anticon {

+ 11
- 8
src/pages/Welcome.jsx Näytä tiedosto

@@ -2,7 +2,8 @@ import React from 'react';
2 2
 import { Card, Typography, Alert, Row, Col } from 'antd';
3 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4 4
 import EchartsTest from '../components/EchartsTest';
5
-import CityNums from './charts/CityNums';
5
+import IndexEcharts from './indexEcharts/index';
6
+import router from 'umi/router';
6 7
 
7 8
 const option = {
8 9
   xAxis: {
@@ -20,7 +21,7 @@ const option = {
20 21
 
21 22
 export default () => (
22 23
   <>
23
-    <div style={{ display: 'flex' }}>
24
+    <div style={{ display: 'flex',marginBottom:'28px' }}>
24 25
       <div style={{
25 26
         textAlign: 'center', display: 'flex', justifyContent: 'center', lineHeight: '100px', background: 'linear-gradient(144deg,rgba(241,43,62,1) 0%,rgba(254,144,155,1) 100%)', height: '100px',
26 27
         boxShadow: '0px  0.11rem 14px -15px rgba(241,43,62,1)',
@@ -37,17 +38,19 @@ export default () => (
37 38
         <span style={{ fontSize: '24px', color: '#fff' }}>总注册用户 </span>
38 39
         <span style={{ fontSize: '52px', color: '#fff', marginLeft: '26px', fontFamily: 'fantasy' }}>12</span>
39 40
       </div>
40
-      <div style={{
41
-        textAlign: 'center', display: 'flex', justifyContent: 'center', lineHeight: '100px', background: 'linear-gradient(137deg,rgba(107,130,230,1) 0%,rgba(152,175,251,1) 100%)', height: '100px',
41
+      <div onClick={()=>router.push('/indexEcharts/newUsers')} style={{
42
+        textAlign: 'center', display: 'flex', justifyContent: 'center', background: 'linear-gradient(137deg,rgba(107,130,230,1) 0%,rgba(152,175,251,1) 100%)', height: '100px',
42 43
         boxShadow: '0px  0.11rem 14px -15px rgba(107,130,230,1)',
43 44
         borderRadius: '12px', width: '32%',
44 45
       }}>
45
-        <span style={{ fontSize: '24px', color: '#fff' }}>最近7天新增 </span>
46
-        <span style={{ fontSize: '52px', color: '#fff', marginLeft: '26px', fontFamily: 'fantasy' }}>91</span>
46
+        <span style={{ fontSize: '24px', color: '#fff',borderBottom:'1px solid #fff',margin:'30px 0' }}>最近7天新增 </span>
47
+        <span style={{ fontSize: '52px', color: '#fff', marginLeft: '26px', fontFamily: 'fantasy', lineHeight: '100px' }}>91</span>
47 48
       </div>
48 49
     </div>
49
-    <EchartsTest style={{width: 500, height:500}}></EchartsTest>
50
-    <CityNums></CityNums>
50
+    <IndexEcharts style={{ width: '100%'}}></IndexEcharts>
51
+
52
+    {/* <EchartsTest style={{ width: 500, height: 500 }}></EchartsTest> */}
53
+
51 54
   </>
52 55
 );
53 56
 

+ 1
- 1
src/pages/charts/CityNums.jsx Näytä tiedosto

@@ -128,7 +128,7 @@ const CityNums = (props) => {
128 128
   }
129 129
 
130 130
   return (
131
-    <div style={{ margin: '24px 0', width: '100%', borderRadius: '8px', boxShadow: '0px 0px 9px 1px rgba(0,0,0,0.12)', overflow: 'hidden' }}>
131
+    <div style={{ margin: ' 0 0 20px  0', width: '100%', borderRadius: '8px', boxShadow: '0px 0px 9px 1px rgba(0,0,0,0.12)', overflow: 'hidden' }}>
132 132
       <Echart options={options} style={{ width: '100%', height: '600px' }} ></Echart>
133 133
     </div>
134 134
   )

+ 2
- 7
src/pages/indexEcharts/components/IntentionalCustomers.jsx Näytä tiedosto

@@ -77,25 +77,20 @@ const UserBehavior = (props) => {
77 77
     },
78 78
   ];
79 79
 
80
-
81 80
   function handleBuildingChange (e) {
82 81
     IntentionUsers({ buildingId: e })
83
-
84 82
   }
85 83
   return (
86 84
     <>
87 85
       <div>
88
-        <h3>意向客户</h3>
86
+      <p style={{fontSize:'0.12rem',fontWeight:'600'}}>意向客户</p>
89 87
 
90 88
         <BuildSelect slot='action' onChange={(e => handleBuildingChange(e))}></BuildSelect>
91 89
 
92
-        <Table dataSource={data.records} columns={columns} pagination={false} scroll={{ y: 500 }} />
93
-
90
+        <Table dataSource={data.records} columns={columns} style={{marginTop:'15px'}} pagination={false} scroll={{ y: 500 }} />
94 91
 
95 92
       </div>
96 93
 
97
-
98
-
99 94
     </>
100 95
   )
101 96
 }

+ 4
- 51
src/pages/indexEcharts/components/NewUsers.jsx Näytä tiedosto

@@ -6,7 +6,6 @@ import apis from '../../../services/apis';
6 6
 import moment from 'moment';
7 7
 import router from 'umi/router';
8 8
 import { Table, Select, Row, Col, Menu, Dropdown, Button, Icon, message } from 'antd';
9
-// import UserSource from './mmm';
10 9
 
11 10
 import styles from '../styles.less'
12 11
 const formatDate = (start, end) => {
@@ -15,7 +14,6 @@ const formatDate = (start, end) => {
15 14
   return { startDate, endDate }
16 15
 }
17 16
 const NewUsers = (props) => {
18
-  //  console.log(props,'999999999999')
19 17
   const [data, setData] = useState({ records: [] })
20 18
 
21 19
 
@@ -23,21 +21,6 @@ const NewUsers = (props) => {
23 21
     NewsUserCount(formatDate(props.startDate, props.endDate))
24 22
   }, [props.startDate, props.endDate])
25 23
 
26
-  // getNewsUserCount ({ commit }, payload) {
27
-  //   return new Promise((resolve, reject) => {
28
-  //     request({
29
-  //       ...apis.indexEcharts.newUser,
30
-  //       params: payload,
31
-  //     }).then((data) => {
32
-  //       resolve(data.selectNewsUserCount)
33
-  //     }).catch((err) => {
34
-  //       const message = err.message || err.msg
35
-  //       if (typeof message === 'string') {
36
-  //         reject(message)
37
-  //       }
38
-  //     })
39
-  //   })
40
-  // },
41 24
 
42 25
   function NewsUserCount (params) {
43 26
     request({
@@ -61,7 +44,6 @@ const NewUsers = (props) => {
61 44
       end: 100
62 45
     },
63 46
   ] : undefined 
64
-  // //  show: false
65 47
   const dataset = (data.selectNewsUserCount) || []
66 48
   const options = {
67 49
 
@@ -84,10 +66,12 @@ const NewUsers = (props) => {
84 66
         {
85 67
           name: "新用户数",
86 68
           type: "line",
69
+          smooth:true, 
87 70
         },
88 71
         {
89 72
           name: "授权注册",
90 73
           type: "line",
74
+          smooth:true, 
91 75
         }
92 76
       ],
93 77
       dataset: {
@@ -100,50 +84,19 @@ const NewUsers = (props) => {
100 84
   }
101 85
 
102 86
 
103
-  // function onChange (value) {
104
-  //   UserActive({ dateType: value })
105
-  // }
106
-
107
-
108 87
   const piestyles = {
109 88
     width: '100%',
110 89
     height: '400px',
111
-
112 90
   }
113 91
 
114
-
115 92
   return (
116 93
     <>
117 94
       <div>
118
-
119
-
120 95
         <div >
121
-          <h3>新增用户</h3>
122
-
123
-
124
-          {/* <Select
125
-            showSearch
126
-            style={{ width: 100 }}
127
-            placeholder="日活跃"
128
-            optionFilterProp="children"
129
-            onChange={onChange}
130
-            
131
-          >
132
-            <Option value="day">日活跃</Option>
133
-            <Option value="month">月活跃</Option>
134
-
135
-          </Select>
136
-         */}
96
+          <p onClick={()=>router.push('/indexEcharts/newUsers')}><span style={{borderBottom:'1px solid #f02d40',fontSize:'0.12rem',fontWeight:'600'}}>新增用户</span> <span style={{fontSize:'0.09rem',color:'#888',marginLeft:'0.06rem'}}>最近七天</span></p>
137 97
        </div>
138
-
139
-
140
-        <EChart options={options} style={piestyles} />
98
+        <EChart options={options} style={piestyles} onClick={()=>router.push('/indexEcharts/newUsers')} />
141 99
       </div>
142
-
143
-
144
-
145
-
146
-
147 100
     </>
148 101
   )
149 102
 }

+ 4
- 26
src/pages/indexEcharts/components/UserActive.jsx Näytä tiedosto

@@ -15,7 +15,6 @@ const formatDate = (start, end) => {
15 15
   return { startDate, endDate }
16 16
 }
17 17
 const UserSource = (props) => {
18
-  //  console.log(props,'999999999999')
19 18
   const [data, setData] = useState({ records: [] })
20 19
   //柱图
21 20
 
@@ -23,18 +22,6 @@ const UserSource = (props) => {
23 22
     UserActive({ dateType: 'day' })
24 23
   }, [])
25 24
 
26
-  //  getUserActive({ commit }, payload) {
27
-  //   return new Promise((resolve, reject) => {
28
-  //     request({
29
-  //       ...apis.indexEcharts.userActive,
30
-  //       params: { pageSize: 9999, ...payload }
31
-  //     }).then((data) => {
32
-  //       resolve(data.selectActiveUserCount)
33
-  //     }).catch((err) => {
34
-  //       reject(err)
35
-  //     })
36
-  //   })
37
-  // },
38 25
 
39 26
 
40 27
   function UserActive (params) {
@@ -42,21 +29,18 @@ const UserSource = (props) => {
42 29
       ...apis.indexEcharts.userActive,
43 30
       params: { pageSize: 9999, ...params },
44 31
     }).then((data) => {
45
-      // console.log(data, '3333')
32
+  
46 33
       setData(data)
47 34
     })
48 35
   }
49
-  //  show: false
36
+
50 37
   const dataset = (data.selectActiveUserCount) || []
51 38
   const options = {
52
-    // legend: { },
53
-    // color: ['#8954BA', '#175DFB', '#0BB963', '#27DEFF', '#E713D2', '#E71313'],
39
+
54 40
     tooltip: {},
55 41
     xAxis: { type: 'category' },
56 42
     yAxis: {},
57
-    // orient: 'horizontal',
58 43
     series: {
59
-      // orient: 'horizontal',
60 44
       type: 'bar',
61 45
       name: '活跃用户',
62 46
       barWidth: 50,
@@ -98,8 +82,7 @@ const UserSource = (props) => {
98 82
 
99 83
 
100 84
         <div >
101
-          <h3>用户活跃数</h3>
102
-
85
+        <p><span style={{fontSize:'0.12rem',fontWeight:'600'}}>用户活跃数</span></p>
103 86
 
104 87
           <Select
105 88
             showSearch
@@ -107,7 +90,6 @@ const UserSource = (props) => {
107 90
             placeholder="日活跃"
108 91
             optionFilterProp="children"
109 92
             onChange={onChange}
110
-            
111 93
           >
112 94
             <Option value="day">日活跃</Option>
113 95
             <Option value="month">月活跃</Option>
@@ -120,10 +102,6 @@ const UserSource = (props) => {
120 102
         <EChart options={options} style={piestyles} />
121 103
       </div>
122 104
 
123
-
124
-
125
-
126
-
127 105
     </>
128 106
   )
129 107
 }

+ 8
- 30
src/pages/indexEcharts/components/UserBehavior.jsx Näytä tiedosto

@@ -1,5 +1,4 @@
1 1
 import React, { Component, useState, useEffect } from 'react';
2
-
3 2
 import EChart from '../../../components/EchartsTest/EChart';
4 3
 import request from '../../../utils/request';
5 4
 import apis from '../../../services/apis';
@@ -17,7 +16,6 @@ const formatDate = (start, end) => {
17 16
   return { startDate, endDate }
18 17
 }
19 18
 const UserBehavior = (props) => {
20
-// console.log(props,'11111111')
21 19
 
22 20
 const [data, setData] = useState({ records: [] })
23 21
   const [datas, setDatas] = useState({ records: [] })
@@ -39,17 +37,10 @@ const [data, setData] = useState({ records: [] })
39 37
       params
40 38
     }).then((data) => {
41 39
       setData(data || {})
42
-      // props.onReData(data)
43
-      // console.log(data || {}, '2134')
40
+
44 41
     })
45 42
   }
46
-  // showDetail (row) {
47
-  //   this.detailData = []
48
-  //   this.dialogVisible = true
49
-  //   this.getUserBehaviorProfile().then((data) => {
50
-  //     this.detailData = data
51
-  //   })
52
-
43
+  
53 44
   function getUserBehaviorProfile (row) {
54 45
 
55 46
     setData([])
@@ -58,13 +49,10 @@ const [data, setData] = useState({ records: [] })
58 49
       params:{ event: row.event, personId: row.personId }
59 50
     }).then((data) => {
60 51
 
61
-      
62 52
       setData(data )
63
-      // props.onReData(data)
64
-      // console.log(data , '22354234')
53
+     
65 54
     })
66 55
 
67
-
68 56
   }
69 57
   
70 58
     const seriesMaker = (data.selectUserBehavior || []).reduce((series, item) => {
@@ -94,18 +82,11 @@ const [data, setData] = useState({ records: [] })
94 82
     
95 83
   
96 84
     const options = {
97
-    title:  {
98
-        text: '用户行为',
99
-        subtext: '最近7天',
100
-      },
85
+    title:  {},
101 86
       icon: "rect",
102 87
       legend: {
103 88
          show: true, zlevel: 10 ,
104 89
          itemGap:100,
105
-        //  data:[{
106
-        //   //  name:'',
107
-        //   icon: 'rect',
108
-        //  }]
109 90
       },
110 91
       color: ['#F12B3E', '#FE929C', '#647CE1', '#A2B9FF', '#FF844F', '#FFBB9D'],
111 92
       tooltip: {
@@ -117,6 +98,7 @@ const [data, setData] = useState({ records: [] })
117 98
       series: Object.keys(seriesMaker).map(x => {
118 99
         return {
119 100
           type: 'line',
101
+          smooth:true, 
120 102
           name: x,
121 103
           data: seriesMaker[x],
122 104
         }
@@ -133,20 +115,16 @@ const [data, setData] = useState({ records: [] })
133 115
 
134 116
   }
135 117
 
136
-
137
-
138 118
   return (
139 119
     <>
140 120
       <div>
141 121
         {/* onSuccess={(e) => onTabledatas(e)} */}
142
-      <BuildSelect slot='action' onChange={(e=>handleBuildingChange(e))}></BuildSelect>
143
-      <EChart  options={options} style={style} />
122
+        <p onClick={()=>router.push('/indexEcharts/userBehavior')}><span style={{borderBottom:'1px solid #f02d40',color:'#333',fontSize:'0.12rem',fontWeight:'600'}}>用户行为</span> <span style={{fontSize:'0.09rem',color:'#888',marginLeft:'0.06rem'}}>最近七天</span></p>
123
+      <div style={{float:'right',marginTop:'-40px',marginBottom:'20px'}}><BuildSelect slot='action' onChange={(e=>handleBuildingChange(e))}></BuildSelect></div>
124
+      <EChart onClick={()=>router.push('/indexEcharts/userBehavior')}  options={options} style={style} />
144 125
 
145
- 
146 126
       </div>
147 127
 
148
-
149
-
150 128
     </>
151 129
   )
152 130
 }

+ 39
- 85
src/pages/indexEcharts/components/UserConversion.jsx Näytä tiedosto

@@ -6,68 +6,33 @@ import apis from '../../../services/apis';
6 6
 import moment from 'moment';
7 7
 import router from 'umi/router';
8 8
 import { Table, Select, Row, Col, Menu, Dropdown, Button, Icon, message } from 'antd';
9
-// import UserSource from './mmm';
10 9
 
11 10
 import styles from '../styles.less'
12 11
 
13
-const formatDate = (start, end) => {
14
-  const startDate = moment(start).format('YYYY-MM-DDT00:00:00.000') + 'Z'
15
-  const endDate = moment(end).format('YYYY-MM-DDT23:59:59.999') + 'Z'
16
-  return { startDate, endDate }
17
-}
18 12
 
19 13
 const UserSource = (props) => {
20 14
 
21 15
   const [data, setData] = useState({ records: [] })
22 16
   const [theStatis, settheStatis] = useState({ records: [] })
23
- 
24 17
   const [theCurrent, settheCurrent] = useState({ records: [] })
25
-  const endDate = new Date()
26
-  const startDate = moment().subtract(7, 'day').toDate()
27
- 
28
-  // const theStatis = 'authorization_phone'
18
+
29 19
   useEffect(() => {
30
-    settheStatis('authorization_phone')
31
-    // UserConversionRate({ conversion: theStatis }).then(setDataset)
20
+    UserConversionRate({conversion: 'authorization_phone'})
32 21
   }, [])
33 22
 
34
-  // function UserConversionRate (params) {
35
-  //   console.log(params, '1111111')
36
-  //   request({
37
-  //     ...apis.indexEcharts.userConversion,
38
-  //     params,
39
-  //   }).then((data) => {
40
-
41
-  //     setData(data)
42
-  //     console.log(data, '000000')
43
-  //   }).then
44
-  // }
45
-  
46
- function UserConversionRate(_, payload) {
47
-    return new Promise((resolve, reject) => {
23
+ function UserConversionRate(params) {
48 24
       request({
49 25
         ...apis.indexEcharts.userConversion,
50
-        params: payload,
26
+        params,
51 27
       }).then((data) => {
52
-        resolve(data)
53
-      })
54
-    })
28
+        console.log(data,"data")
29
+        setData(data)
30
+      }) 
55 31
   }
56
-  // const dataset = (data.selectSexUser) || []
57
-  // console.log(dataset, '000000')
58
-  const statisTypes=[
59
-    { label: '授权手机', value: 'authorization_phone' },
60
-    { label: '项目收藏', value: 'building_save' },
61
-    { label: '项目转发', value: 'building_share' },
62
-    { label: '活动收藏', value: 'activity_save' },
63
-    { label: '活动转发', value: 'activity_share' },
64
-    { label: '资讯收藏', value: 'news_save' },
65
-    { label: '资讯转发', value: 'news_share' },
66
-    { label: '活动报名', value: 'activity_sign' },
67 32
 
68
-  ]
69
-// const theCurrent = []
33
+
70 34
  function setDataset(data) {      
35
+ 
71 36
     const { pvNum, ...other } = data['data_count']
72 37
 
73 38
     // 获取第一个值
@@ -77,12 +42,11 @@ const UserSource = (props) => {
77 42
       break
78 43
     }
79 44
 
80
-
81 45
     if (pvNum < num) {
82 46
       theCurrent = []
83 47
     } else {
84 48
       theCurrent = [
85
-        { name: getStatisName(), value: num },
49
+        { name: this.getStatisName(), value: num },
86 50
         { name: '其余', value: pvNum - num },
87 51
       ]
88 52
     }
@@ -91,10 +55,19 @@ const UserSource = (props) => {
91 55
   }
92 56
 
93 57
   function getStatisName() {
94
-    return statisTypes.filter(x => x.value === theStatis)[0].label
95
-  }
58
+     const statisTypes=[
59
+    { label: '授权手机', value: 'authorization_phone' },
60
+    { label: '项目收藏', value: 'building_save' },
61
+    { label: '项目转发', value: 'building_share' },
62
+    { label: '活动收藏', value: 'activity_save' },
63
+    { label: '活动转发', value: 'activity_share' },
64
+    { label: '资讯收藏', value: 'news_save' },
65
+    { label: '资讯转发', value: 'news_share' },
66
+    { label: '活动报名', value: 'activity_sign' },
96 67
 
97
-  // getStatisName() {
68
+  ]
69
+    return statisTypes.filter(x => x.value == theStatis)[0].label
70
+  }
98 71
  
99 72
   const options = {
100 73
     legend: {},
@@ -103,27 +76,16 @@ const UserSource = (props) => {
103 76
     series: {
104 77
       type: 'pie',
105 78
       name: '转化率',
106
-      radius: ['50%', '70%'],
107
-      data: theCurrent
79
+      radius: ['34%', '52%'],
80
+      data:[ { name: '授权手机', value: 6 },
81
+      { name: '其余', value: 6 },]
108 82
     }
109 83
     
110
-      
111
-    
112
-
113 84
   }
114
-  // statisTypes: [
115
-  //   { label: '授权手机', value: 'authorization_phone' },
116
-  //   { label: '项目收藏', value: 'building_save' },
117
-  //   { label: '项目转发', value: 'building_share' },
118
-  //   { label: '活动收藏', value: 'activity_save' },
119
-  //   { label: '活动转发', value: 'activity_share' },
120
-  //   { label: '资讯收藏', value: 'news_save' },
121
-  //   { label: '资讯转发', value: 'news_share' },
122
-  //   { label: '活动报名', value: 'activity_sign' },
123
-
124
-  // ],
125
-  function onChange (value) {
126
-
85
+  
86
+  function onChange (e) {
87
+    UserConversionRate({conversion: e})
88
+    
127 89
   }
128 90
 
129 91
   const piestyles = {
@@ -136,36 +98,28 @@ const UserSource = (props) => {
136 98
   return (
137 99
     <>
138 100
       <div>
139
-        <h3>转化率</h3>
101
+      <p style={{fontSize:'0.12rem',fontWeight:'600'}}>转化率</p>
140 102
 
141 103
         <Select
142
-          showSearch
143 104
           style={{ width: 200 }}
144 105
           placeholder="授权手机"
145
-          optionFilterProp="children"
146 106
           onChange={onChange}
147
-
148 107
         >
149
-          <Option value="authorization_phone">授权手机</Option>
150
-          <Option value="building_save">项目收藏</Option>
151
-          <Option value="building_share">项目转发</Option>
152
-          <Option value="activity_save">活动收藏</Option>
153
-          <Option value="activity_share">活动转发</Option>
154
-          <Option value="news_save">资讯收藏</Option>
155
-          <Option value="news_share">资讯转发</Option>
156
-          <Option value="activity_sign">活动报名</Option>
108
+          <Select.Option value="authorization_phone">授权手机</Select.Option>
109
+          <Select.Option value="building_save">项目收藏</Select.Option>
110
+          <Select.Option value="building_share">项目转发</Select.Option>
111
+          <Select.Option value="activity_save">活动收藏</Select.Option>
112
+          <Select.Option value="activity_share">活动转发</Select.Option>
113
+          <Select.Option value="news_save">资讯收藏</Select.Option>
114
+          <Select.Option value="news_share">资讯转发</Select.Option>
115
+          <Select.Option value="activity_sign">活动报名</Select.Option>
157 116
         </Select>
158
-        {/* <EChart options={options} style={piestyles} /> */}
159
-
160
-
117
+        <EChart options={options} style={piestyles} />
161 118
 
162 119
 
163 120
       </div>
164 121
 
165 122
 
166
-
167
-
168
-
169 123
     </>
170 124
   )
171 125
 }

+ 5
- 32
src/pages/indexEcharts/components/UserSex.jsx Näytä tiedosto

@@ -6,7 +6,6 @@ import apis from '../../../services/apis';
6 6
 import moment from 'moment';
7 7
 import router from 'umi/router';
8 8
 import { Table, Select, Row, Col, Menu, Dropdown, Button, Icon, message } from 'antd';
9
-// import UserSource from './mmm';
10 9
 
11 10
 import styles from '../styles.less'
12 11
 
@@ -22,7 +21,6 @@ const UserSource = (props) => {
22 21
   const endDate = new Date()
23 22
   const startDate = moment().subtract(7, 'day').toDate()
24 23
 
25
-
26 24
   useEffect(() => {
27 25
     UserSex(formatDate(startDate, endDate))
28 26
   }, [])
@@ -32,59 +30,34 @@ const UserSource = (props) => {
32 30
       ...apis.indexEcharts.userSex,
33 31
       params,
34 32
     }).then((data) => {
35
-
36 33
       setData(data)
37
-      // console.log(data, '000000')
38 34
     })
39 35
   }
40 36
 
41
-
42 37
   const dataset = (data.selectSexUser) || []
43
-  // console.log(dataset, '000000')
38
+ 
44 39
   const options = {
45 40
     title: {
46 41
       text: '性别比例'
47 42
     },
48 43
     legend: {},
49
-    color: ['#FF7E48', '#FFC1A4'],
44
+    color: ['#FF7E48', '#dcdcdc'],
50 45
     tooltip: {},
51
-    
52
-    // label: { //  饼图图形上的文本标签
53
-
54
-    //   normal: { // normal 是图形在默认状态下的样式
55
-    //     show: true,
56
-    //     position: 'center',
57
-    //     color: 'red',
58
-    //     fontSize: 18,
59
-    //     fontWeight: 'bold',
60
-    //     formatter: '12' // {b}:数据名; {c}:数据值; {d}:百分比,可以自定义显示内容,
61
-    //   }
62
-    // },
63 46
     series: {
64 47
       type: 'pie',
65 48
       name: '性别比例',
66
-      // radius: ['50%', '70%'],
67
-      center: ['50%', '65%'],
68
-
69
-        radius: ['40%', '60%'],
49
+      center: ['44%', '65%'],
50
+      radius: ['34%', '52%'],
70 51
       data:
71 52
         dataset,
72
-
73
-
74
-
75
-
76 53
     }
77
-    // series: {
78
-    //   ...this.defaultOpt.series,
79
-    //   data: this.dataset || [],
80
-
81
-    // },
82 54
   }
83 55
 
84 56
 
85 57
   const piestyles = {
86 58
     width: '100%',
87 59
     height: '400px',
60
+    minWidth:'350px'
88 61
 
89 62
   }
90 63
 

+ 9
- 43
src/pages/indexEcharts/components/UserSource.jsx Näytä tiedosto

@@ -6,11 +6,9 @@ import apis from '../../../services/apis';
6 6
 import moment from 'moment';
7 7
 import router from 'umi/router';
8 8
 import { Table, Select, Row, Col, Menu, Dropdown, Button, Icon, message } from 'antd';
9
-// import UserSource from './mmm';
10 9
 
11 10
 import styles from '../styles.less'
12 11
 
13
-
14 12
 const formatDate = (start, end) => {
15 13
   const startDate = moment(start).format('YYYY-MM-DDT00:00:00.000') + 'Z'
16 14
   const endDate = moment(end).format('YYYY-MM-DDT23:59:59.999') + 'Z'
@@ -18,51 +16,31 @@ const formatDate = (start, end) => {
18 16
 }
19 17
 
20 18
 const UserSource = (props) => {
21
-// console.log(props,'---------')
22 19
   const [data, setData] = useState({ records: [] })
23 20
   //柱图
24
-
25 21
   useEffect(() => {
26
-   userResource(formatDate(props.startDate, props.endDate))
22
+    userResource(formatDate(props.startDate, props.endDate))
27 23
   }, [props.startDate, props.endDate])
28 24
 
29
-  function userResource (params) {
25
+  function userResource(params) {
30 26
     request({
31 27
       ...apis.indexEcharts.userResource,
32 28
       params,
33 29
     }).then((data) => {
34
-      // console.log(data , '3333')
35 30
       setData(data)
36 31
       props.onSuccess(data)
37 32
     })
38 33
   }
39 34
 
40
-  function toEdit () {
41
-    router.push({
42
-      pathname: '/indexEcharts/userSource',
43
-      // query: {
44
-      //   a: 'b',
45
-      // },
46
-    });
47
-  }
48
-
49 35
   const dataset = data || {};
50 36
   const source = dataset.columnar || [];
51
-
52
-  // const source = this.dataset.columnar || [];
53 37
   const subtitle = '最近7天';
54 38
   const baroptions = {
55
-    title: {
56
-      text: '用户来源',
57
-      subtext: '最近7天',
58
-    },
59
-    // color: ['#286DD0', '#8565CE', '#6A96F8', '#F5749E', '#8B7FE2'],
39
+    title: { },
60 40
     xAxis: { type: 'category' },
61 41
     legend: {
62 42
       left: '20%',
63 43
       data: ['所有用户', '注册用户']
64
-      // itemWidth: '24px',
65
-      // itemHeight:'24px',
66 44
     },
67 45
 
68 46
     tooltip: {},
@@ -106,8 +84,6 @@ const UserSource = (props) => {
106 84
           }
107 85
         }
108 86
 
109
-
110
-
111 87
       },
112 88
     ],
113 89
     dataset: {
@@ -115,33 +91,23 @@ const UserSource = (props) => {
115 91
       dimensions: ['fromName', 'userCount', 'registered'],
116 92
       source: source,
117 93
     },
118
-
119 94
   }
120 95
 
121
-  function handleSelectChange (e) {
122
-    // eslint-disable-next-line no-console
123
-    // console.log(e)
124
-  }
125
-
126
-
127
-
128
-
129 96
 
130 97
   const barstyle = {
131
-    width: '1000px',
98
+    width: '100%',
132 99
     height: '480px',
133
-
100
+    minWidth: '400px'
134 101
   }
135 102
 
136
-
137 103
   return (
138 104
     <>
139 105
       <div>
140
-    
141
-        <EChart options={baroptions} style={barstyle} />
142
- 
143
-      </div>
106
+      <p onClick={()=>router.push('/indexEcharts/userSource')}><span style={{borderBottom:'1px solid #f02d40',color:'#333',fontSize:'0.12rem',fontWeight:'600'}}>用户来源</span> <span style={{fontSize:'0.09rem',color:'#888',marginLeft:'0.06rem'}}>最近七天</span></p>
144 107
 
108
+        <EChart onClick={() => router.push('/indexEcharts/userSource')} options={baroptions} style={barstyle} />
109
+
110
+      </div>
145 111
 
146 112
     </>
147 113
   )

+ 9
- 101
src/pages/indexEcharts/components/UserSourcepie.jsx Näytä tiedosto

@@ -6,7 +6,6 @@ import apis from '../../../services/apis';
6 6
 import moment from 'moment';
7 7
 import router from 'umi/router';
8 8
 import { Table, Select, Row, Col, Menu, Dropdown, Button, Icon, message } from 'antd';
9
-// import UserSource from './mmm';
10 9
 
11 10
 import styles from '../styles.less'
12 11
 const formatDate = (start, end) => {
@@ -15,9 +14,8 @@ const formatDate = (start, end) => {
15 14
   return { startDate, endDate }
16 15
 }
17 16
 const UserSource = (props) => {
18
-  //  console.log(props,'999999999999')
19 17
   const [data, setData] = useState({ records: [] })
20
-  //柱图
18
+
21 19
 
22 20
   useEffect(() => {
23 21
     userResource(formatDate(props.startDate, props.endDate))
@@ -28,7 +26,6 @@ const UserSource = (props) => {
28 26
        ...apis.indexEcharts.userResource,
29 27
        params,
30 28
      }).then((data) => {
31
-      //  console.log(data , '3333')
32 29
        setData(data)
33 30
      })
34 31
    }
@@ -36,124 +33,43 @@ const UserSource = (props) => {
36 33
   function toEdit () {
37 34
     router.push({
38 35
       pathname: '/indexEcharts/userSource',
39
-      // query: {
40
-      //   a: 'b',
41
-      // },
42 36
     });
43 37
   }
44 38
 
45 39
   const dataset = data || {};
46 40
 
47 41
 
48
-
49
-
50
-
51 42
   const { person_estate_agent = 0, person_null = 0, person_realty_consultant = 0 } = dataset.pie || {};
52 43
   const pieoptions = {
53
-    // xAxis: {},
54 44
     color: ['#6B82E6', '#F02D40', '#FF834E'],
55 45
     legend: {
56
-      // left: '70%',
57 46
       orient: 'vertical',
58 47
       x: 'left',
59 48
       data: ['来源置业顾问', '来源全民经纪人', '自主进入'],
60
-      
61 49
     },
62
-    tooltip: {
63
-
64
-    },
65
-    // yAxis: {},
66
-
50
+    tooltip: {},
67 51
     series: [
68 52
       {
69 53
         type: 'pie',
70
-        // datasetIndex: 1,
71
-        center: ['50%', '65%'],
72
-
73
-        radius: ['40%', '60%'],
74
-       
75
-        // itemStyle: {
76
-        //   normal: {
77
-          
78
-        //     color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
79
-        //       offset: 0,
80
-        //       color: '#FFC4A8'
81
-        //     }, {
82
-        //       offset: 1,
83
-        //       color: '#FF7E49'
84
-        //     }]),
85
-        //   },
86
-  
87
-        // }
88
-     
54
+        center: ['44%', '65%'],
55
+        radius: ['34%', '52%'],
89 56
       },
90
-      // {
91
-        
92
-       
93
-       
94
-      //   itemStyle: {
95
-      //     normal: {
96
-          
97
-      //       color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
98
-      //         offset: 0,
99
-      //         color: '#214318'
100
-      //       }, {
101
-      //         offset: 1,
102
-      //         color: '#543E49'
103
-      //       }]),
104
-      //     },
105
-  
106
-      //   }
107
-     
108
-      // }
109
-      // {
110
-
111
-      //   itemStyle: {
112
-      //     normal: {
113
-          
114
-      //       color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
115
-      //         offset: 0,
116
-      //         color: '#FFC4A8'
117
-      //       }, {
118
-      //         offset: 1,
119
-      //         color: '#FF7E49'
120
-      //       }]),
121
-      //     }
122
-
123
-      // }
124
-
125
-
126 57
     ],
127 58
     dataset: {
128 59
       id: 'pie',
129 60
       source: [
130
-        {
131
-          form: '来源置业顾问', value: person_realty_consultant,
132
-        },
133
-        { form: '来源全民经纪人', value: person_estate_agent },
134
-        { form: '自主进入', value: person_null },
61
+        { '用户来源': '来源置业顾问', value: person_realty_consultant,},
62
+        { '用户来源': '来源全民经纪人', value: person_estate_agent },
63
+        { '用户来源': '自主进入', value: person_null },
135 64
       ]
136 65
     },
137
-
138
-
139
-
140
-
141
-
142 66
   }
143
-  function handleSelectChange (e) {
144
-    // eslint-disable-next-line no-console
145
-    // console.log(e)
146
-  }
147
-
148
-
149
-
150
-
151
-
67
+ 
152 68
 
153 69
   const piestyles = {
154 70
     width: '100%',
155 71
     height: '400px',
156
-
72
+    minWidth:'350px',
157 73
   }
158 74
 
159 75
 
@@ -161,18 +77,10 @@ const UserSource = (props) => {
161 77
     <>
162 78
       <div>
163 79
 
164
-
165
-
166
-
167
-
168 80
         <EChart options={pieoptions} style={piestyles} />
169 81
 
170 82
       </div>
171 83
 
172
-
173
-
174
-
175
-
176 84
     </>
177 85
   )
178 86
 }

+ 10
- 11
src/pages/indexEcharts/index.jsx Näytä tiedosto

@@ -1,13 +1,9 @@
1 1
 
2 2
 import React, { useState, useEffect } from 'react';
3 3
 import { Form, Input, Button, Icon, Select, message, Table, Divider, Row, Col, Tag, Pagination, Modal, DatePicker } from 'antd';
4
-
5
-// import styles from '../../style/GoodsList.less';
6 4
 import router from 'umi/router';
7
-
8 5
 import request from '../../utils/request'
9 6
 import apis from '../../services/apis';
10
-// import Styles from './style.less';/
11 7
 import UserSource from './components/UserSource.jsx';
12 8
 import UserSourcepie from './components/UserSourcepie.jsx';
13 9
 import UserBehavior from './components/UserBehavior.jsx';
@@ -18,28 +14,32 @@ import UserConversion from './components/UserConversion'
18 14
 import IntentionalCustomers from './components/IntentionalCustomers'
19 15
 import styles from './styles.less'
20 16
 import moment from 'moment';
21
-const header = (props) => {
17
+import CityNums from '../charts/CityNums';
18
+const indexEcharts = (props) => {
22 19
 
23 20
   const endDate = new Date()
24 21
 
25 22
   //为了观察数据先设30天
26
-  const startDate = moment().subtract(30, 'day').toDate()
23
+  const startDate = moment().subtract(7, 'day').toDate()
27 24
 
28 25
   function onTabledatas (e) {
29 26
 
30 27
   }
28
+  
31 29
   return (
32 30
 
33 31
     <>
34
-      {/* <div>2222</div> */}
35
-      <div style={{ display: 'flex' }}>
32
+      <div style={{ display: 'flex',width:'100%' }}>
36 33
         <div className={styles.bar}>
37
-          <UserSource endDate={endDate} startDate={startDate} onSuccess={(e) => onTabledatas(e)}></UserSource>
34
+          <UserSource endDate={endDate}  startDate={startDate} onSuccess={(e) => onTabledatas(e)}></UserSource>
38 35
         </div>
39 36
         <div className={styles.pie}>
40 37
           <UserSourcepie endDate={endDate} startDate={startDate}></UserSourcepie>
41 38
         </div>
42 39
       </div>
40
+      <div>
41
+      <CityNums></CityNums>
42
+      </div>
43 43
       <div className={styles.behavior}>
44 44
         <UserBehavior endDate={endDate} startDate={startDate} dataZoom={false}></UserBehavior>
45 45
       </div>
@@ -53,7 +53,6 @@ const header = (props) => {
53 53
       <div style={{ display: 'flex' }}>
54 54
         <div className={styles.bar}>
55 55
           <NewUsers endDate={endDate} startDate={startDate} dataZoom={false}></NewUsers>
56
-
57 56
         </div>
58 57
         <div className={styles.pie}><UserConversion></UserConversion> </div>
59 58
       </div >
@@ -66,4 +65,4 @@ const header = (props) => {
66 65
 }
67 66
 
68 67
 
69
-export default header
68
+export default indexEcharts

+ 2
- 11
src/pages/indexEcharts/newUsers.jsx Näytä tiedosto

@@ -28,7 +28,7 @@ const header = props => {
28 28
   useEffect(() => {
29 29
 
30 30
     setEndDate(new Date())
31
-    setStartDate(moment().subtract(30, 'day').toDate())
31
+    setStartDate(moment().subtract(7, 'day').toDate())
32 32
 
33 33
   }, [])
34 34
 
@@ -57,7 +57,6 @@ const header = props => {
57 57
 
58 58
   function onChange (e) {
59 59
 
60
-    // console.log(`radio checked:${e.target.value}`);
61 60
 
62 61
   }
63 62
 
@@ -68,9 +67,6 @@ const header = props => {
68 67
 
69 68
   }
70 69
 
71
-  
72
- 
73
-
74 70
  
75 71
   function handleSelectChange (e) {
76 72
 
@@ -80,11 +76,6 @@ const header = props => {
80 76
 
81 77
   const { Column, ColumnGroup } = Table;
82 78
 
83
-
84
-
85
-
86
-
87
-  
88 79
   return (<>
89 80
     <div style={{
90 81
       backgroundColor: '#fff',
@@ -93,7 +84,7 @@ const header = props => {
93 84
       borderRadius: '12px',
94 85
       minHeight: '60vh'
95 86
     }}>
96
-      <Radio.Group onChange={onChange} defaultValue="a">
87
+      <Radio.Group onChange={onChange} buttonStyle="solid" defaultValue="a"  style={{marginBottom:'20px'}}>
97 88
         <Radio.Button value="a" onClick={getDataOf(7)}>最近7天</Radio.Button>
98 89
         <Radio.Button value="b" onClick={getDataOf(30)}>最近1月</Radio.Button>
99 90
       </Radio.Group>

+ 9
- 10
src/pages/indexEcharts/styles.less Näytä tiedosto

@@ -1,36 +1,35 @@
1 1
 .bar {
2
-  width: 1060px;
2
+  width: 70%;
3
+  min-width: 400px;
3 4
   min-height: 560px;
4 5
   background: rgba(255, 255, 255, 1);
5 6
   box-shadow: 0px 0px 16px 2px rgba(0, 0, 0, 0.12);
6 7
   border-radius: 12px;
7
-  padding: 40px;
8
-  margin-right: 40px;
9
-  margin-bottom: 40px;
8
+  margin-right: 30px;
10 9
 }
11 10
 
12 11
 .pie {
13
-  width: 509px;
12
+  width: 30%;
13
+  min-width: 370px;
14 14
   height: 560px;
15 15
   background: rgba(255, 255, 255, 1);
16 16
   box-shadow: 0px 0px 16px 2px rgba(0, 0, 0, 0.12);
17 17
   border-radius: 12px;
18
-  padding: 40px;
19
-  margin-bottom: 40px;
18
+
20 19
 }
21 20
 
22 21
 .behavior {
23
-  width: 1600px;
22
+  width: 100%;
24 23
   height: 586px;
25 24
   background: rgba(255, 255, 255, 1);
26 25
   box-shadow: 0px 0px 16px 2px rgba(0, 0, 0, 0.12);
27 26
   border-radius: 12px;
28
-  margin-bottom: 40px;
27
+  margin-bottom: 25px;
29 28
   padding: 40px;
30 29
 }
31 30
 
32 31
 .customers {
33
-  width: 1600px;
32
+  width: 100%;
34 33
   height: 718px;
35 34
   background: rgba(255, 255, 255, 1);
36 35
   box-shadow: 0px 0px 16px 2px rgba(0, 0, 0, 0.12);

+ 7
- 34
src/pages/indexEcharts/userBehavior.jsx Näytä tiedosto

@@ -1,10 +1,8 @@
1 1
 import React, { Component, useState, useEffect } from 'react';
2
-import { Radio, DatePicker, Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, Breadcrumb } from 'antd';
2
+import { Radio, DatePicker, Form, Input, Button, Icon, Select, message,Table} from 'antd';
3 3
 import { Row, Col, Menu, Dropdown } from 'antd';
4 4
 import UserBehavior from './components/UserBehavior'
5
-// import XForm, { FieldTypes } from '../../components/XForm';
6 5
 import moment from 'moment';
7
-
8 6
 import EChart from '../../components/EchartsTest/EChart';
9 7
 import request from '../../utils/request';
10 8
 import apis from '../../services/apis';
@@ -16,7 +14,6 @@ import apis from '../../services/apis';
16 14
 //   return { startDate, endDate }
17 15
 // }
18 16
 
19
-
20 17
 const header = props => {
21 18
 
22 19
   const [tableData, setTableData] = useState({ records: [] })
@@ -28,7 +25,7 @@ const header = props => {
28 25
   useEffect(() => {
29 26
 
30 27
     setEndDate(new Date())
31
-    setStartDate(moment().subtract(30, 'day').toDate())
28
+    setStartDate(moment().subtract(7, 'day').toDate())
32 29
 
33 30
   }, [])
34 31
 
@@ -40,26 +37,14 @@ const header = props => {
40 37
     daterange[0]=dateStrings[0]
41 38
 
42 39
   }
43
-
44
-  const handleSubmit = (e, props) => {
45
-
46
-    e.preventDefault();
47
-
48
-  }
49
-
40
+ 
50 41
   const getDataOf = (days) => () => {
51 42
 
52
- 
53 43
     setEndDate(new Date())
54 44
     setStartDate(moment().subtract(days, 'day').toDate())
55 45
 
56 46
   }
57 47
 
58
-  function onChange (e) {
59
-
60
-    // console.log(`radio checked:${e.target.value}`);
61
-
62
-  }
63 48
 
64 49
   function datalist () {
65 50
 
@@ -67,7 +52,6 @@ const header = props => {
67 52
     setStartDate(daterange[0])
68 53
 
69 54
   }
70
-
71 55
   
72 56
   function redata (e) {
73 57
   
@@ -75,13 +59,8 @@ const header = props => {
75 59
     console.log('行为回调数据:' ,e)
76 60
   }
77 61
  
78
-
79 62
  
80
-  function handleSelectChange (e) {
81 63
 
82
-    console.log(e)
83
-
84
-  }
85 64
 
86 65
   const columns = [
87 66
     {
@@ -118,18 +97,15 @@ const header = props => {
118 97
 
119 98
   const dataSource  = []
120 99
 
121
-
122
-
123
-  
124 100
   return (<>
125 101
     <div style={{
126 102
       backgroundColor: '#fff',
127 103
       padding: '32PX 28px',
128 104
       boxShadow: '0px 0px 16px 2px rgba(0,0,0,0.12)',
129 105
       borderRadius: '12px',
130
-      minHeight: '60vh'
106
+      minHeight: '1000vh'
131 107
     }}>
132
-      <Radio.Group onChange={onChange} defaultValue="a">
108
+      <Radio.Group  buttonStyle="solid"  defaultValue="a">
133 109
         <Radio.Button value="a" onClick={getDataOf(7)}>最近7天</Radio.Button>
134 110
         <Radio.Button value="b" onClick={getDataOf(30)}>最近1月</Radio.Button>
135 111
       </Radio.Group>
@@ -140,15 +116,13 @@ const header = props => {
140 116
           'This Month': [moment().startOf('month'), moment().endOf('month')],
141 117
         }}
142 118
         showTime
143
-        // format="YYYY/MM/DD HH:mm:ss"
144 119
         onChange={onChangetime}
145 120
       />
146 121
       <Button type="primary" htmlType="submit" style={{ marginLeft: '30px' }} onClick={datalist}>
147 122
         搜索
148
-          </Button>
149
-      <div>
123
+      </Button>
124
+      <div style={{margin:'24px 0'}}>
150 125
         <UserBehavior endDate={endDate} startDate={startDate}  dataZoom={true}  onReData={(e) => redata(e)}></UserBehavior>
151
-        {/* */}
152 126
       </div>
153 127
 
154 128
       <Table dataSource={dataSource} columns={columns} pagination={false} scroll={{ y: 500 }} />
@@ -156,5 +130,4 @@ const header = props => {
156 130
   </>
157 131
   )
158 132
 }
159
-// data.records
160 133
 export default header

+ 1
- 7
src/pages/indexEcharts/userSource.jsx Näytä tiedosto

@@ -102,11 +102,8 @@ const header = props => {
102 102
       return acc
103 103
     }, {})
104 104
 
105
-    // tabledata
106 105
     setTableData(Object.keys(data).map(x => ({ label: x, ...data[x] })))
107 106
 
108
-    // console.log('回调数据11111111111111111111111111:' ,Object.keys(data).map(x => ({ label: x, ...data[x] })))
109
-    // console.log('回调数据1:' ,tableData[0])
110 107
   }
111 108
 
112 109
   const columns = [
@@ -154,9 +151,6 @@ const header = props => {
154 151
 
155 152
   ]
156 153
 
157
-  // const columns = [{}]
158
-
159
-  // console.log(tableData, '12222222222222')
160 154
   function handleSelectChange (e) {
161 155
 
162 156
     console.log(e)
@@ -174,7 +168,7 @@ const header = props => {
174 168
       borderRadius: '12px',
175 169
       minHeight: '60vh'
176 170
     }}>
177
-      <Radio.Group onChange={onChange} defaultValue="a">
171
+      <Radio.Group buttonStyle="solid" defaultValue="a">
178 172
         <Radio.Button value="a" onClick={getDataOf(7)}>最近7天</Radio.Button>
179 173
         <Radio.Button value="b" onClick={getDataOf(30)}>最近1月</Radio.Button>
180 174
       </Radio.Group>