From cc99798ae56399ae124ad2828bf09f9dbd22d1ea Mon Sep 17 00:00:00 2001
From: zx <604444282@qq.com>
Date: Fri, 19 Nov 2021 10:41:22 +0800
Subject: [PATCH] =?UTF-8?q?zx-=E8=B0=83=E6=80=A7=E5=88=86=E5=B8=83-?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../MWDweiboTonalDistribution/index.vue | 77 ++++++-------------
.../weiboTonalDistribution/index.vue | 6 +-
2 files changed, 29 insertions(+), 54 deletions(-)
diff --git a/src/views/ModelWeiboDetails/MWDweiboTonalDistribution/index.vue b/src/views/ModelWeiboDetails/MWDweiboTonalDistribution/index.vue
index 119dd27..395a809 100644
--- a/src/views/ModelWeiboDetails/MWDweiboTonalDistribution/index.vue
+++ b/src/views/ModelWeiboDetails/MWDweiboTonalDistribution/index.vue
@@ -10,11 +10,14 @@
-
-
-
{{value.show}}
-
+
+
+ {{ item.show }}
+
@@ -29,64 +32,34 @@ export default {
form: {
token: "",
sBrand: "",
- sSeriesName: ""
- },
- obj: {
- bigV:{positive:0.1,negative:0.1,show:"个人大V"},
- media:{positive:0.1,negative:0.1,show:"媒体"},
- enterprice:{positive:0.1,negative:0.1,show:"企业"},
- goverment:{positive:0.1,negative:0.1,show:"政府"},
- famousPerson:{positive:0.1,negative:0.1,show:"名人"},
- uncertified:{positive:0.1,negative:0.1,show:"未认证"},
- certified:{positive:0.1,negative:0.1,show:"已认证"}
+ sSeriesName: "",
},
+ sourceData: []
};
},
created() {
this.form.token = this.getToken;
- this.form.sBrand = this.getBrand.brandname || '奥迪';
+ this.form.sBrand = this.getBrand.brandname || "奥迪";
this.form.sSeriesName = this.getModel.name;
this.getData();
},
methods: {
getData() {
let obj = Object.assign({}, this.getCtime2, this.form);
- getBoauthenAffectionsWeiBo0528(obj).then(res => {
- let data = res.data;
- data.forEach(ele => {
- switch (ele.key) {
- case ("个人大V"):
- this.obj.bigV.positive = ele.value[0]/(ele.value[0].value+ele.value[2].value+0.1); //index[0]为正面数据
- this.obj.bigV.negative = ele.value[2].value/(ele.value[0].value+ele.value[2].value+0.1); //index[2]为负面数据
- break;
- case ("媒体"):
- this.obj.media.positive = ele.value[0].value/(ele.value[0].value+ele.value[2].value+0.1);
- this.obj.media.negative = ele.value[2].value/(ele.value[0].value+ele.value[2].value+0.1);
- break;
- case ("企业"):
- this.obj.enterprice.positive = ele.value[0].value/(ele.value[0].value+ele.value[2].value+0.1);
- this.obj.enterprice.negative = ele.value[2].value/(ele.value[0].value+ele.value[2].value+0.1);
- break;
- case ("政府"):
- this.obj.goverment.positive = ele.value[0].value/(ele.value[0].value+ele.value[2].value+0.1);
- this.obj.goverment.negative = ele.value[2].value/(ele.value[0].value+ele.value[2].value+0.1);
- break;
- case ("名人"):
- this.obj.famousPerson.positive = ele.value[0].value/(ele.value[0].value+ele.value[2].value+0.1);
- this.obj.famousPerson.negative = ele.value[2].value/(ele.value[0].value+ele.value[2].value+0.1);
- break;
- case ("非认证"):
- this.obj.uncertified.positive = ele.value[0].value/(ele.value[0].value+ele.value[2].value+0.1);
- this.obj.uncertified.negative = ele.value[2].value/(ele.value[0].value+ele.value[2].value+0.1);
- break;
- case ("已认证"):
- this.obj.certified.positive = ele.value[0].value/(ele.value[0].value+ele.value[2].value+0.1);
- this.obj.certified.negative = ele.value[2].value/(ele.value[0].value+ele.value[2].value+0.1);
- break;
- default:
- break;
- }
- })
+ getBoauthenAffectionsWeiBo0528(obj).then((res) => {
+ let data = res.data;
+ let labelData = [];
+ data.forEach((ele) => {
+ let o = {
+ show: ele.key,
+ positive:
+ ele.value[0].value*1.0 / (ele.value[0].value*1.0 + ele.value[2].value*1.0),
+ negative:
+ ele.value[2].value*1.0 / (ele.value[0].value*1.0 + ele.value[2].value*1.0),
+ };
+ labelData.push(o);
+ });
+ this.sourceData = labelData;
});
},
},
diff --git a/src/views/WeiboDetails/weiboTonalDistribution/index.vue b/src/views/WeiboDetails/weiboTonalDistribution/index.vue
index 60ed63e..d4f868d 100644
--- a/src/views/WeiboDetails/weiboTonalDistribution/index.vue
+++ b/src/views/WeiboDetails/weiboTonalDistribution/index.vue
@@ -49,8 +49,10 @@ export default {
data.forEach(ele => {
let o = {
show: ele.key,
- positive: ele.value[0].value/(ele.value[0].value + ele.value[2].value),
- negative: ele.value[2].value/(ele.value[0].value + ele.value[2].value)
+ positive:
+ ele.value[0].value*1.0 / (ele.value[0].value*1.0 + ele.value[2].value*1.0),
+ negative:
+ ele.value[2].value*1.0 / (ele.value[0].value*1.0 + ele.value[2].value*1.0),
};
labelData.push(o);
});