微博对比

dev
Esdese 3 years ago
parent 72deeebb1d
commit a8aeabf4aa

@ -84,7 +84,7 @@ export default function sHistogram(dx = [], ds = [], data = [], color2 = []) {
axisLabel: {
color: '#999999', //x轴文本颜色
textStyle: {
fontSize: 9
fontSize: 6
}
}

@ -2,7 +2,8 @@
"usingComponents": {
"time-component":"/components/timecomponent/index",
"time-custom": "../../../../components/timeCustom/index",
"survey":"./survey/index"
"survey":"./survey/index",
"weibo":"./weibo/index"
},
"navigationBarTitleText": "品牌对比"
}

@ -30,7 +30,8 @@
<van-tab title="尾翼对比" wx:key="3"></van-tab>
</van-tabs>
<view class="content_box" wx:if="{{sonCom}}">
<survey></survey>
<survey wx:if="{{tabActive==0}}"></survey>
<weibo wx:if="{{tabActive==1}}"></weibo>
</view>
</view>

@ -198,6 +198,11 @@ Component({
xMsg.push(i.key)
}
let data = new Array(res.length).fill([])
data = data.map(ele => {
ele = JSON.stringify(ele)
ele = JSON.parse(ele)
return ele
})
for (let [index, i] of res.entries()) {
for (let j of i.value) {
data[index].push(j.value)

@ -0,0 +1,199 @@
import histogram from "../../../../../components/option/singleColumnarOption"
import stack from "../../../../../components/option/stackedBarChart"
import sHistogram from "../../../../../components/option/sColumnarOption"
import pictographicOption from '../../../../../components/option/pictographicOption'
const app = getApp()
const dColor = ['#FF4852', '#FF6E25', '#FFBF00', '#20CC62', '#00D6D6', '#00AAFF', '#7257FF']
Component({
data: {
imageUrl: getApp().globalData.imageUrl,
showChart: true,
brandOption: histogram([], [], [], '#0084FF'),
brandOption2: histogram([], [], [], '#20cc62'),
brandOption4: sHistogram(),
stackOption: stack([], [], ['#00aaff', '#20cc62', '#ff4852']),
boxArr: new Array(6),
topActive: 0, //品牌传播
brandTop: [],
brandTopData: [],
areaActive:0,
areaData:[],
},
lifetimes: {
attached() {
let brandRatioTime = wx.getStorageSync('brandRatioTime')
this.setData({
boxArr: wx.getStorageSync('brandData')
})
let sBrand = []
this.data.boxArr.forEach((ele) => {
if (ele) sBrand.push(ele.brandname)
})
//微博信息量对比
app.globalData.request({
action: 'getContrastCount0528C',
token: wx.getStorageSync('token'),
sType: 'BrandWeiBo',
...brandRatioTime,
iContrastType: '1',
sBrand: sBrand.join(',')
}).then(res => {
let dx = []
let dy = []
for (let i of res) {
dx.push(i.key)
dy.push(i.value)
}
this.setData({
brandOption: histogram(dx, dy, [], '#0084FF'),
})
})
//微博互动人数
app.globalData.request({
action: 'getInteractCount0528C',
token: wx.getStorageSync('token'),
sType: 'BrandWeiBo',
...brandRatioTime,
iContrastType: '1',
sBrand: sBrand.join(',')
}).then(res => {
let dx = []
let dy = []
for (let i of res) {
dx.push(i.key)
dy.push(i.value)
}
this.setData({
brandOption2: histogram(dx, dy, [], '#20cc62'),
})
})
//微博调性对比
app.globalData.request({
action: 'getAffectionsC',
token: wx.getStorageSync('token'),
sType: 'BrandWeiBo',
...brandRatioTime,
iContrastType: '1',
sBrand: sBrand.join(',')
}).then(res => {
let yMsg = []
let data = [
[],
[],
[]
]
for (let i of res) {
yMsg.push(i.Name)
data[0].push(i.Data['正面'])
data[1].push(i.Data['中性'])
data[2].push(i.Data['负面'])
}
this.setData({
stackOption: stack(yMsg, data, ['#00aaff', '#20cc62', '#ff4852'])
})
})
//微博大V
app.globalData.request({
action: 'getBoauthen0528C',
token: wx.getStorageSync('token'),
sType: 'BrandWeiBo',
...brandRatioTime,
iContrastType: '1',
sBrand: sBrand.join(',')
}).then(res => {
console.log(res);
let xMsg = []
for (let i of res[0].value) {
xMsg.push(i.key)
}
let data = new Array(res.length).fill([])
data = data.map(ele => {
ele = JSON.stringify(ele)
ele = JSON.parse(ele)
return ele
})
for (let [index, i] of res.entries()) {
for (let j of i.value) {
data[index].push(j.value)
}
}
console.log(data);
//横轴,数据,纵轴
this.setData({
brandOption4: sHistogram(xMsg, data, sBrand, [])
})
})
//微博内容方向对比
app.globalData.request({
action: 'getDirect0528C',
token: wx.getStorageSync('token'),
sType: 'BrandWeiBo',
...brandRatioTime,
iContrastType: '1',
sBrand: sBrand.join(',')
}).then(res => {
console.log(res);
this.setData({
brandTop: [res[0], res[1]],
brandTopData: res
})
})
//活跃用户信息
app.globalData.request({
action: 'getRegionWeiBoC',
token: wx.getStorageSync('token'),
sType: 'BrandWeiBo',
...brandRatioTime,
iContrastType: '1',
sBrand: sBrand.join(',')
}).then(res=>{
console.log(res)
let newRes =[]
for(let i of res){
let obj ={name:i.Name,region:[],value:[],sum:0}
let arr = []
Object.keys(i.Data).forEach(ele=>{
arr.push({name:ele,value:i.Data[ele]})
})
arr = arr.sort((a,b)=>{
return a.value *1 - b.value*1
})
for(let j of arr){
obj.region.push(j.name)
obj.value.push(j.value)
obj.sum+=j.value*1
}
newRes.push(obj)
}
newRes = newRes.map(ele=>{
ele.func=pictographicOption(ele.region,ele.value,ele.sum)
return ele
})
console.log(newRes);
this.setData({
areaData:newRes
})
})
},
},
methods: {
//品牌传播top媒体
changeModalHot(event) {
let obj = {
0: [this.data.brandTopData[0] || {}, this.data.brandTopData[1] || {}],
1: [this.data.brandTopData[2] || {}, this.data.brandTopData[3] || {}],
2: [this.data.brandTopData[4] || {}, this.data.brandTopData[5] || {}]
}
let index = event.detail.index
this.setData({
topActive: index,
brandTop: obj[index]
})
},
changeModalHot2(event) {
},
}
})

@ -0,0 +1,7 @@
{
"usingComponents": {
"c-echars": "../../../../../../components/c-echars/index",
"word-cloud": "../../../../../components/word-cloud/index"
},
"component": true
}

@ -0,0 +1,116 @@
<!-- <view class="chart_box">
<view class="chart_title">信息量趋势</view>
<view class="table">
<c-echars height="100%" showChart="{{showChart}}" canvasId="eventbar-canvas" chartId="eventbar" chartOption="{{transformOption}}"></c-echars>
</view>
</view> -->
<view class="chart_box">
<view class="chart_title">微博信息量对比</view>
<view class="table">
<c-echars showChart="{{showChart}}" canvasId="brandbar-canvas" chartId="brandbar" chartOption="{{brandOption}}" height="100%"></c-echars>
</view>
</view>
<view class="chart_box">
<view class="chart_title">微博互动人数</view>
<view class="table">
<c-echars showChart="{{showChart}}" canvasId="brandbar-canvas" chartId="brandbar" chartOption="{{brandOption2}}" height="100%"></c-echars>
</view>
</view>
<view class="chart_box">
<view class="chart_title">微博大V对比</view>
<view class="table">
<c-echars showChart="{{showChart}}" canvasId="brandbar-canvas" chartId="brandbar" chartOption="{{brandOption4}}" height="100%"></c-echars>
</view>
</view>
<view class="chart_box">
<view class="chart_title">微博调性对比</view>
<view class="table" style="height: 100%;">
<c-echars showChart="{{showChart}}" canvasId="brandbar-canvas" chartId="brandbar" chartOption="{{stackOption}}" height="100%"></c-echars>
</view>
</view>
<!--
<view class="chart_box">
<view class="chart_title">渠道分布</view>
<view class="table" style="height: 100%;">
<c-echars showChart="{{showChart}}" canvasId="brandbar-canvas" chartId="brandbar" chartOption="{{brandOption3}}" height="100%"></c-echars>
</view>
</view> -->
<view class="top_box">
<view class="top-title">
<view style="width: 45%;">微博内容方向对比</view>
<view style="width:50%;margin-right: 32rpx;">
<van-tabs type="card" active="{{ topActive }}" color="#BBBBBB" bind:change="changeModalHot">
<van-tab title="组一"></van-tab>
<van-tab title="组二" wx:if="{{brandTopData.length>2}}"></van-tab>
<van-tab title="组三" wx:if="{{brandTopData.length>4}}"></van-tab>
</van-tabs>
</view>
</view>
<view style="font-size:32rpx;margin-left:30rpx;">{{brandTop[0].Name}}</view>
<view class="rank_list">
<view class="ranking">
<view style=" display: inline-block;">排名</view>
<view style=" display: inline-block;margin-left: 172rpx;">车型</view>
<view style=" display: inline-block;margin-left: 272rpx;">传播量</view>
</view>
<view class="ranking_cell" wx:for="{{brandTop[0].Data}}" wx:for-item="item" wx:if="{{index>=0 && index<=4}}" wx:key="V">
<view wx:if="{{index==0}}">
<image src="{{imageUrl}}/img_diyi.png" style="height:46rpx;width:53rpx;"></image>
</view>
<view wx:elif="{{index==1}}">
<image src="{{imageUrl}}/img_dier.png" style="height:46rpx;width:53rpx;"></image>
</view>
<view wx:elif="{{index==2}}">
<image src="{{imageUrl}}/img_disan.png" style="height:46rpx;width:53rpx;"></image>
</view>
<view wx:else style="font-size: 28rpx;color: #999999;font-weight: bolder;width: 52rpx;">{{"0"+(index+1)}}</view>
<view style=" display: inline-block;font-size: 28rpx;width: 112rpx;margin-left: 166rpx; font-weight: bolder;">{{item.key}}</view>
<view style=" display: inline-block;font-size: 28rpx;width: 94rpx;margin-left: 194rpx;color: #0084ff;font-weight: bolder;">{{item.value}}</view>
</view>
</view>
<view class="henxian"></view>
<view style="font-size:32rpx;margin-left:30rpx;">{{brandTop[1].Name}}</view>
<view class="rank_list">
<view class="ranking" wx:if="{{brandTop[1].key}}">
<view style=" display: inline-block;">排名</view>
<view style=" display: inline-block;margin-left: 172rpx;">车型</view>
<view style=" display: inline-block;margin-left: 272rpx;">传播量</view>
</view>
<view class="ranking_cell" wx:for="{{brandTop[1].Data}}" wx:for-item="item" wx:if="{{index>=0 && index<=4}}" wx:key="S">
<view wx:if="{{index==0}}">
<image src="{{imageUrl}}/img_diyi.png" style="height:46rpx;width:53rpx;"></image>
</view>
<view wx:elif="{{index==1}}">
<image src="{{imageUrl}}/img_dier.png" style="height:46rpx;width:53rpx;"></image>
</view>
<view wx:elif="{{index==2}}">
<image src="{{imageUrl}}/img_disan.png" style="height:46rpx;width:53rpx;"></image>
</view>
<view wx:else style="font-size: 28rpx;color: #999999;font-weight: bolder;width: 52rpx;">{{"0"+(index+1)}}</view>
<view style=" display: inline-block;font-size: 28rpx;width: 112rpx;margin-left: 166rpx; font-weight: bolder;">{{item.key}}</view>
<view style=" display: inline-block;font-size: 28rpx;width: 94rpx;margin-left: 194rpx;color: #0084ff;font-weight: bolder;">{{item.value}}</view>
</view>
</view>
</view>
<view class="area_box">
<view class="top-title">
<view style="width: 45%;">活跃用户信息</view>
<view style="width:50%;margin-right: 32rpx;">
<van-tabs type="card" active="{{ topActive }}" color="#BBBBBB" bind:change="changeModalHot">
<van-tab title="组一"></van-tab>
<van-tab title="组二" wx:if="{{brandTopData.length>2}}"></van-tab>
<van-tab title="组三" wx:if="{{brandTopData.length>4}}"></van-tab>
</van-tabs>
</view>
</view>
<view class="chart_box">
<c-echars showChart="{{showChart}}" canvasId="region-canvas1" chartId="regionbar1" chartOption="{{areaData[0].func}}" height="100%"></c-echars>
</view>
</view>

@ -0,0 +1,77 @@
.chart_box{
margin-top: 24rpx;
width: 686rpx;
height: 486rpx;
padding-top:32rpx ;
background: white;
}
.chart_title{
font-size: 36rpx;
font-weight: bold;
margin-left:32rpx ;
}
.table{
height: 380rpx;
width: 95%;
margin-left:16rpx ;
margin-top: 32rpx;
}
.top_box{
margin-top: 24rpx;
width: 686rpx;
height: 1312rpx;
background:#ffffff;
border-radius: 8rpx;
padding-top:32rpx;
}
.top-title {
width: 100%;
font-size: 18px;
padding-left: 32rpx;
font-weight: 600;
color: #333333;
display: flex;
justify-content: flex-start;
}
.rank_list{
margin-left: 32rpx;
margin-top: 16rpx;
}
.ranking{
font-size: 12px;
font-weight: 400;
color: #999999;
}
.ranking_cell{
height: 104rpx;
display: flex ; align-items: center;
}
.henxian{
height: 2rpx;
background:linear-gradient(to right,white, #f2f1f1,white);
}
.cloud_box{
margin-top: 24rpx;
width: 686rpx;
height: 884rpx;
background:#ffffff;
border-radius: 8rpx;
padding-top:32rpx;
}
.cloud_title {
width: 100%;
font-size: 18px;
padding-left: 32rpx;
font-weight: 600;
color: #333333;
display: flex;
justify-content: flex-start;
}
.area_box{
margin-top: 24rpx;
width: 686rpx;
height: 970rpx;
background:#ffffff;
border-radius: 8rpx;
padding-top:32rpx;
}
Loading…
Cancel
Save