|
@@ -99,6 +99,10 @@ export default {
|
99
|
99
|
source: [],
|
100
|
100
|
},
|
101
|
101
|
},
|
|
102
|
+ // ---- 用户来源 start -----
|
|
103
|
+ pieSecondChart: '', // 饼状图实例
|
|
104
|
+ columnarSecondChart: '', // 柱状图
|
|
105
|
+ // ---- 用户来源 end -----
|
102
|
106
|
};
|
103
|
107
|
},
|
104
|
108
|
computed: {
|
|
@@ -128,6 +132,15 @@ export default {
|
128
|
132
|
|
129
|
133
|
return [row2, row3];
|
130
|
134
|
}, this.tableData)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+ // ----- 用户来源 start -----
|
|
138
|
+ console.log('selectUserSource - pie: ', x.selectUserSource.pie)
|
|
139
|
+ console.log('selectUserSource - columnar: ', x.selectUserSource.columnar)
|
|
140
|
+ this.pie(x.selectUserSource.pie)
|
|
141
|
+ this.columnar(x.selectUserSource.columnar)
|
|
142
|
+ // ----- 用户来源 end --------
|
|
143
|
+
|
131
|
144
|
});;
|
132
|
145
|
},
|
133
|
146
|
toNewUsers() {
|
|
@@ -140,136 +153,13 @@ export default {
|
140
|
153
|
this.$router.push({ name: "behaviorAnalysis" });
|
141
|
154
|
},
|
142
|
155
|
drawLine() {
|
143
|
|
- // 基于准备好的dom,初始化echarts实例
|
144
|
|
- let firstChart = Echarts.init(this.$refs.firstChart);
|
145
|
|
- let labelOption = {
|
146
|
|
- normal: {
|
147
|
|
- show: true,
|
148
|
|
- position: "top",
|
149
|
|
- fontSize: 15,
|
150
|
|
- rich: {
|
151
|
|
- name: {
|
152
|
|
- textBorderColor: "#fff"
|
153
|
|
- }
|
154
|
|
- }
|
155
|
|
- }
|
156
|
|
- };
|
157
|
|
- // 绘制图表
|
158
|
|
- firstChart.setOption({
|
159
|
|
- color: ["#3688f8", "#7974ce"],
|
160
|
|
- backgroundColor: "#fff",
|
161
|
|
- tooltip: {
|
162
|
|
- trigger: "axis"
|
163
|
|
- },
|
164
|
|
- toolbox: {
|
165
|
|
- show: false,
|
166
|
|
- feature: {
|
167
|
|
- mark: { show: true },
|
168
|
|
- dataView: { show: true, readOnly: false },
|
169
|
|
- magicType: { show: true, type: ["bar"] },
|
170
|
|
- restore: { show: true },
|
171
|
|
- saveAsImage: { show: true }
|
172
|
|
- }
|
173
|
|
- },
|
174
|
|
- calculable: true,
|
175
|
|
- legend: {
|
176
|
|
- data: ["所有用户", "注册用户"]
|
177
|
|
- },
|
178
|
|
- xAxis: [
|
179
|
|
- {
|
180
|
|
- type: "category",
|
181
|
|
- axisLabel: {
|
182
|
|
- interval: 0,
|
183
|
|
- formatter: function(val) {
|
184
|
|
- // return val.split("").join("\n");
|
185
|
|
- return val;
|
186
|
|
- }
|
187
|
|
- },
|
188
|
|
- data: [
|
189
|
|
- "生成海报",
|
190
|
|
- "好友分享",
|
191
|
|
- "群分享",
|
192
|
|
- "线下扫码",
|
193
|
|
- "名片分享",
|
194
|
|
- "小程序搜索"
|
195
|
|
- ]
|
196
|
|
- }
|
197
|
|
- ],
|
198
|
|
- yAxis: [
|
199
|
|
- {
|
200
|
|
- type: "value",
|
201
|
|
- name: "人数(人)",
|
202
|
|
- axisTick: {
|
203
|
|
- inside: true
|
204
|
|
- },
|
205
|
|
- axisLabel: {
|
206
|
|
- formatter: "{value}"
|
207
|
|
- }
|
208
|
|
- }
|
209
|
|
- ],
|
210
|
|
- grid: {
|
211
|
|
- left: "1%",
|
212
|
|
- right: "1%",
|
213
|
|
- containLabel: true,
|
214
|
|
- y2: 10
|
215
|
|
- },
|
216
|
|
- series: [
|
217
|
|
- {
|
218
|
|
- name: "所有用户",
|
219
|
|
- type: "bar",
|
220
|
|
- smooth: true,
|
221
|
|
- label: labelOption,
|
222
|
|
- data: [78, 90, 13, 81, 170, 77]
|
223
|
|
- },
|
224
|
|
- {
|
225
|
|
- name: "注册用户",
|
226
|
|
- type: "bar",
|
227
|
|
- smooth: true,
|
228
|
|
- label: labelOption,
|
229
|
|
- data: [26, 49, 62, 45, 21, 89]
|
230
|
|
- }
|
231
|
|
- ]
|
232
|
|
- });
|
233
|
|
- // 饼图
|
234
|
|
- let secondChart = Echarts.init(this.$refs.secondChart);
|
235
|
|
- // 绘制图表
|
236
|
|
- secondChart.setOption({
|
237
|
|
- color: ["#7974ce","#f5749d","#3688f8"],
|
238
|
|
- tooltip: {
|
239
|
|
- trigger: "item",
|
240
|
|
- formatter: "{a} <br/>{b} : {c} ({d}%)"
|
241
|
|
- },
|
242
|
|
- legend: {
|
243
|
|
- orient: "vertical",
|
244
|
|
- left: "left",
|
245
|
|
- data: ["自主进入", "来源全民经纪人", "来源置业顾问"]
|
246
|
|
- },
|
247
|
|
- series: [
|
248
|
|
- {
|
249
|
|
- name: "用户来源",
|
250
|
|
- type: "pie",
|
251
|
|
- radius: "55%",
|
252
|
|
- center: ["50%", "60%"],
|
253
|
|
- // label: {
|
254
|
|
- // normal: {
|
255
|
|
- // position: "inner"
|
256
|
|
- // }
|
257
|
|
- // },
|
258
|
|
- data: [
|
259
|
|
- { value: 15, name: "自主进入" },
|
260
|
|
- { value: 30, name: "来源全民经纪人" },
|
261
|
|
- { value: 75, name: "来源置业顾问" }
|
262
|
|
- ],
|
263
|
|
- itemStyle: {
|
264
|
|
- emphasis: {
|
265
|
|
- shadowBlur: 10,
|
266
|
|
- shadowOffsetX: 0,
|
267
|
|
- shadowColor: "rgba(0, 0, 0, 0.5)"
|
268
|
|
- }
|
269
|
|
- }
|
270
|
|
- }
|
271
|
|
- ]
|
272
|
|
- });
|
|
156
|
+ // --- 用户来源 start -------
|
|
157
|
+ // 基于准备好的dom,初始化echarts实例
|
|
158
|
+ this.columnarSecondChart = Echarts.init(this.$refs.firstChart);
|
|
159
|
+ // 饼图
|
|
160
|
+ this.pieSecondChart = Echarts.init(this.$refs.secondChart);
|
|
161
|
+ // --- 用户来源 start -------
|
|
162
|
+
|
273
|
163
|
// 折线图
|
274
|
164
|
// let thirdChart = Echarts.init(this.$refs.thirdChart);
|
275
|
165
|
// 绘制图表
|
|
@@ -524,7 +414,150 @@ export default {
|
524
|
414
|
}
|
525
|
415
|
]
|
526
|
416
|
});
|
527
|
|
- }
|
|
417
|
+ },
|
|
418
|
+ // ---------- 用户来源 start --------------
|
|
419
|
+ pie (obj) { // 饼状图绘制
|
|
420
|
+ // 绘制图表
|
|
421
|
+ this.pieSecondChart.setOption({
|
|
422
|
+ color: ["#7974ce","#f5749d","#3688f8"],
|
|
423
|
+ tooltip: {
|
|
424
|
+ trigger: "item",
|
|
425
|
+ formatter: "{a} <br/>{b} : {c} ({d}%)"
|
|
426
|
+ },
|
|
427
|
+ legend: {
|
|
428
|
+ orient: "vertical",
|
|
429
|
+ left: "left",
|
|
430
|
+ data: ["自主进入", "来源全民经纪人", "来源置业顾问"]
|
|
431
|
+ },
|
|
432
|
+ series: [
|
|
433
|
+ {
|
|
434
|
+ name: "访问来源",
|
|
435
|
+ type: "pie",
|
|
436
|
+ radius: "55%",
|
|
437
|
+ center: ["50%", "60%"],
|
|
438
|
+ // label: {
|
|
439
|
+ // normal: {
|
|
440
|
+ // position: "inner"
|
|
441
|
+ // }
|
|
442
|
+ // },
|
|
443
|
+ data: [
|
|
444
|
+ { value: obj.person_null, name: "自主进入" },
|
|
445
|
+ { value: obj.person_estate_agent, name: "来源全民经纪人" },
|
|
446
|
+ { value: obj.person_realty_consultant, name: "来源置业顾问" }
|
|
447
|
+ ],
|
|
448
|
+ itemStyle: {
|
|
449
|
+ emphasis: {
|
|
450
|
+ shadowBlur: 10,
|
|
451
|
+ shadowOffsetX: 0,
|
|
452
|
+ shadowColor: "rgba(0, 0, 0, 0.5)"
|
|
453
|
+ }
|
|
454
|
+ }
|
|
455
|
+ }
|
|
456
|
+ ]
|
|
457
|
+ });
|
|
458
|
+ },
|
|
459
|
+ columnar(obj) { // 柱状图
|
|
460
|
+ // 活动名称
|
|
461
|
+ const fromName = []
|
|
462
|
+
|
|
463
|
+ // 注册人数
|
|
464
|
+ const registered = []
|
|
465
|
+
|
|
466
|
+ // 注册人数
|
|
467
|
+ const userCount = []
|
|
468
|
+
|
|
469
|
+ obj.map((item, index) => {
|
|
470
|
+ fromName.push(item.fromName)
|
|
471
|
+ registered.push(item.registered)
|
|
472
|
+ userCount.push(item.userCount)
|
|
473
|
+ })
|
|
474
|
+
|
|
475
|
+ let labelOption = {
|
|
476
|
+ normal: {
|
|
477
|
+ show: true,
|
|
478
|
+ position: "top",
|
|
479
|
+ fontSize: 15,
|
|
480
|
+ rich: {
|
|
481
|
+ name: {
|
|
482
|
+ textBorderColor: "#fff"
|
|
483
|
+ }
|
|
484
|
+ }
|
|
485
|
+ }
|
|
486
|
+ };
|
|
487
|
+ // 绘制图表
|
|
488
|
+ this.columnarSecondChart.setOption({
|
|
489
|
+ color: ["#3688f8", "#7974ce"],
|
|
490
|
+ backgroundColor: "#fff",
|
|
491
|
+ tooltip: {
|
|
492
|
+ trigger: "axis"
|
|
493
|
+ },
|
|
494
|
+ toolbox: {
|
|
495
|
+ show: false,
|
|
496
|
+ feature: {
|
|
497
|
+ mark: { show: true },
|
|
498
|
+ dataView: { show: true, readOnly: false },
|
|
499
|
+ magicType: { show: true, type: ["bar"] },
|
|
500
|
+ restore: { show: true },
|
|
501
|
+ saveAsImage: { show: true }
|
|
502
|
+ }
|
|
503
|
+ },
|
|
504
|
+ calculable: true,
|
|
505
|
+ legend: {
|
|
506
|
+ data: ["所有用户", "注册用户"]
|
|
507
|
+ },
|
|
508
|
+ xAxis: [
|
|
509
|
+ {
|
|
510
|
+ type: "category",
|
|
511
|
+ axisLabel: {
|
|
512
|
+ interval: 0,
|
|
513
|
+ formatter: function(val) {
|
|
514
|
+ // return val.split("").join("\n");
|
|
515
|
+ return val;
|
|
516
|
+ }
|
|
517
|
+ },
|
|
518
|
+ // data: ["生成海报", "好友分享", "群分享", "线下扫码", "名片分享", "小程序搜索"]
|
|
519
|
+ data: fromName
|
|
520
|
+ }
|
|
521
|
+ ],
|
|
522
|
+ yAxis: [
|
|
523
|
+ {
|
|
524
|
+ type: "value",
|
|
525
|
+ name: "人数(人)",
|
|
526
|
+ axisTick: {
|
|
527
|
+ inside: true
|
|
528
|
+ },
|
|
529
|
+ axisLabel: {
|
|
530
|
+ formatter: "{value}"
|
|
531
|
+ }
|
|
532
|
+ }
|
|
533
|
+ ],
|
|
534
|
+ grid: {
|
|
535
|
+ left: "1%",
|
|
536
|
+ right: "1%",
|
|
537
|
+ containLabel: true,
|
|
538
|
+ y2: 10
|
|
539
|
+ },
|
|
540
|
+ series: [
|
|
541
|
+ {
|
|
542
|
+ name: "所有用户",
|
|
543
|
+ type: "bar",
|
|
544
|
+ smooth: true,
|
|
545
|
+ label: labelOption,
|
|
546
|
+ // data: [78, 90, 13, 81, 170, 77]
|
|
547
|
+ data: registered
|
|
548
|
+ },
|
|
549
|
+ {
|
|
550
|
+ name: "注册用户",
|
|
551
|
+ type: "bar",
|
|
552
|
+ smooth: true,
|
|
553
|
+ label: labelOption,
|
|
554
|
+ // data: [26, 49, 62, 45, 21, 89]
|
|
555
|
+ data: userCount
|
|
556
|
+ }
|
|
557
|
+ ]
|
|
558
|
+ });
|
|
559
|
+ },
|
|
560
|
+ // ---------- 用户来源 end -------------
|
528
|
561
|
},
|
529
|
562
|
mounted() {
|
530
|
563
|
if (this.echartsInfo) {
|