zx-调性分布-修改

prod
张雄 3 years ago
parent fe4bfd9a6d
commit cc99798ae5

@ -10,11 +10,14 @@
<div class="wtd-outter"> <div class="wtd-outter">
<v-label-div title="调性分布"> </v-label-div> <v-label-div title="调性分布"> </v-label-div>
<div class="wtd-inner"> <div class="wtd-inner">
<div class="wtd-item" v-for="(value,key) in obj" <div class="wtd-item" v-for="(item, index) in sourceData" :key="index">
:key="key"> <v-percent :percentage="item.positive"></v-percent>
<v-percent :percentage="value.positive"></v-percent> <span class="s1">{{ item.show }}</span>
<span class="s1">{{value.show}}</span> <v-percent
<v-percent color="#b78e11" :percentage="value.negative" reverse></v-percent> color="#b78e11"
:percentage="item.negative"
reverse
></v-percent>
</div> </div>
</div> </div>
</div> </div>
@ -29,64 +32,34 @@ export default {
form: { form: {
token: "", token: "",
sBrand: "", sBrand: "",
sSeriesName: "" 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:"已认证"}
}, },
sourceData: []
}; };
}, },
created() { created() {
this.form.token = this.getToken; this.form.token = this.getToken;
this.form.sBrand = this.getBrand.brandname || '奥迪'; this.form.sBrand = this.getBrand.brandname || "奥迪";
this.form.sSeriesName = this.getModel.name; this.form.sSeriesName = this.getModel.name;
this.getData(); this.getData();
}, },
methods: { methods: {
getData() { getData() {
let obj = Object.assign({}, this.getCtime2, this.form); let obj = Object.assign({}, this.getCtime2, this.form);
getBoauthenAffectionsWeiBo0528(obj).then(res => { getBoauthenAffectionsWeiBo0528(obj).then((res) => {
let data = res.data; let data = res.data;
data.forEach(ele => { let labelData = [];
switch (ele.key) { data.forEach((ele) => {
case ("个人大V"): let o = {
this.obj.bigV.positive = ele.value[0]/(ele.value[0].value+ele.value[2].value+0.1); //index[0] show: ele.key,
this.obj.bigV.negative = ele.value[2].value/(ele.value[0].value+ele.value[2].value+0.1); //index[2] positive:
break; ele.value[0].value*1.0 / (ele.value[0].value*1.0 + ele.value[2].value*1.0),
case ("媒体"): negative:
this.obj.media.positive = ele.value[0].value/(ele.value[0].value+ele.value[2].value+0.1); ele.value[2].value*1.0 / (ele.value[0].value*1.0 + ele.value[2].value*1.0),
this.obj.media.negative = ele.value[2].value/(ele.value[0].value+ele.value[2].value+0.1); };
break; labelData.push(o);
case ("企业"): });
this.obj.enterprice.positive = ele.value[0].value/(ele.value[0].value+ele.value[2].value+0.1); this.sourceData = labelData;
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;
}
})
}); });
}, },
}, },

@ -49,8 +49,10 @@ export default {
data.forEach(ele => { data.forEach(ele => {
let o = { let o = {
show: ele.key, show: ele.key,
positive: ele.value[0].value/(ele.value[0].value + ele.value[2].value), positive:
negative: ele.value[2].value/(ele.value[0].value + ele.value[2].value) 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); labelData.push(o);
}); });

Loading…
Cancel
Save