|
@@ -1,5 +1,5 @@
|
|
<template>
|
|
<template>
|
|
- <div class="maincomponents">
|
|
|
|
|
|
+ <div class="maincomponents" ref="main">
|
|
<div class="card">
|
|
<div class="card">
|
|
<div class="cardtit">传播数据</div>
|
|
<div class="cardtit">传播数据</div>
|
|
<el-row style="margin: 10px 10px 0 10px; text-align: center">
|
|
<el-row style="margin: 10px 10px 0 10px; text-align: center">
|
|
@@ -13,6 +13,7 @@
|
|
<el-card class="box-card">
|
|
<el-card class="box-card">
|
|
<div class="pl">
|
|
<div class="pl">
|
|
<div class="platform" v-for="(item, i) in plays" :key="i">
|
|
<div class="platform" v-for="(item, i) in plays" :key="i">
|
|
|
|
+ <div class="line"></div>
|
|
<div class="numTitle" :style="'color:' + c[i % c.length]">
|
|
<div class="numTitle" :style="'color:' + c[i % c.length]">
|
|
{{ item.val | numform }}
|
|
{{ item.val | numform }}
|
|
</div>
|
|
</div>
|
|
@@ -24,7 +25,7 @@
|
|
</el-row>
|
|
</el-row>
|
|
</div>
|
|
</div>
|
|
<el-row>
|
|
<el-row>
|
|
- <el-col :span="16">
|
|
|
|
|
|
+ <el-col :span="15">
|
|
<div class="card">
|
|
<div class="card">
|
|
<div class="cardtit">传播量趋势</div>
|
|
<div class="cardtit">传播量趋势</div>
|
|
<canvas
|
|
<canvas
|
|
@@ -34,7 +35,7 @@
|
|
></canvas>
|
|
></canvas>
|
|
</div>
|
|
</div>
|
|
</el-col>
|
|
</el-col>
|
|
- <el-col :span="8" style="padding-left: 5px">
|
|
|
|
|
|
+ <el-col :span="9" style="padding-left: 5px">
|
|
<div class="card">
|
|
<div class="card">
|
|
<div class="cardtit">传播平台占比</div>
|
|
<div class="cardtit">传播平台占比</div>
|
|
<canvas
|
|
<canvas
|
|
@@ -204,13 +205,14 @@ export default {
|
|
}
|
|
}
|
|
if (!platform[v.platform] && platform[v.platform] !== 0) {
|
|
if (!platform[v.platform] && platform[v.platform] !== 0) {
|
|
platform[v.platform] = pli.length;
|
|
platform[v.platform] = pli.length;
|
|
- pli.push({ p: v.platform, val: v.playCount });
|
|
|
|
|
|
+ pli.push({ p: v.platform, val: v.playCount, a: 1 });
|
|
} else {
|
|
} else {
|
|
pli[platform[v.platform]] &&
|
|
pli[platform[v.platform]] &&
|
|
(pli[platform[v.platform]].val += v.playCount);
|
|
(pli[platform[v.platform]].val += v.playCount);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.plays = pli;
|
|
this.plays = pli;
|
|
|
|
+ this.pie1(pli);
|
|
});
|
|
});
|
|
qushiData(this.topic).then(r => {
|
|
qushiData(this.topic).then(r => {
|
|
this.line1(r);
|
|
this.line1(r);
|
|
@@ -221,26 +223,26 @@ export default {
|
|
title: this.topic,
|
|
title: this.topic,
|
|
}).then(r => {
|
|
}).then(r => {
|
|
this.platformList = (r || []).sort((a, b) => b.readTotal - a.readTotal);
|
|
this.platformList = (r || []).sort((a, b) => b.readTotal - a.readTotal);
|
|
- let obj = {},
|
|
|
|
- li = [];
|
|
|
|
- for (let i = 0; i < this.platformList.length; i++) {
|
|
|
|
- const v = this.platformList[i];
|
|
|
|
- let l = v.list || [];
|
|
|
|
- l.map(o => {
|
|
|
|
- if (!obj[o.platform] && obj[o.platform] !== 0) {
|
|
|
|
- obj[o.platform] = li.length;
|
|
|
|
- li.push({
|
|
|
|
- platform: o.platform || "",
|
|
|
|
- publishCount: o.publishCount || 0,
|
|
|
|
- readCount: o.readCount || 0,
|
|
|
|
- });
|
|
|
|
- } else {
|
|
|
|
- li[obj[o.platform]].publishCount = o.publishCount;
|
|
|
|
- li[obj[o.platform]].readCount = o.readCount;
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- this.pie1(li);
|
|
|
|
|
|
+ // let obj = {},
|
|
|
|
+ // li = [];
|
|
|
|
+ // for (let i = 0; i < this.platformList.length; i++) {
|
|
|
|
+ // const v = this.platformList[i];
|
|
|
|
+ // let l = v.list || [];
|
|
|
|
+ // l.map(o => {
|
|
|
|
+ // if (!obj[o.platform] && obj[o.platform] !== 0) {
|
|
|
|
+ // obj[o.platform] = li.length;
|
|
|
|
+ // li.push({
|
|
|
|
+ // platform: o.platform || "",
|
|
|
|
+ // publishCount: o.publishCount || 0,
|
|
|
|
+ // readCount: o.readCount || 0,
|
|
|
|
+ // });
|
|
|
|
+ // } else {
|
|
|
|
+ // li[obj[o.platform]].publishCount = o.publishCount;
|
|
|
|
+ // li[obj[o.platform]].readCount = o.readCount;
|
|
|
|
+ // }
|
|
|
|
+ // });
|
|
|
|
+ // }
|
|
|
|
+ // this.pie1(li);
|
|
});
|
|
});
|
|
this.grtzhData();
|
|
this.grtzhData();
|
|
bumenList().then(r => {
|
|
bumenList().then(r => {
|
|
@@ -273,7 +275,7 @@ export default {
|
|
pageSize: this.pageSize,
|
|
pageSize: this.pageSize,
|
|
title: this.topic,
|
|
title: this.topic,
|
|
};
|
|
};
|
|
- this.dep && this.dep !== '全部' && (p.depName = this.dep)
|
|
|
|
|
|
+ this.dep && this.dep !== "全部" && (p.depName = this.dep);
|
|
t[0] && (p.startTime = t[0]);
|
|
t[0] && (p.startTime = t[0]);
|
|
t[1] && (p.endTime = t[1]);
|
|
t[1] && (p.endTime = t[1]);
|
|
zhanghaoData(p).then(r => {
|
|
zhanghaoData(p).then(r => {
|
|
@@ -353,7 +355,10 @@ export default {
|
|
linechart
|
|
linechart
|
|
.line()
|
|
.line()
|
|
.position("dt*playCount")
|
|
.position("dt*playCount")
|
|
- .color("l(90) 0:#1890FF 1:#f7f7f7")
|
|
|
|
|
|
+ .color("#1890FF")
|
|
|
|
+ .style({
|
|
|
|
+ lineWidth: 1,
|
|
|
|
+ })
|
|
.shape("smooth");
|
|
.shape("smooth");
|
|
linechart.render();
|
|
linechart.render();
|
|
},
|
|
},
|
|
@@ -379,31 +384,10 @@ export default {
|
|
grid: null,
|
|
grid: null,
|
|
});
|
|
});
|
|
|
|
|
|
- barchart.axis("depName", {
|
|
|
|
- label: function label(text, index, total) {
|
|
|
|
- const textCfg = {};
|
|
|
|
- if (index === 0) {
|
|
|
|
- textCfg.textAlign = "left";
|
|
|
|
- } else if (index === total - 1) {
|
|
|
|
- textCfg.textAlign = "right";
|
|
|
|
- }
|
|
|
|
- return textCfg;
|
|
|
|
- },
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
barchart.coord({
|
|
barchart.coord({
|
|
transposed: true,
|
|
transposed: true,
|
|
});
|
|
});
|
|
- barchart.tooltip({
|
|
|
|
- showItemMarker: false,
|
|
|
|
- triggerOn: ["touchstart", "touchmove"],
|
|
|
|
- onShow: function onShow(ev) {
|
|
|
|
- const items = ev.items;
|
|
|
|
- items[0].name = null;
|
|
|
|
- items[0].name = items[0].title;
|
|
|
|
- items[0].value = "¥ " + items[0].value;
|
|
|
|
- },
|
|
|
|
- });
|
|
|
|
|
|
+ barchart.tooltip(false);
|
|
|
|
|
|
barchart
|
|
barchart
|
|
.interval()
|
|
.interval()
|
|
@@ -419,7 +403,7 @@ export default {
|
|
const point = barchart.getPosition(obj);
|
|
const point = barchart.getPosition(obj);
|
|
const text = group.addShape("text", {
|
|
const text = group.addShape("text", {
|
|
attrs: {
|
|
attrs: {
|
|
- x: point.x + 25,
|
|
|
|
|
|
+ x: point.x + 30,
|
|
y: point.y + offset + 13,
|
|
y: point.y + offset + 13,
|
|
text: that.numform(obj.readCount),
|
|
text: that.numform(obj.readCount),
|
|
textAlign: "center",
|
|
textAlign: "center",
|
|
@@ -437,15 +421,14 @@ export default {
|
|
piechart = new F2.Chart({
|
|
piechart = new F2.Chart({
|
|
id: "piechart",
|
|
id: "piechart",
|
|
pixelRatio: window.devicePixelRatio,
|
|
pixelRatio: window.devicePixelRatio,
|
|
- height: 296,
|
|
|
|
|
|
+ height: (this.$refs.main.offsetWidth / 24) * 7.5,
|
|
});
|
|
});
|
|
let lis = [];
|
|
let lis = [];
|
|
for (let i = 0; i < li.length; i++) {
|
|
for (let i = 0; i < li.length; i++) {
|
|
const v = li[i];
|
|
const v = li[i];
|
|
- if (!v.readCount || v.readCount <= 0) continue;
|
|
|
|
|
|
+ if (!v.val || v.val <= 0) continue;
|
|
lis.push(v);
|
|
lis.push(v);
|
|
}
|
|
}
|
|
-
|
|
|
|
piechart.source(lis);
|
|
piechart.source(lis);
|
|
piechart.tooltip(false);
|
|
piechart.tooltip(false);
|
|
piechart.legend(false);
|
|
piechart.legend(false);
|
|
@@ -456,16 +439,16 @@ export default {
|
|
});
|
|
});
|
|
// 添加饼图文本
|
|
// 添加饼图文本
|
|
piechart.pieLabel({
|
|
piechart.pieLabel({
|
|
- sidePadding: 5,
|
|
|
|
|
|
+ anchorOffset: 0,
|
|
label1: function label1(data, color) {
|
|
label1: function label1(data, color) {
|
|
return {
|
|
return {
|
|
- text: data.platform,
|
|
|
|
|
|
+ text: data.p,
|
|
fill: color,
|
|
fill: color,
|
|
};
|
|
};
|
|
},
|
|
},
|
|
label2: function label2(data) {
|
|
label2: function label2(data) {
|
|
return {
|
|
return {
|
|
- text: that.numform(data.readCount),
|
|
|
|
|
|
+ text: ((data.val / that.playT) * 100).toFixed(2) + "%",
|
|
fill: "#808080",
|
|
fill: "#808080",
|
|
fontWeight: "bold",
|
|
fontWeight: "bold",
|
|
};
|
|
};
|
|
@@ -474,8 +457,8 @@ export default {
|
|
piechart.axis(false);
|
|
piechart.axis(false);
|
|
piechart
|
|
piechart
|
|
.interval()
|
|
.interval()
|
|
- .position("a*readCount")
|
|
|
|
- .color("platform", [
|
|
|
|
|
|
+ .position("a*val")
|
|
|
|
+ .color("p", [
|
|
"#1890FF",
|
|
"#1890FF",
|
|
"#13C2C2",
|
|
"#13C2C2",
|
|
"#2FC25B",
|
|
"#2FC25B",
|
|
@@ -534,11 +517,24 @@ export default {
|
|
}
|
|
}
|
|
.maincomponents .platform {
|
|
.maincomponents .platform {
|
|
flex: 1;
|
|
flex: 1;
|
|
|
|
+ position: relative;
|
|
|
|
+}
|
|
|
|
+.maincomponents .line {
|
|
|
|
+ border-right: 1px solid #eaeaea;
|
|
|
|
+ width: 1px;
|
|
|
|
+ height: 30px;
|
|
|
|
+ top: 15px;
|
|
|
|
+ position: absolute;
|
|
}
|
|
}
|
|
.maincomponents .el-table {
|
|
.maincomponents .el-table {
|
|
color: #3b3b3b;
|
|
color: #3b3b3b;
|
|
}
|
|
}
|
|
|
|
+.maincomponents .el-table__header-wrapper {
|
|
|
|
+ border-radius: 5px;
|
|
|
|
+ overflow: hidden;
|
|
|
|
+}
|
|
.maincomponents .has-gutter th {
|
|
.maincomponents .has-gutter th {
|
|
background: #eceff5;
|
|
background: #eceff5;
|
|
|
|
+ color: #3b3b3b;
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|