魏熙美 5 anni fa
parent
commit
d9dc16c558

+ 24
- 0
config/routes.js Vedi File

@@ -28,6 +28,30 @@ export default [
28 28
             name: '首页',
29 29
             component: './Welcome',
30 30
           },
31
+          {
32
+            path: '/indexEcharts',
33
+            name: '图表管理',
34
+            component: '../layouts/BlankLayout',
35
+            hideInMenu: true,
36
+            routes: [
37
+              {
38
+                path: '/indexEcharts/userSource',
39
+                name: '用户来源',
40
+                component: './indexEcharts/userSource',
41
+              },
42
+              {
43
+                path: '/indexEcharts/newUsers',
44
+                name: '新增用户',
45
+                component: './indexEcharts/newUsers',
46
+              },
47
+
48
+              {
49
+                path: '/indexEcharts/userBehavior',
50
+                name: '用户行为',
51
+                component: './indexEcharts/userBehavior',
52
+              },
53
+            ],
54
+          },
31 55
           {
32 56
             path: '/building',
33 57
             name: '项目管理',

+ 1
- 1
src/pages/indexEcharts/components/NewUsers.jsx Vedi File

@@ -92,7 +92,7 @@ const NewUsers = (props) => {
92 92
     <>
93 93
       <div>
94 94
         <div >
95
-          <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>
95
+          <p onClick={()=>router.push('/indexEcharts/newUsers')}><span style={{borderBottom:'1px solid #f02d40',fontSize:'0.12rem',fontWeight:'600'}}>新增用户</span> {!props.BuildSelectHide && <span style={{ fontSize: '0.09rem', color: '#888', marginLeft: '0.06rem' }}>最近七天</span>}</p>
96 96
        </div>
97 97
         <EChart options={options} style={piestyles} onClick={()=>router.push('/indexEcharts/newUsers')} />
98 98
       </div>

+ 1
- 1
src/pages/indexEcharts/components/UserBehavior.jsx Vedi File

@@ -121,7 +121,7 @@ const UserBehavior = (props) => {
121 121
         {/* onSuccess={(e) => onTabledatas(e)} */}
122 122
         <p onClick={() => router.push('/indexEcharts/userBehavior')}>
123 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>}
124
+          {!props.BuildSelectHide && <span style={{ fontSize: '0.09rem', color: '#888', marginLeft: '0.06rem' }}>最近七天</span>}
125 125
         </p>
126 126
         <div style={{ float: 'right', marginTop: '-40px', marginBottom: '20px' }}>
127 127
           {!props.BuildSelectHide && <BuildSelect slot='action' onChange={(e => handleBuildingChange(e))}></BuildSelect>}

+ 1
- 3
src/pages/indexEcharts/components/UserConversion.jsx Vedi File

@@ -19,11 +19,11 @@ const UserSource = props => {
19 19
   }, [])
20 20
 
21 21
  function UserConversionRate(params) {
22
+   
22 23
       request({
23 24
         ...apis.indexEcharts.userConversion,
24 25
         params,
25 26
       }).then(data => {
26
-        // console.log("data: ", data)
27 27
         setDataset(data, params.conversion)
28 28
       })
29 29
   }
@@ -72,8 +72,6 @@ const UserSource = props => {
72 72
       name: '转化率',
73 73
       radius: ['34%', '52%'],
74 74
       data: theCurrent,
75
-      // data:[ { name: '授权手机', value: 6 },
76
-      // { name: '其余', value: 5 },]
77 75
     },
78 76
   }
79 77
 

+ 2
- 1
src/pages/indexEcharts/components/UserSource.jsx Vedi File

@@ -28,6 +28,7 @@ const UserSource = (props) => {
28 28
       params,
29 29
     }).then((data) => {
30 30
       setData(data)
31
+      console.log(data,"datadatadatadatavvvdatadatav")
31 32
       props.onSuccess(data)
32 33
     })
33 34
   }
@@ -103,7 +104,7 @@ const UserSource = (props) => {
103 104
   return (
104 105
     <>
105 106
       <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>
107
+      <p onClick={()=>router.push('/indexEcharts/userSource')}><span style={{borderBottom:'1px solid #f02d40',color:'#333',fontSize:'0.12rem',fontWeight:'600'}}>用户来源</span> {!props.BuildSelectHide && <span style={{ fontSize: '0.09rem', color: '#888', marginLeft: '0.06rem' }}>最近七天</span>}</p>
107 108
 
108 109
         <EChart onClick={() => router.push('/indexEcharts/userSource')} options={baroptions} style={barstyle} />
109 110
 

+ 1
- 1
src/pages/indexEcharts/newUsers.jsx Vedi File

@@ -102,7 +102,7 @@ const header = props => {
102 102
         搜索
103 103
           </Button>
104 104
       <div>
105
-        <NewUsers endDate={endDate} startDate={startDate}  dataZoom={true} ></NewUsers>
105
+        <NewUsers BuildSelectHide={true} endDate={endDate} startDate={startDate}  dataZoom={true} ></NewUsers>
106 106
         {/* */}
107 107
       </div>
108 108
     </div>

+ 4
- 4
src/pages/indexEcharts/userBehavior.jsx Vedi File

@@ -103,7 +103,7 @@ const header = props => {
103 103
       padding: '32PX 28px',
104 104
       boxShadow: '0px 0px 16px 2px rgba(0,0,0,0.12)',
105 105
       borderRadius: '12px',
106
-      minHeight: '1000vh'
106
+      minHeight: '60vh'
107 107
     }}>
108 108
     <div>
109 109
     <Radio.Group buttonStyle="solid" defaultValue="a">
@@ -126,17 +126,17 @@ const header = props => {
126 126
      
127 127
       <div style={{ display: 'flex', margin: '24px 0' }}>
128 128
       <BuildSelect slot='action' onChange={(e => handleBuildingChange(e))}></BuildSelect>
129
-        <Select placeholder="所有事件组" style={{ width: '14%',minWidth:'160px',marginRight:'2%' }} onChange={handleChange}>
129
+        <Select placeholder="所有事件组" style={{ width: '14%',minWidth:'160px',marginLeft:'2%' }} onChange={handleChange}>
130 130
           <Option value="jack">Jack</Option>
131 131
           <Option value="lucy">Lucy</Option>
132 132
           <Option value="Yiminghe">yiminghe</Option>
133 133
         </Select>
134
-        <Select placeholder="请选择事件" style={{ width: '14%',minWidth:'160px',marginRight:'2%' }} onChange={handleChange}>
134
+        <Select placeholder="请选择事件" style={{ width: '14%',minWidth:'160px',marginLeft:'2%' }} onChange={handleChange}>
135 135
           <Option value="jack">Jack</Option>
136 136
           <Option value="lucy">Lucy</Option>
137 137
           <Option value="Yiminghe">yiminghe</Option>
138 138
         </Select>
139
-        <Select placeholder="请选择属性" style={{ width: '14%',minWidth:'160px' }} onChange={handleChange}>
139
+        <Select placeholder="请选择属性" style={{ width: '14%',minWidth:'160px',marginLeft:'2%' }} onChange={handleChange}>
140 140
           <Option value="jack">Jack</Option>
141 141
           <Option value="lucy">Lucy</Option>
142 142
           <Option value="Yiminghe">yiminghe</Option>

+ 27
- 71
src/pages/indexEcharts/userSource.jsx Vedi File

@@ -4,7 +4,6 @@ import UserSource from './components/UserSource.jsx';
4 4
 import UserSourcepie from './components/UserSourcepie.jsx';
5 5
 // import XForm, { FieldTypes } from '../../components/XForm';
6 6
 import moment from 'moment';
7
-
8 7
 import EChart from '../../components/EchartsTest/EChart';
9 8
 import request from '../../utils/request';
10 9
 import apis from '../../services/apis';
@@ -21,13 +20,11 @@ const header = props => {
21 20
 
22 21
   const [tableData, setTableData] = useState([])
23 22
   const [userType, setuserType] = useState([])
24
-
25 23
   const [endDate, setEndDate] = useState({})
26 24
   const [startDate, setStartDate] = useState({})
27 25
   let daterange = []
28 26
 
29 27
   useEffect(() => {
30
-
31 28
     setEndDate(new Date())
32 29
     setStartDate(moment().subtract(7, 'day').toDate())
33 30
     setuserType('all')
@@ -35,7 +32,7 @@ const header = props => {
35 32
 
36 33
   const { RangePicker } = DatePicker;
37 34
 
38
-  function onChangetime (dates, dateStrings) {
35
+  function onChangetime(dates, dateStrings) {
39 36
 
40 37
     daterange[1] = dateStrings[1]
41 38
     daterange[0] = dateStrings[0]
@@ -50,19 +47,12 @@ const header = props => {
50 47
 
51 48
   const getDataOf = (days) => () => {
52 49
 
53
-
54 50
     setEndDate(new Date())
55 51
     setStartDate(moment().subtract(days, 'day').toDate())
56 52
 
57 53
   }
58 54
 
59
-  function onChange (e) {
60
-
61
-    // console.log(`radio checked:${e.target.value}`);
62
-
63
-  }
64
-
65
-  function datalist () {
55
+  function datalist() {
66 56
 
67 57
     setEndDate(daterange[1])
68 58
     setStartDate(daterange[0])
@@ -70,28 +60,10 @@ const header = props => {
70 60
   }
71 61
 
72 62
 
73
-
74
-  // const userType = 'all'
75 63
   let tableTitle = ['日期']
76
-  // const dataset = data || {}
77
-
78
-  // function tableData () {
79
-
80
-  //   const data = (dataset.data || []).reduce((acc, item, index) => {
81
-  //     const { date, fromName, count, registered } = item
82
-  //     const num = userType === 'registered' ? registered : count
83
-
84
-  //     tableTitle = tableTitle.indexOf(fromName) > -1 ? tableTitle : tableTitle.concat(fromName) // eslint-disable-line
85
-  //     acc[date] = { ...acc[date], [`${fromName}`]: !num ? 0 : num }
86
-
87
-  //     return acc
88
-  //   }, {})
89
-
90
-  //   return Object.keys(data).map(x => ({ label: x, ...data[x] }))
91 64
 
92
-  // }
93 65
 
94
-  function onTabledatas (e) {
66
+  function onTabledatas(e) {
95 67
     const data = (e.data || []).reduce((acc, item, index) => {
96 68
       const { date, fromName, count, registered } = item
97 69
       const num = userType === 'registered' ? registered : count
@@ -111,47 +83,34 @@ const header = props => {
111 83
       title: '日期',
112 84
       dataIndex: 'label',
113 85
       key: 'label',
114
-      width: '20%',
86
+      width:'20%'
115 87
     },
88
+    {
89
+      title: '名片分享',
90
+      dataIndex: '名片分享',
91
+      key: '名片分享',
92
+    },
93
+    {
94
+      title: '生成海报',
95
+      dataIndex: '生成海报',
96
+      key: '生成海报',
97
+    },
98
+    {
99
+      title: '小程序搜索',
100
+      dataIndex: '小程序搜索',
101
+      key: '小程序搜索',
102
+    },
103
+    {
104
+      title: '好友分享',
105
+      dataIndex: '好友分享',
106
+      key: '好友分享',
116 107
 
117
-    // {
118
-    //   title: '名片分享',
119
-    //   dataIndex: '名片分享',
120
-    //   key: '名片分享',
121
-    //   width: '16%'
122
-
123
-    // },
124
-    // {
125
-    //   title: '好友分享',
126
-    //   dataIndex: '好友分享',
127
-    //   key: '好友分享',
128
-    //   width: '16%'
129
-    // },
130
-    // {
131
-    //   title: '小程序搜索',
132
-    //   dataIndex: '小程序搜索',
133
-    //   key: '小程序搜索',
134
-    //   width: '16%'
135
-    // },
136
-    // {
137
-    //   title: '线下扫码',
138
-    //   dataIndex: '线下扫码',
139
-    //   key: '线下扫码',
140
-    //   width: '16%'
141
-    // },
142
-    // {
143
-    //   title: '群分享',
144
-    //   dataIndex: '群分享',
145
-    //   key: '群分享',
146
-    //   width: '16%'
147
-    // },
148
-
149
-
108
+    },
150 109
 
151 110
 
152 111
   ]
153 112
 
154
-  function handleSelectChange (e) {
113
+  function handleSelectChange(e) {
155 114
 
156 115
     console.log(e)
157 116
     setuserType(e)
@@ -159,7 +118,6 @@ const header = props => {
159 118
 
160 119
 
161 120
 
162
-
163 121
   return (<>
164 122
     <div style={{
165 123
       backgroundColor: '#fff',
@@ -191,16 +149,14 @@ const header = props => {
191 149
           <div style={{
192 150
             width: '1060px',
193 151
             height: '560px',
194
-
195 152
             paddingTop: '40px',
196 153
             marginRight: ' 40px',
197 154
           }}>
198
-            <UserSource endDate={endDate} startDate={startDate} onSuccess={(e) => onTabledatas(e)}></UserSource>
155
+            <UserSource BuildSelectHide={true} endDate={endDate} startDate={startDate} onSuccess={(e) => onTabledatas(e)}></UserSource>
199 156
           </div>
200 157
           <div style={{
201 158
             width: '509px',
202 159
             height: '600px',
203
-
204 160
             paddingTop: '40px',
205 161
 
206 162
           }}>
@@ -212,7 +168,7 @@ const header = props => {
212 168
           <Option value='registered'>注册用户</Option>
213 169
         </Select>
214 170
 
215
-        <Table dataSource={tableData} columns={columns} pagination={false} scroll={{ y: 500 }}></Table>
171
+        <Table style={{marginTop:'20px'}} dataSource={tableData} columns={columns} pagination={false} scroll={{ y: 500 }}></Table>
216 172
       </div>
217 173
     </div>
218 174
   </>

+ 2
- 3
src/utils/request.js Vedi File

@@ -76,9 +76,8 @@ request.interceptors.response.use(async (response, options) => {
76 76
       });
77 77
       throw new Error(response.statusText);
78 78
     } else {
79
-      console.log('response: ', response)
80
-      console.log('response.headers: ', response.headers)
81
-      // console.log('response.blob(): ', response.blob())
79
+      // console.log('response: ', response)
80
+      // console.log('response.headers: ', response.headers)
82 81
       const { code, data, message } = await response.clone().json();
83 82
       if (code != 1000) {
84 83
         notification.error({