Browse Source

Merge branch 'master' of http://git.ycjcjy.com/zhiyuxing/estateagents-admin-manager

魏熙美 5 years ago
parent
commit
bdc421c8eb

+ 3
- 5
config/config.js View File

416
                 },
416
                 },
417
               ],
417
               ],
418
             },
418
             },
419
-
420
-
421
             {
419
             {
422
               path: '/indexEcharts',
420
               path: '/indexEcharts',
423
               name: '首页报表',
421
               name: '首页报表',
424
               component: '../layouts/SecurityLayout',
422
               component: '../layouts/SecurityLayout',
423
+              hideInMenu: true,
425
               routes: [
424
               routes: [
426
                 {
425
                 {
427
                   path: '/indexEcharts/index',
426
                   path: '/indexEcharts/index',
446
                 
445
                 
447
               ],
446
               ],
448
             },
447
             },
449
-            
450
-
448
+          
451
             
449
             
452
             {
450
             {
453
               component: './404',
451
               component: './404',
512
 
510
 
513
   proxy: {
511
   proxy: {
514
     '/api/': {
512
     '/api/': {
515
-      target: 'http://localhost:8080/',
513
+      target: 'http://192.168.0.84:8080/',
516
       changeOrigin: true,
514
       changeOrigin: true,
517
       // pathRewrite: { '^/server': '' },
515
       // pathRewrite: { '^/server': '' },
518
     },
516
     },

+ 1
- 1
src/components/EchartsTest/EChart.jsx View File

56
         }
56
         }
57
 
57
 
58
         return (
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 View File

95
 .ant-card-body{
95
 .ant-card-body{
96
   padding: 0;
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
 .ant-breadcrumb{
102
 .ant-breadcrumb{
99
   font-size: 0.1rem;
103
   font-size: 0.1rem;
100
   .anticon {
104
   .anticon {

+ 11
- 8
src/pages/Welcome.jsx View File

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
 import EchartsTest from '../components/EchartsTest';
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
 const option = {
8
 const option = {
8
   xAxis: {
9
   xAxis: {
20
 
21
 
21
 export default () => (
22
 export default () => (
22
   <>
23
   <>
23
-    <div style={{ display: 'flex' }}>
24
+    <div style={{ display: 'flex',marginBottom:'28px' }}>
24
       <div style={{
25
       <div style={{
25
         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
         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
         boxShadow: '0px  0.11rem 14px -15px rgba(241,43,62,1)',
27
         boxShadow: '0px  0.11rem 14px -15px rgba(241,43,62,1)',
37
         <span style={{ fontSize: '24px', color: '#fff' }}>总注册用户 </span>
38
         <span style={{ fontSize: '24px', color: '#fff' }}>总注册用户 </span>
38
         <span style={{ fontSize: '52px', color: '#fff', marginLeft: '26px', fontFamily: 'fantasy' }}>12</span>
39
         <span style={{ fontSize: '52px', color: '#fff', marginLeft: '26px', fontFamily: 'fantasy' }}>12</span>
39
       </div>
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
         boxShadow: '0px  0.11rem 14px -15px rgba(107,130,230,1)',
43
         boxShadow: '0px  0.11rem 14px -15px rgba(107,130,230,1)',
43
         borderRadius: '12px', width: '32%',
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
       </div>
48
       </div>
48
     </div>
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 View File

128
   }
128
   }
129
 
129
 
130
   return (
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
       <Echart options={options} style={{ width: '100%', height: '600px' }} ></Echart>
132
       <Echart options={options} style={{ width: '100%', height: '600px' }} ></Echart>
133
     </div>
133
     </div>
134
   )
134
   )

+ 2
- 7
src/pages/indexEcharts/components/IntentionalCustomers.jsx View File

77
     },
77
     },
78
   ];
78
   ];
79
 
79
 
80
-
81
   function handleBuildingChange (e) {
80
   function handleBuildingChange (e) {
82
     IntentionUsers({ buildingId: e })
81
     IntentionUsers({ buildingId: e })
83
-
84
   }
82
   }
85
   return (
83
   return (
86
     <>
84
     <>
87
       <div>
85
       <div>
88
-        <h3>意向客户</h3>
86
+      <p style={{fontSize:'0.12rem',fontWeight:'600'}}>意向客户</p>
89
 
87
 
90
         <BuildSelect slot='action' onChange={(e => handleBuildingChange(e))}></BuildSelect>
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
       </div>
92
       </div>
96
 
93
 
97
-
98
-
99
     </>
94
     </>
100
   )
95
   )
101
 }
96
 }

+ 4
- 51
src/pages/indexEcharts/components/NewUsers.jsx View File

6
 import moment from 'moment';
6
 import moment from 'moment';
7
 import router from 'umi/router';
7
 import router from 'umi/router';
8
 import { Table, Select, Row, Col, Menu, Dropdown, Button, Icon, message } from 'antd';
8
 import { Table, Select, Row, Col, Menu, Dropdown, Button, Icon, message } from 'antd';
9
-// import UserSource from './mmm';
10
 
9
 
11
 import styles from '../styles.less'
10
 import styles from '../styles.less'
12
 const formatDate = (start, end) => {
11
 const formatDate = (start, end) => {
15
   return { startDate, endDate }
14
   return { startDate, endDate }
16
 }
15
 }
17
 const NewUsers = (props) => {
16
 const NewUsers = (props) => {
18
-  //  console.log(props,'999999999999')
19
   const [data, setData] = useState({ records: [] })
17
   const [data, setData] = useState({ records: [] })
20
 
18
 
21
 
19
 
23
     NewsUserCount(formatDate(props.startDate, props.endDate))
21
     NewsUserCount(formatDate(props.startDate, props.endDate))
24
   }, [props.startDate, props.endDate])
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
   function NewsUserCount (params) {
25
   function NewsUserCount (params) {
43
     request({
26
     request({
61
       end: 100
44
       end: 100
62
     },
45
     },
63
   ] : undefined 
46
   ] : undefined 
64
-  // //  show: false
65
   const dataset = (data.selectNewsUserCount) || []
47
   const dataset = (data.selectNewsUserCount) || []
66
   const options = {
48
   const options = {
67
 
49
 
84
         {
66
         {
85
           name: "新用户数",
67
           name: "新用户数",
86
           type: "line",
68
           type: "line",
69
+          smooth:true, 
87
         },
70
         },
88
         {
71
         {
89
           name: "授权注册",
72
           name: "授权注册",
90
           type: "line",
73
           type: "line",
74
+          smooth:true, 
91
         }
75
         }
92
       ],
76
       ],
93
       dataset: {
77
       dataset: {
100
   }
84
   }
101
 
85
 
102
 
86
 
103
-  // function onChange (value) {
104
-  //   UserActive({ dateType: value })
105
-  // }
106
-
107
-
108
   const piestyles = {
87
   const piestyles = {
109
     width: '100%',
88
     width: '100%',
110
     height: '400px',
89
     height: '400px',
111
-
112
   }
90
   }
113
 
91
 
114
-
115
   return (
92
   return (
116
     <>
93
     <>
117
       <div>
94
       <div>
118
-
119
-
120
         <div >
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
        </div>
97
        </div>
138
-
139
-
140
-        <EChart options={options} style={piestyles} />
98
+        <EChart options={options} style={piestyles} onClick={()=>router.push('/indexEcharts/newUsers')} />
141
       </div>
99
       </div>
142
-
143
-
144
-
145
-
146
-
147
     </>
100
     </>
148
   )
101
   )
149
 }
102
 }

+ 4
- 26
src/pages/indexEcharts/components/UserActive.jsx View File

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

+ 68
- 85
src/pages/indexEcharts/components/UserBehavior.jsx View File

1
 import React, { Component, useState, useEffect } from 'react';
1
 import React, { Component, useState, useEffect } from 'react';
2
-
3
 import EChart from '../../../components/EchartsTest/EChart';
2
 import EChart from '../../../components/EchartsTest/EChart';
4
 import request from '../../../utils/request';
3
 import request from '../../../utils/request';
5
 import apis from '../../../services/apis';
4
 import apis from '../../../services/apis';
17
   return { startDate, endDate }
16
   return { startDate, endDate }
18
 }
17
 }
19
 const UserBehavior = (props) => {
18
 const UserBehavior = (props) => {
20
-// console.log(props,'11111111')
21
 
19
 
22
-const [data, setData] = useState({ records: [] })
20
+  const [data, setData] = useState({ records: [] })
23
   const [datas, setDatas] = useState({ records: [] })
21
   const [datas, setDatas] = useState({ records: [] })
24
- 
25
-  
22
+
23
+
26
   //柱图
24
   //柱图
27
 
25
 
28
   useEffect(() => {
26
   useEffect(() => {
39
       params
37
       params
40
     }).then((data) => {
38
     }).then((data) => {
41
       setData(data || {})
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
-  function getUserBehaviorProfile (row) {
44
+  function getUserBehaviorProfile(row) {
54
 
45
 
55
     setData([])
46
     setData([])
56
     request({
47
     request({
57
       ...apis.indexEcharts.userBehavior.profile,
48
       ...apis.indexEcharts.userBehavior.profile,
58
-      params:{ event: row.event, personId: row.personId }
49
+      params: { event: row.event, personId: row.personId }
59
     }).then((data) => {
50
     }).then((data) => {
60
 
51
 
61
-      
62
-      setData(data )
63
-      // props.onReData(data)
64
-      // console.log(data , '22354234')
52
+      setData(data)
53
+
65
     })
54
     })
66
 
55
 
56
+  }
67
 
57
 
58
+  const seriesMaker = (data.selectUserBehavior || []).reduce((series, item) => {
59
+    let { date, activityCount, activity } = item
60
+    date = moment(date).format('YYYY-MM-DD')
61
+    if (!activityCount) activityCount = 0
62
+
63
+    // 使用对象, 可以去重
64
+    series[`${activity}`] = (series[`${activity}`] || []).concat([[date, activityCount]])
65
+
66
+    return series;
67
+  }, {})
68
+
69
+
70
+  const dataZoom = props.dataZoom ? [
71
+    {
72
+      type: 'inside',
73
+      start: 0,
74
+      end: 100
75
+    },
76
+    {
77
+      type: 'slider',
78
+      start: 0,
79
+      end: 100
80
+    },
81
+  ] : undefined
82
+
83
+
84
+  const options = {
85
+    title: {},
86
+    icon: "rect",
87
+    legend: {
88
+      show: true, zlevel: 10,
89
+      itemGap: 100,
90
+    },
91
+    color: ['#F12B3E', '#FE929C', '#647CE1', '#A2B9FF', '#FF844F', '#FFBB9D'],
92
+    tooltip: {
93
+      trigger: 'axis'
94
+    },
95
+    xAxis: { type: 'category' },
96
+    yAxis: {},
97
+    dataZoom,
98
+    series: Object.keys(seriesMaker).map(x => {
99
+      return {
100
+        type: 'line',
101
+        smooth: true,
102
+        name: x,
103
+        data: seriesMaker[x],
104
+      }
105
+    }),
106
+  }
107
+  function handleBuildingChange(e) {
108
+    getUserBehaviorSummary({ buildingId: e })
68
   }
109
   }
69
-  
70
-    const seriesMaker = (data.selectUserBehavior || []).reduce((series, item) => {
71
-      let { date, activityCount, activity } = item
72
-      date = moment(date).format('YYYY-MM-DD')
73
-      if (!activityCount) activityCount = 0
74
-
75
-      // 使用对象, 可以去重
76
-      series[`${activity}`] = (series[`${activity}`] || []).concat([[ date, activityCount ]])
77
-
78
-      return series;
79
-    }, {})
80
-
81
-
82
-   const dataZoom=props.dataZoom?[
83
-      {
84
-        type: 'inside',
85
-        start: 0,
86
-        end: 100
87
-      },
88
-      {
89
-        type: 'slider',
90
-        start: 0,
91
-        end: 100
92
-      },
93
-    ] : undefined 
94
-    
95
-  
96
-    const options = {
97
-    title:  {
98
-        text: '用户行为',
99
-        subtext: '最近7天',
100
-      },
101
-      icon: "rect",
102
-      legend: {
103
-         show: true, zlevel: 10 ,
104
-         itemGap:100,
105
-        //  data:[{
106
-        //   //  name:'',
107
-        //   icon: 'rect',
108
-        //  }]
109
-      },
110
-      color: ['#F12B3E', '#FE929C', '#647CE1', '#A2B9FF', '#FF844F', '#FFBB9D'],
111
-      tooltip: {
112
-        trigger: 'axis'
113
-      },
114
-      xAxis: { type: 'category' },
115
-      yAxis: {},
116
-      dataZoom,
117
-      series: Object.keys(seriesMaker).map(x => {
118
-        return {
119
-          type: 'line',
120
-          name: x,
121
-          data: seriesMaker[x],
122
-        }
123
-      }),
124
-    }
125
-   function handleBuildingChange (e) {
126
-      getUserBehaviorSummary({ buildingId: e })
127
-    }
128
 
110
 
129
 
111
 
130
   const style = {
112
   const style = {
133
 
115
 
134
   }
116
   }
135
 
117
 
136
-
137
-
138
   return (
118
   return (
139
     <>
119
     <>
140
       <div>
120
       <div>
141
         {/* onSuccess={(e) => onTabledatas(e)} */}
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')}>
123
+          <span style={{ borderBottom: '1px solid #f02d40', color: '#333', fontSize: '0.12rem', fontWeight: '600' }}>用户行为</span>
124
+          {!props.BuildSelectHide && <span style={{ fontSize: '0.09rem', color: '#888', marginLeft: '0.06rem' }}></span>}
125
+        </p>
126
+        <div style={{ float: 'right', marginTop: '-40px', marginBottom: '20px' }}>
127
+          {!props.BuildSelectHide && <BuildSelect slot='action' onChange={(e => handleBuildingChange(e))}></BuildSelect>}
128
+        </div>
129
+        <EChart onClick={() => router.push('/indexEcharts/userBehavior')} options={options} style={style} />
144
 
130
 
145
- 
146
       </div>
131
       </div>
147
 
132
 
148
-
149
-
150
     </>
133
     </>
151
   )
134
   )
152
 }
135
 }

+ 39
- 85
src/pages/indexEcharts/components/UserConversion.jsx View File

6
 import moment from 'moment';
6
 import moment from 'moment';
7
 import router from 'umi/router';
7
 import router from 'umi/router';
8
 import { Table, Select, Row, Col, Menu, Dropdown, Button, Icon, message } from 'antd';
8
 import { Table, Select, Row, Col, Menu, Dropdown, Button, Icon, message } from 'antd';
9
-// import UserSource from './mmm';
10
 
9
 
11
 import styles from '../styles.less'
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
 const UserSource = (props) => {
13
 const UserSource = (props) => {
20
 
14
 
21
   const [data, setData] = useState({ records: [] })
15
   const [data, setData] = useState({ records: [] })
22
   const [theStatis, settheStatis] = useState({ records: [] })
16
   const [theStatis, settheStatis] = useState({ records: [] })
23
- 
24
   const [theCurrent, settheCurrent] = useState({ records: [] })
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
   useEffect(() => {
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
       request({
24
       request({
49
         ...apis.indexEcharts.userConversion,
25
         ...apis.indexEcharts.userConversion,
50
-        params: payload,
26
+        params,
51
       }).then((data) => {
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
  function setDataset(data) {      
34
  function setDataset(data) {      
35
+ 
71
     const { pvNum, ...other } = data['data_count']
36
     const { pvNum, ...other } = data['data_count']
72
 
37
 
73
     // 获取第一个值
38
     // 获取第一个值
77
       break
42
       break
78
     }
43
     }
79
 
44
 
80
-
81
     if (pvNum < num) {
45
     if (pvNum < num) {
82
       theCurrent = []
46
       theCurrent = []
83
     } else {
47
     } else {
84
       theCurrent = [
48
       theCurrent = [
85
-        { name: getStatisName(), value: num },
49
+        { name: this.getStatisName(), value: num },
86
         { name: '其余', value: pvNum - num },
50
         { name: '其余', value: pvNum - num },
87
       ]
51
       ]
88
     }
52
     }
91
   }
55
   }
92
 
56
 
93
   function getStatisName() {
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
   const options = {
72
   const options = {
100
     legend: {},
73
     legend: {},
103
     series: {
76
     series: {
104
       type: 'pie',
77
       type: 'pie',
105
       name: '转化率',
78
       name: '转化率',
106
-      radius: ['50%', '70%'],
107
-      data: theCurrent
79
+      radius: ['34%', '52%'],
80
+      data:[ { name: '授权手机', value: 6 },
81
+      { name: '其余', value: 5 },]
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
   const piestyles = {
91
   const piestyles = {
136
   return (
98
   return (
137
     <>
99
     <>
138
       <div>
100
       <div>
139
-        <h3>转化率</h3>
101
+      <p style={{fontSize:'0.12rem',fontWeight:'600'}}>转化率</p>
140
 
102
 
141
         <Select
103
         <Select
142
-          showSearch
143
           style={{ width: 200 }}
104
           style={{ width: 200 }}
144
           placeholder="授权手机"
105
           placeholder="授权手机"
145
-          optionFilterProp="children"
146
           onChange={onChange}
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
         </Select>
116
         </Select>
158
-        {/* <EChart options={options} style={piestyles} /> */}
159
-
160
-
117
+        <EChart options={options} style={piestyles} />
161
 
118
 
162
 
119
 
163
       </div>
120
       </div>
164
 
121
 
165
 
122
 
166
-
167
-
168
-
169
     </>
123
     </>
170
   )
124
   )
171
 }
125
 }

+ 5
- 32
src/pages/indexEcharts/components/UserSex.jsx View File

6
 import moment from 'moment';
6
 import moment from 'moment';
7
 import router from 'umi/router';
7
 import router from 'umi/router';
8
 import { Table, Select, Row, Col, Menu, Dropdown, Button, Icon, message } from 'antd';
8
 import { Table, Select, Row, Col, Menu, Dropdown, Button, Icon, message } from 'antd';
9
-// import UserSource from './mmm';
10
 
9
 
11
 import styles from '../styles.less'
10
 import styles from '../styles.less'
12
 
11
 
22
   const endDate = new Date()
21
   const endDate = new Date()
23
   const startDate = moment().subtract(7, 'day').toDate()
22
   const startDate = moment().subtract(7, 'day').toDate()
24
 
23
 
25
-
26
   useEffect(() => {
24
   useEffect(() => {
27
     UserSex(formatDate(startDate, endDate))
25
     UserSex(formatDate(startDate, endDate))
28
   }, [])
26
   }, [])
32
       ...apis.indexEcharts.userSex,
30
       ...apis.indexEcharts.userSex,
33
       params,
31
       params,
34
     }).then((data) => {
32
     }).then((data) => {
35
-
36
       setData(data)
33
       setData(data)
37
-      // console.log(data, '000000')
38
     })
34
     })
39
   }
35
   }
40
 
36
 
41
-
42
   const dataset = (data.selectSexUser) || []
37
   const dataset = (data.selectSexUser) || []
43
-  // console.log(dataset, '000000')
38
+ 
44
   const options = {
39
   const options = {
45
     title: {
40
     title: {
46
       text: '性别比例'
41
       text: '性别比例'
47
     },
42
     },
48
     legend: {},
43
     legend: {},
49
-    color: ['#FF7E48', '#FFC1A4'],
44
+    color: ['#FF7E48', '#dcdcdc'],
50
     tooltip: {},
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
     series: {
46
     series: {
64
       type: 'pie',
47
       type: 'pie',
65
       name: '性别比例',
48
       name: '性别比例',
66
-      // radius: ['50%', '70%'],
67
-      center: ['50%', '65%'],
68
-
69
-        radius: ['40%', '60%'],
49
+      center: ['44%', '65%'],
50
+      radius: ['34%', '52%'],
70
       data:
51
       data:
71
         dataset,
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
   const piestyles = {
57
   const piestyles = {
86
     width: '100%',
58
     width: '100%',
87
     height: '400px',
59
     height: '400px',
60
+    minWidth:'350px'
88
 
61
 
89
   }
62
   }
90
 
63
 

+ 9
- 43
src/pages/indexEcharts/components/UserSource.jsx View File

6
 import moment from 'moment';
6
 import moment from 'moment';
7
 import router from 'umi/router';
7
 import router from 'umi/router';
8
 import { Table, Select, Row, Col, Menu, Dropdown, Button, Icon, message } from 'antd';
8
 import { Table, Select, Row, Col, Menu, Dropdown, Button, Icon, message } from 'antd';
9
-// import UserSource from './mmm';
10
 
9
 
11
 import styles from '../styles.less'
10
 import styles from '../styles.less'
12
 
11
 
13
-
14
 const formatDate = (start, end) => {
12
 const formatDate = (start, end) => {
15
   const startDate = moment(start).format('YYYY-MM-DDT00:00:00.000') + 'Z'
13
   const startDate = moment(start).format('YYYY-MM-DDT00:00:00.000') + 'Z'
16
   const endDate = moment(end).format('YYYY-MM-DDT23:59:59.999') + 'Z'
14
   const endDate = moment(end).format('YYYY-MM-DDT23:59:59.999') + 'Z'
18
 }
16
 }
19
 
17
 
20
 const UserSource = (props) => {
18
 const UserSource = (props) => {
21
-// console.log(props,'---------')
22
   const [data, setData] = useState({ records: [] })
19
   const [data, setData] = useState({ records: [] })
23
   //柱图
20
   //柱图
24
-
25
   useEffect(() => {
21
   useEffect(() => {
26
-   userResource(formatDate(props.startDate, props.endDate))
22
+    userResource(formatDate(props.startDate, props.endDate))
27
   }, [props.startDate, props.endDate])
23
   }, [props.startDate, props.endDate])
28
 
24
 
29
-  function userResource (params) {
25
+  function userResource(params) {
30
     request({
26
     request({
31
       ...apis.indexEcharts.userResource,
27
       ...apis.indexEcharts.userResource,
32
       params,
28
       params,
33
     }).then((data) => {
29
     }).then((data) => {
34
-      // console.log(data , '3333')
35
       setData(data)
30
       setData(data)
36
       props.onSuccess(data)
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
   const dataset = data || {};
35
   const dataset = data || {};
50
   const source = dataset.columnar || [];
36
   const source = dataset.columnar || [];
51
-
52
-  // const source = this.dataset.columnar || [];
53
   const subtitle = '最近7天';
37
   const subtitle = '最近7天';
54
   const baroptions = {
38
   const baroptions = {
55
-    title: {
56
-      text: '用户来源',
57
-      subtext: '最近7天',
58
-    },
59
-    // color: ['#286DD0', '#8565CE', '#6A96F8', '#F5749E', '#8B7FE2'],
39
+    title: { },
60
     xAxis: { type: 'category' },
40
     xAxis: { type: 'category' },
61
     legend: {
41
     legend: {
62
       left: '20%',
42
       left: '20%',
63
       data: ['所有用户', '注册用户']
43
       data: ['所有用户', '注册用户']
64
-      // itemWidth: '24px',
65
-      // itemHeight:'24px',
66
     },
44
     },
67
 
45
 
68
     tooltip: {},
46
     tooltip: {},
106
           }
84
           }
107
         }
85
         }
108
 
86
 
109
-
110
-
111
       },
87
       },
112
     ],
88
     ],
113
     dataset: {
89
     dataset: {
115
       dimensions: ['fromName', 'userCount', 'registered'],
91
       dimensions: ['fromName', 'userCount', 'registered'],
116
       source: source,
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
   const barstyle = {
97
   const barstyle = {
131
-    width: '1000px',
98
+    width: '100%',
132
     height: '480px',
99
     height: '480px',
133
-
100
+    minWidth: '400px'
134
   }
101
   }
135
 
102
 
136
-
137
   return (
103
   return (
138
     <>
104
     <>
139
       <div>
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 View File

6
 import moment from 'moment';
6
 import moment from 'moment';
7
 import router from 'umi/router';
7
 import router from 'umi/router';
8
 import { Table, Select, Row, Col, Menu, Dropdown, Button, Icon, message } from 'antd';
8
 import { Table, Select, Row, Col, Menu, Dropdown, Button, Icon, message } from 'antd';
9
-// import UserSource from './mmm';
10
 
9
 
11
 import styles from '../styles.less'
10
 import styles from '../styles.less'
12
 const formatDate = (start, end) => {
11
 const formatDate = (start, end) => {
15
   return { startDate, endDate }
14
   return { startDate, endDate }
16
 }
15
 }
17
 const UserSource = (props) => {
16
 const UserSource = (props) => {
18
-  //  console.log(props,'999999999999')
19
   const [data, setData] = useState({ records: [] })
17
   const [data, setData] = useState({ records: [] })
20
-  //柱图
18
+
21
 
19
 
22
   useEffect(() => {
20
   useEffect(() => {
23
     userResource(formatDate(props.startDate, props.endDate))
21
     userResource(formatDate(props.startDate, props.endDate))
28
        ...apis.indexEcharts.userResource,
26
        ...apis.indexEcharts.userResource,
29
        params,
27
        params,
30
      }).then((data) => {
28
      }).then((data) => {
31
-      //  console.log(data , '3333')
32
        setData(data)
29
        setData(data)
33
      })
30
      })
34
    }
31
    }
36
   function toEdit () {
33
   function toEdit () {
37
     router.push({
34
     router.push({
38
       pathname: '/indexEcharts/userSource',
35
       pathname: '/indexEcharts/userSource',
39
-      // query: {
40
-      //   a: 'b',
41
-      // },
42
     });
36
     });
43
   }
37
   }
44
 
38
 
45
   const dataset = data || {};
39
   const dataset = data || {};
46
 
40
 
47
 
41
 
48
-
49
-
50
-
51
   const { person_estate_agent = 0, person_null = 0, person_realty_consultant = 0 } = dataset.pie || {};
42
   const { person_estate_agent = 0, person_null = 0, person_realty_consultant = 0 } = dataset.pie || {};
52
   const pieoptions = {
43
   const pieoptions = {
53
-    // xAxis: {},
54
     color: ['#6B82E6', '#F02D40', '#FF834E'],
44
     color: ['#6B82E6', '#F02D40', '#FF834E'],
55
     legend: {
45
     legend: {
56
-      // left: '70%',
57
       orient: 'vertical',
46
       orient: 'vertical',
58
       x: 'left',
47
       x: 'left',
59
       data: ['来源置业顾问', '来源全民经纪人', '自主进入'],
48
       data: ['来源置业顾问', '来源全民经纪人', '自主进入'],
60
-      
61
     },
49
     },
62
-    tooltip: {
63
-
64
-    },
65
-    // yAxis: {},
66
-
50
+    tooltip: {},
67
     series: [
51
     series: [
68
       {
52
       {
69
         type: 'pie',
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
     dataset: {
58
     dataset: {
128
       id: 'pie',
59
       id: 'pie',
129
       source: [
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
   const piestyles = {
69
   const piestyles = {
154
     width: '100%',
70
     width: '100%',
155
     height: '400px',
71
     height: '400px',
156
-
72
+    minWidth:'350px',
157
   }
73
   }
158
 
74
 
159
 
75
 
161
     <>
77
     <>
162
       <div>
78
       <div>
163
 
79
 
164
-
165
-
166
-
167
-
168
         <EChart options={pieoptions} style={piestyles} />
80
         <EChart options={pieoptions} style={piestyles} />
169
 
81
 
170
       </div>
82
       </div>
171
 
83
 
172
-
173
-
174
-
175
-
176
     </>
84
     </>
177
   )
85
   )
178
 }
86
 }

+ 10
- 11
src/pages/indexEcharts/index.jsx View File

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

+ 2
- 11
src/pages/indexEcharts/newUsers.jsx View File

28
   useEffect(() => {
28
   useEffect(() => {
29
 
29
 
30
     setEndDate(new Date())
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
 
57
 
58
   function onChange (e) {
58
   function onChange (e) {
59
 
59
 
60
-    // console.log(`radio checked:${e.target.value}`);
61
 
60
 
62
   }
61
   }
63
 
62
 
68
 
67
 
69
   }
68
   }
70
 
69
 
71
-  
72
- 
73
-
74
  
70
  
75
   function handleSelectChange (e) {
71
   function handleSelectChange (e) {
76
 
72
 
80
 
76
 
81
   const { Column, ColumnGroup } = Table;
77
   const { Column, ColumnGroup } = Table;
82
 
78
 
83
-
84
-
85
-
86
-
87
-  
88
   return (<>
79
   return (<>
89
     <div style={{
80
     <div style={{
90
       backgroundColor: '#fff',
81
       backgroundColor: '#fff',
93
       borderRadius: '12px',
84
       borderRadius: '12px',
94
       minHeight: '60vh'
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
         <Radio.Button value="a" onClick={getDataOf(7)}>最近7天</Radio.Button>
88
         <Radio.Button value="a" onClick={getDataOf(7)}>最近7天</Radio.Button>
98
         <Radio.Button value="b" onClick={getDataOf(30)}>最近1月</Radio.Button>
89
         <Radio.Button value="b" onClick={getDataOf(30)}>最近1月</Radio.Button>
99
       </Radio.Group>
90
       </Radio.Group>

+ 9
- 10
src/pages/indexEcharts/styles.less View File

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

+ 44
- 48
src/pages/indexEcharts/userBehavior.jsx View File

1
 import React, { Component, useState, useEffect } from 'react';
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
 import { Row, Col, Menu, Dropdown } from 'antd';
3
 import { Row, Col, Menu, Dropdown } from 'antd';
4
 import UserBehavior from './components/UserBehavior'
4
 import UserBehavior from './components/UserBehavior'
5
-// import XForm, { FieldTypes } from '../../components/XForm';
6
 import moment from 'moment';
5
 import moment from 'moment';
7
-
8
 import EChart from '../../components/EchartsTest/EChart';
6
 import EChart from '../../components/EchartsTest/EChart';
9
 import request from '../../utils/request';
7
 import request from '../../utils/request';
10
 import apis from '../../services/apis';
8
 import apis from '../../services/apis';
11
-
9
+import BuildSelect from '../../components/SelectButton/BuildSelect'
12
 
10
 
13
 // const formatDate = (start, end) => {
11
 // const formatDate = (start, end) => {
14
 //   const startDate = moment(start).format('YYYY-MM-DDT00:00:00.000') + 'Z'
12
 //   const startDate = moment(start).format('YYYY-MM-DDT00:00:00.000') + 'Z'
16
 //   return { startDate, endDate }
14
 //   return { startDate, endDate }
17
 // }
15
 // }
18
 
16
 
19
-
20
 const header = props => {
17
 const header = props => {
21
 
18
 
22
   const [tableData, setTableData] = useState({ records: [] })
19
   const [tableData, setTableData] = useState({ records: [] })
23
 
20
 
24
   const [endDate, setEndDate] = useState({})
21
   const [endDate, setEndDate] = useState({})
25
   const [startDate, setStartDate] = useState({})
22
   const [startDate, setStartDate] = useState({})
26
-  let daterange= []
23
+  let daterange = []
27
 
24
 
28
   useEffect(() => {
25
   useEffect(() => {
29
 
26
 
30
     setEndDate(new Date())
27
     setEndDate(new Date())
31
-    setStartDate(moment().subtract(30, 'day').toDate())
28
+    setStartDate(moment().subtract(7, 'day').toDate())
32
 
29
 
33
   }, [])
30
   }, [])
34
 
31
 
35
   const { RangePicker } = DatePicker;
32
   const { RangePicker } = DatePicker;
36
 
33
 
37
-  function onChangetime (dates, dateStrings) {
38
-
39
-    daterange[1]=dateStrings[1]
40
-    daterange[0]=dateStrings[0]
41
-
42
-  }
43
-
44
-  const handleSubmit = (e, props) => {
34
+  function onChangetime(dates, dateStrings) {
45
 
35
 
46
-    e.preventDefault();
36
+    daterange[1] = dateStrings[1]
37
+    daterange[0] = dateStrings[0]
47
 
38
 
48
   }
39
   }
49
 
40
 
50
   const getDataOf = (days) => () => {
41
   const getDataOf = (days) => () => {
51
 
42
 
52
- 
53
     setEndDate(new Date())
43
     setEndDate(new Date())
54
     setStartDate(moment().subtract(days, 'day').toDate())
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
-  function datalist () {
49
+  function datalist() {
65
 
50
 
66
     setEndDate(daterange[1])
51
     setEndDate(daterange[1])
67
     setStartDate(daterange[0])
52
     setStartDate(daterange[0])
68
 
53
 
69
   }
54
   }
70
 
55
 
71
-  
72
-  function redata (e) {
73
-  
56
+  function redata(e) {
74
 
57
 
75
-    console.log('行为回调数据:' ,e)
76
-  }
77
- 
78
-
79
- 
80
-  function handleSelectChange (e) {
81
-
82
-    console.log(e)
83
 
58
 
59
+    console.log('行为回调数据:', e)
60
+  }
61
+  function handleChange(value) {
62
+    console.log(`selected ${value}`);
84
   }
63
   }
85
 
64
 
86
   const columns = [
65
   const columns = [
112
       title: '离开时间',
91
       title: '离开时间',
113
       dataIndex: 'stion',
92
       dataIndex: 'stion',
114
       key: 'stion',
93
       key: 'stion',
115
-    
94
+
116
     },
95
     },
117
   ];
96
   ];
118
 
97
 
119
-  const dataSource  = []
98
+  const dataSource = []
120
 
99
 
121
-
122
-
123
-  
124
   return (<>
100
   return (<>
125
     <div style={{
101
     <div style={{
126
       backgroundColor: '#fff',
102
       backgroundColor: '#fff',
127
       padding: '32PX 28px',
103
       padding: '32PX 28px',
128
       boxShadow: '0px 0px 16px 2px rgba(0,0,0,0.12)',
104
       boxShadow: '0px 0px 16px 2px rgba(0,0,0,0.12)',
129
       borderRadius: '12px',
105
       borderRadius: '12px',
130
-      minHeight: '60vh'
106
+      minHeight: '1000vh'
131
     }}>
107
     }}>
132
-      <Radio.Group onChange={onChange} defaultValue="a">
108
+    <div>
109
+    <Radio.Group buttonStyle="solid" defaultValue="a">
133
         <Radio.Button value="a" onClick={getDataOf(7)}>最近7天</Radio.Button>
110
         <Radio.Button value="a" onClick={getDataOf(7)}>最近7天</Radio.Button>
134
         <Radio.Button value="b" onClick={getDataOf(30)}>最近1月</Radio.Button>
111
         <Radio.Button value="b" onClick={getDataOf(30)}>最近1月</Radio.Button>
135
       </Radio.Group>
112
       </Radio.Group>
140
           'This Month': [moment().startOf('month'), moment().endOf('month')],
117
           'This Month': [moment().startOf('month'), moment().endOf('month')],
141
         }}
118
         }}
142
         showTime
119
         showTime
143
-        // format="YYYY/MM/DD HH:mm:ss"
144
         onChange={onChangetime}
120
         onChange={onChangetime}
145
       />
121
       />
146
-      <Button type="primary" htmlType="submit" style={{ marginLeft: '30px' }} onClick={datalist}>
122
+      <Button type="primary" htmlType="submit" style={{ marginLeft: '30px',float:'right' }} onClick={datalist}>
147
         搜索
123
         搜索
148
-          </Button>
149
-      <div>
150
-        <UserBehavior endDate={endDate} startDate={startDate}  dataZoom={true}  onReData={(e) => redata(e)}></UserBehavior>
151
-        {/* */}
124
+      </Button>
125
+    </div>
126
+     
127
+      <div style={{ display: 'flex', margin: '24px 0' }}>
128
+      <BuildSelect slot='action' onChange={(e => handleBuildingChange(e))}></BuildSelect>
129
+        <Select placeholder="所有事件组" style={{ width: '14%',minWidth:'160px',marginRight:'2%' }} onChange={handleChange}>
130
+          <Option value="jack">Jack</Option>
131
+          <Option value="lucy">Lucy</Option>
132
+          <Option value="Yiminghe">yiminghe</Option>
133
+        </Select>
134
+        <Select placeholder="请选择事件" style={{ width: '14%',minWidth:'160px',marginRight:'2%' }} onChange={handleChange}>
135
+          <Option value="jack">Jack</Option>
136
+          <Option value="lucy">Lucy</Option>
137
+          <Option value="Yiminghe">yiminghe</Option>
138
+        </Select>
139
+        <Select placeholder="请选择属性" style={{ width: '14%',minWidth:'160px' }} onChange={handleChange}>
140
+          <Option value="jack">Jack</Option>
141
+          <Option value="lucy">Lucy</Option>
142
+          <Option value="Yiminghe">yiminghe</Option>
143
+        </Select>
144
+      </div>
145
+      
146
+      
147
+      <div style={{ margin: '24px 0' }}>
148
+        <UserBehavior BuildSelectHide={true} endDate={endDate} startDate={startDate} dataZoom={true} onReData={(e) => redata(e)}></UserBehavior>
152
       </div>
149
       </div>
153
 
150
 
154
       <Table dataSource={dataSource} columns={columns} pagination={false} scroll={{ y: 500 }} />
151
       <Table dataSource={dataSource} columns={columns} pagination={false} scroll={{ y: 500 }} />
156
   </>
153
   </>
157
   )
154
   )
158
 }
155
 }
159
-// data.records
160
 export default header
156
 export default header

+ 1
- 7
src/pages/indexEcharts/userSource.jsx View File

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

+ 10
- 7
src/pages/staff/list/addRole.jsx View File

1
 import React, { useState, useEffect } from 'react';
1
 import React, { useState, useEffect } from 'react';
2
-import { Checkbox, Input, Card, Form, Button,Row,Col } from 'antd';
2
+import { Checkbox, Input, Card, Form, Button, Row, Col, Spin } from 'antd';
3
 import { connect } from 'dva';
3
 import { connect } from 'dva';
4
 import XForm, { FieldTypes } from '../../../components/XForm';
4
 import XForm, { FieldTypes } from '../../../components/XForm';
5
 import request from '../../../utils/request';
5
 import request from '../../../utils/request';
29
   const [dataMenuId, setDataMenuId] = useState([])
29
   const [dataMenuId, setDataMenuId] = useState([])
30
   const [dataButtonId, setDataButtonId] = useState([])
30
   const [dataButtonId, setDataButtonId] = useState([])
31
 
31
 
32
+  const [loading, setLoading] = useState(true);
33
+
32
   useEffect(() => {
34
   useEffect(() => {
33
     // 新增和编辑用一个页面
35
     // 新增和编辑用一个页面
34
     if (props.location.query) {
36
     if (props.location.query) {
63
   // 根据角色id查询当前的菜单及其按钮
65
   // 根据角色id查询当前的菜单及其按钮
64
   function buttonAndMenuList(params, ids) {
66
   function buttonAndMenuList(params, ids) {
65
     request({ ...apis.role.buttonAndMenuList, urlData: { id: ids }, params: { ...params } }).then(data => {
67
     request({ ...apis.role.buttonAndMenuList, urlData: { id: ids }, params: { ...params } }).then(data => {
68
+      setLoading(false)
66
       props.form.setFieldsValue({ roleName: data.roleName })
69
       props.form.setFieldsValue({ roleName: data.roleName })
67
       console.log(data)
70
       console.log(data)
68
       setData(data)
71
       setData(data)
69
 
72
 
70
       // 获取所有的权限Id
73
       // 获取所有的权限Id
71
       if (data.sysMenuList) {
74
       if (data.sysMenuList) {
72
-        setDataMenuId(data.sysMenuList.map(item => item.menuId))
73
-        setDataButtonId((data.sysMenuList.map(item => item.sysButtonInMenu && item.sysButtonInMenu.map(btn => btn.btnId).join(',')).filter(f => f !== '').join(',').split(',')).map(a => parseInt(a)))
75
+        setDataMenuId(data.sysMenuList.map(item => item && item.menuId))
76
+        // setDataButtonId((data.sysMenuList.map(item => item.sysButtonInMenu && item.sysButtonInMenu.map(btn => btn.btnId).join(',')).filter(f => f !== '').join(',').split(',')).map(a => parseInt(a) ) )
77
+        setDataButtonId(data.sysButtonInMenu.map(item => item && item.btnId))
74
       }
78
       }
75
   }).catch((err) => {
79
   }).catch((err) => {
76
       console.log(err)
80
       console.log(err)
143
       
147
       
144
         const sumitMenu = userMenus.filter(item => dataMenuId.includes(item.menuId))
148
         const sumitMenu = userMenus.filter(item => dataMenuId.includes(item.menuId))
145
         const sumitBtn = buutonDate.filter(item => dataButtonId.includes(item.btnId))
149
         const sumitBtn = buutonDate.filter(item => dataButtonId.includes(item.btnId))
146
-        // console.log('sumitMenu', sumitMenu)
147
-        // console.log('sumitBtn', sumitBtn)
148
-        // console.log('sumitMenu', sumitMenu)
149
-        // const sumitBut = data.sysMenuList[0].sysButtonInMenu.concat(but)
150
         updateAuthMenu({ sysMenu: sumitMenu, name: values.roleName, id: props.location.query.id, sysButton: sumitBtn })
150
         updateAuthMenu({ sysMenu: sumitMenu, name: values.roleName, id: props.location.query.id, sysButton: sumitBtn })
151
       } else {
151
       } else {
152
         updateAuthMenu({ sysMenu: menus, name: values.roleName, id: props.location.query.id, sysButton: but })
152
         updateAuthMenu({ sysMenu: menus, name: values.roleName, id: props.location.query.id, sysButton: but })
154
     });
154
     });
155
   }
155
   }
156
   const { getFieldDecorator } = props.form;
156
   const { getFieldDecorator } = props.form;
157
+  
157
   return (
158
   return (
158
     <>
159
     <>
159
       <div>
160
       <div>
161
+      <Spin spinning={ loading } size="large">
160
         <Form labelCol={{ span: 6 }} wrapperCol={{ span: 12 }} onSubmit={handleSubmit}>
162
         <Form labelCol={{ span: 6 }} wrapperCol={{ span: 12 }} onSubmit={handleSubmit}>
161
           <Form.Item label="角色名称">
163
           <Form.Item label="角色名称">
162
             {getFieldDecorator('roleName', {
164
             {getFieldDecorator('roleName', {
207
           </Button>
209
           </Button>
208
           </Form.Item>
210
           </Form.Item>
209
         </Form>
211
         </Form>
212
+        </Spin>
210
       </div>
213
       </div>
211
     </>
214
     </>
212
   )
215
   )