You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
190 lines
4.6 KiB
190 lines
4.6 KiB
<!--
|
|
* @Author: your name
|
|
* @Date: 2021-10-14 10:48:56
|
|
* @LastEditTime: 2021-11-09 13:16:07
|
|
* @LastEditors: Please set LastEditors
|
|
* @Description: In User Settings Edit
|
|
* @FilePath: /data-show/src/views/WeiboDetails/weiboCharacters/index.vue
|
|
-->
|
|
<template>
|
|
<div class="wc-outter" v-loading="load">
|
|
<v-label-div title="内容分布">
|
|
<div>
|
|
<v-tab-group
|
|
v-if="form.ilimitType == 1 || form.ilimitType == 2"
|
|
:btns="['认证', '精华', '图文']"
|
|
@change="handlerTab"
|
|
></v-tab-group>
|
|
</div>
|
|
</v-label-div>
|
|
<div class="wc-inner">
|
|
<div class="d1">
|
|
<v-echarts :opt="opt"></v-echarts>
|
|
</div>
|
|
<div class="d2">
|
|
<div v-if="labelArr.length<=3">
|
|
<v-label-ctx
|
|
v-for="(item, index) in labelArr"
|
|
:key="index"
|
|
:label="item.Key"
|
|
:cont="item.Value"
|
|
:percentage="((item.Value / total) * 100).toFixed(2) + '%'"
|
|
:color="colors[index]"
|
|
:eStyle="{ height: '8.54rem' }"
|
|
></v-label-ctx>
|
|
</div>
|
|
<vue-scroll v-if="labelArr.length>3">
|
|
<v-label-ctx
|
|
v-for="(item, index) in labelArr"
|
|
:key="index"
|
|
:label="item.Key"
|
|
:cont="item.Value"
|
|
:percentage="((item.Value / total) * 100).toFixed(2) + '%'"
|
|
:color="colors[index]"
|
|
:eStyle="{ height: '5.14rem' }"
|
|
></v-label-ctx>
|
|
</vue-scroll>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { getSexMergeWeiBo } from "@/api/WeiboDetails";
|
|
import {getHomeUserAttestationGroupBy, getHomeIsjingGroupBy, getHomePicboolGroupBy} from "@/api/KeyMediaHome/index.js";
|
|
import createOpt from "./opt";
|
|
export default {
|
|
name: "weiboCharacters",
|
|
data() {
|
|
return {
|
|
load: false,
|
|
form: {
|
|
sSource: '',
|
|
ilimitType: 0,
|
|
},
|
|
RegionWeiBo: [],
|
|
attestation: [],
|
|
sex: [],
|
|
total: 0,
|
|
labelArr: [],
|
|
|
|
opt: createOpt(),
|
|
colors: [
|
|
"#54BF93",
|
|
"#3373CC",
|
|
"#CC9D12",
|
|
"#f15c80",
|
|
"#e4d354",
|
|
"#8085e8",
|
|
"#8d4653",
|
|
"#91e8e1",
|
|
"#f7a35c",
|
|
"#90ed7d",
|
|
"#54BF93",
|
|
"#3373CC",
|
|
"#CC9D12",
|
|
"#f15c80",
|
|
"#e4d354",
|
|
"#8085e8",
|
|
"#8d4653",
|
|
"#91e8e1",
|
|
"#f7a35c",
|
|
"#90ed7d",
|
|
],
|
|
};
|
|
},
|
|
created() {
|
|
this.form.sSource = this.$route.query.source || "抖音";
|
|
if(this.form.sSource == '汽车之家') {
|
|
this.form.ilimitType = 1;
|
|
} else if (this.form.sSource == '懂车帝' && this.getCarCircle == 1) {
|
|
this.form.ilimitType = 2;
|
|
}
|
|
this.getData();
|
|
},
|
|
methods: {
|
|
// 获取后台数据
|
|
getData() {
|
|
let obj = Object.assign({}, this.getCtime2, this.form);
|
|
// this.load = true;
|
|
getHomeUserAttestationGroupBy(obj).then((res) => {
|
|
let data = res.data || {};
|
|
this.doVal(data)
|
|
this.load = false;
|
|
});
|
|
},
|
|
// 将对象变成数组
|
|
toArr(obj) {
|
|
let arr = [];
|
|
for (let key in obj) {
|
|
let o = {
|
|
key: key,
|
|
value: obj[key],
|
|
};
|
|
arr.push(o);
|
|
}
|
|
return arr;
|
|
},
|
|
// 给页面变化值赋值
|
|
doVal(arr = []) {
|
|
let total = 0;
|
|
arr.forEach((ele) => {
|
|
total += ele.Value * 1;
|
|
});
|
|
this.total = total;
|
|
this.labelArr = arr;
|
|
this.opt = createOpt(this.labelArr, this.colors);
|
|
},
|
|
// 切换数据
|
|
handlerTab(n) {
|
|
switch (n) {
|
|
case 0:
|
|
getHomeUserAttestationGroupBy(Object.assign({}, this.getCtime2, this.form)).then((res) => {
|
|
let data = res.data || {};
|
|
this.doVal(data)
|
|
this.load = false;
|
|
});
|
|
case 1:
|
|
getHomeIsjingGroupBy(Object.assign({}, this.getCtime2, this.form)).then((res) => {
|
|
let data = res.data || {};
|
|
this.doVal(data)
|
|
this.load = false;
|
|
});
|
|
break;
|
|
case 2:
|
|
getHomePicboolGroupBy(Object.assign({}, this.getCtime2, this.form)).then((res) => {
|
|
let data = res.data || {};
|
|
this.doVal(data)
|
|
this.load = false;
|
|
});
|
|
}
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style lang="less" scoped>
|
|
.wc-outter {
|
|
width: 618px;
|
|
height: 460px;
|
|
border: 2px solid #0f2a4d;
|
|
margin-left: 16px;
|
|
overflow: hidden;
|
|
.wc-inner {
|
|
width: 100%;
|
|
height: calc(100% - 48px);
|
|
display: flex;
|
|
justify-content: flex-start;
|
|
.d1 {
|
|
width: 280px;
|
|
height: 100%;
|
|
}
|
|
.d2 {
|
|
width: 300px;
|
|
margin-left: 16px;
|
|
}
|
|
}
|
|
}
|
|
</style>
|
|
|