对比词云

dev
Esdese 3 years ago
parent 685a585cf3
commit 9d7cc7a423

@ -21,8 +21,11 @@ Component({
topActive: 0, //品牌传播
brandTop: [],
brandTopData: [],
cloudActive: 0, //词云
negativeWordActive: 0, //词云
positiveWordActive: 0, //词云
positiveWord: [],
positive:[],
negative:[],
negativeWord: [], //负面
},
lifetimes: {
@ -253,42 +256,44 @@ Component({
transformOption2: brokenLines(sBrand, dVal, dColor, dDate),
})
})
//正负词云
// app.globalData.request({
// action: 'getPositiveAndNegative0528C',
// token: wx.getStorageSync('token'),
// sType:'BrandOverview',
// sTimeType:'34',
// iContrastType:'1',
// sBrand: sBrand.join(',')
// }).then(res=>{
// let positiveWord = []
// let negativeWord = []
// for(let i of res){
// let pobj = {}
// let nobj = {}
// pobj.name = i.key
// nobj.name = i.key
// for(let j of i.value){
// if(j.key=='正面词'){
// pobj.value = j.value.map(ele=>{
// return [ele.key,ele.value]
// })
// }else{
// nobj.value = j.value.map(ele=>{
// return [ele.key,ele.value]
// })
// }
// }
// positiveWord.push(pobj)
// negativeWord.push(nobj)
// }
// this.setData({
// positiveWord,
// negativeWord
// })
// })
// 正负词云
app.globalData.request({
action: 'getPositiveAndNegative0528C',
token: wx.getStorageSync('token'),
sType:'BrandOverview',
sTimeType:'34',
iContrastType:'1',
sBrand: sBrand.join(',')
}).then(res=>{
let positiveWord = []
let negativeWord = []
console.log(res);
for(let i of res){
let pobj = {}
let nobj = {}
pobj.name = i.key
nobj.name = i.key
for(let j of i.value){
if(j.key=='正面词'){
pobj.value = j.value.map(ele=>{
return [ele.key,ele.value]
})
}else{
nobj.value = j.value.map(ele=>{
return [ele.key,ele.value]
})
}
}
positiveWord.push(pobj)
negativeWord.push(nobj)
}
this.setData({
positiveWord,
negativeWord,
positive:[positiveWord[0],positiveWord[1]],
negative:[negativeWord[0],negativeWord[1]],
})
})
},
},
@ -306,8 +311,19 @@ Component({
brandTop: obj[index]
})
},
changeModalHot2(event) {
changeNegative(event) {
let index = event.detail.index
this.setData({
negativeWordActive: index,
negative: [this.data.negativeWord[index*2],this.data.negativeWord[index*2+1]]
})
},
changePositive(event) {
let index = event.detail.index
this.setData({
positiveWordActive: index,
positive: [this.data.positiveWord[index*2],this.data.positiveWord[index*2+1]]
})
},
}
})

@ -105,27 +105,42 @@
</view>
</view>
<!-- 词云 -->
<!-- <view class="cloud_box">
<view class="cloud_box">
<view class="cloud_title">
<view style="width: 45%;">面词云对比</view>
<view style="width: 45%;">面词云对比</view>
<view style="width:50%;margin-right: 32rpx; ">
<van-tabs type="card" active="{{ topActive2 }}" color="#BBBBBB" bind:change="changeModalHot2">
<van-tabs type="card" active="{{positiveWordActive }}" color="#BBBBBB" bind:change="changePositive">
<van-tab title="组一"></van-tab>
<van-tab title="组二"></van-tab>
<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="cloud_content" wx:for="{{negativeWord}}" wx:for-index="index" wx:key="index">
<view class="">{{item.name}}</view>
<view class="">
<view>
<word-cloud canvasId="{{'w'+index}}" list="{{item.value}}" width="100%" height="200" color="#0284FF"></word-cloud>
<view class="cloud_content" wx:for="{{positive}}" wx:for-index="index" wx:key="index">
<view style="margin-left: 32rpx;">{{item.name}}</view>
<view style="margin-top: -140rpx;margin-left: 40rpx;">
<word-cloud canvasId="{{'w'+index}}" list="{{item.value}}" width="100%" height="230" color="#0284FF"></word-cloud>
</view>
</view>
</view>
<view class="cloud_box">
<view class="cloud_title">
<view style="width: 45%;">负面词云对比</view>
<view style="width:50%;margin-right: 32rpx; ">
<van-tabs type="card" active="{{ negativeWordActive }}" color="#BBBBBB" bind:change="changeNegative">
<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="cloud_content" wx:for="{{negative}}" wx:for-index="index" wx:key="index">
<view style="margin-left: 32rpx;">{{item.name}}</view>
<view style="margin-top: -140rpx;margin-left: 40rpx;">
<word-cloud canvasId="{{'w'+index}}" list="{{item.value}}" width="100%" height="230" color="#0284FF"></word-cloud>
</view>
</view>
</view> -->
</view>
<view class="chart_box">
<view class="chart_title">品牌事件对比</view>
<view class="table" style="height: 100%;">

@ -21,8 +21,11 @@ Component({
topActive: 0, //品牌传播
brandTop: [],
brandTopData: [],
cloudActive: 0, //词云
negativeWordActive: 0, //词云
positiveWordActive: 0, //词云
positiveWord: [],
positive:[],
negative:[],
negativeWord: [], //负面
},
lifetimes: {
@ -264,41 +267,44 @@ Component({
})
})
// 正负词云
// app.globalData.request({
// action: 'getPositiveAndNegative0528C',
// token: wx.getStorageSync('token'),
// sType:'BrandOverview',
// sTimeType:'34',
// iContrastType:'1',
// sBrand: sBrand.join(',')
// }).then(res=>{
// let positiveWord = []
// let negativeWord = []
// for(let i of res){
// let pobj = {}
// let nobj = {}
// pobj.name = i.key
// nobj.name = i.key
// for(let j of i.value){
// if(j.key=='正面词'){
// pobj.value = j.value.map(ele=>{
// return [ele.key,ele.value]
// })
// }else{
// nobj.value = j.value.map(ele=>{
// return [ele.key,ele.value]
// })
// }
// }
// positiveWord.push(pobj)
// negativeWord.push(nobj)
// }
// this.setData({
// positiveWord,
// negativeWord
// })
// })
app.globalData.request({
action: 'getPositiveAndNegative0528C',
token: wx.getStorageSync('token'),
sType:'BrandOverview',
...brandRatioTime,
iContrastType: '2',
sBrand:sBrand.join(','),
sSeriesName: SeriesName.join(',')
}).then(res=>{
let positiveWord = []
let negativeWord = []
console.log(res);
for(let i of res){
let pobj = {}
let nobj = {}
pobj.name = i.key
nobj.name = i.key
for(let j of i.value){
if(j.key=='正面词'){
pobj.value = j.value.map(ele=>{
return [ele.key,ele.value]
})
}else{
nobj.value = j.value.map(ele=>{
return [ele.key,ele.value]
})
}
}
positiveWord.push(pobj)
negativeWord.push(nobj)
}
this.setData({
positiveWord,
negativeWord,
positive:[positiveWord[0],positiveWord[1]],
negative:[negativeWord[0],negativeWord[1]],
})
})
},
},
@ -316,8 +322,19 @@ Component({
brandTop: obj[index]
})
},
changeModalHot2(event) {
changeNegative(event) {
let index = event.detail.index
this.setData({
negativeWordActive: index,
negative: [this.data.negativeWord[index*2],this.data.negativeWord[index*2+1]]
})
},
changePositive(event) {
let index = event.detail.index
this.setData({
positiveWordActive: index,
positive: [this.data.positiveWord[index*2],this.data.positiveWord[index*2+1]]
})
},
}
})

@ -105,27 +105,42 @@
</view>
</view>
<!-- 词云 -->
<!-- <view class="cloud_box">
<view class="cloud_box">
<view class="cloud_title">
<view style="width: 45%;">面词云对比</view>
<view style="width: 45%;">面词云对比</view>
<view style="width:50%;margin-right: 32rpx; ">
<van-tabs type="card" active="{{ topActive2 }}" color="#BBBBBB" bind:change="changeModalHot2">
<van-tabs type="card" active="{{positiveWordActive }}" color="#BBBBBB" bind:change="changePositive">
<van-tab title="组一"></van-tab>
<van-tab title="组二"></van-tab>
<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="cloud_content" wx:for="{{negativeWord}}" wx:for-index="index" wx:key="index">
<view class="">{{item.name}}</view>
<view class="">
<view>
<word-cloud canvasId="{{'w'+index}}" list="{{item.value}}" width="100%" height="200" color="#0284FF"></word-cloud>
<view class="cloud_content" wx:for="{{positive}}" wx:for-index="index" wx:key="index">
<view style="margin-left: 32rpx;">{{item.name}}</view>
<view style="margin-top: -140rpx;margin-left: 40rpx;">
<word-cloud canvasId="{{'w'+index}}" list="{{item.value}}" width="100%" height="230" color="#0284FF"></word-cloud>
</view>
</view>
</view>
<view class="cloud_box">
<view class="cloud_title">
<view style="width: 45%;">负面词云对比</view>
<view style="width:50%;margin-right: 32rpx; ">
<van-tabs type="card" active="{{ negativeWordActive }}" color="#BBBBBB" bind:change="changeNegative">
<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="cloud_content" wx:for="{{negative}}" wx:for-index="index" wx:key="index">
<view style="margin-left: 32rpx;">{{item.name}}</view>
<view style="margin-top: -140rpx;margin-left: 40rpx;">
<word-cloud canvasId="{{'w'+index}}" list="{{item.value}}" width="100%" height="230" color="#0284FF"></word-cloud>
</view>
</view>
</view> -->
</view>
<view class="chart_box">
<view class="chart_title">品牌事件对比</view>
<view class="table" style="height: 100%;">

@ -14,7 +14,10 @@ Component({
writer:[],
eventSpreadTop:[],
spreadActive:0,
eventSteps:[]
eventSteps:[],
negative:[],
positive:[],
negativeWordActive:0
},
lifetimes: {
attached() {
@ -44,7 +47,6 @@ Component({
return ele
})
for (let [index, i] of res.entries()) {
console.log(i);
Object.keys(i.Data).forEach(ele=>{
data[index].push(i.Data[ele])
})
@ -138,69 +140,69 @@ Component({
eventSteps:arr
})
})
// //销量对比
// app.globalData.request({
// action: 'getCheZhuCountTimeC',
// token: wx.getStorageSync('token'),
// sType: 'Marketing1C',
// iContrastType: '2',
// sBrand:sBrand.join(','),
// sSeriesName: SeriesName.join(',')
// }).then(res => {
// let dDate = []
// let dVal = new Array(res.Data[0].value.length).fill([])
// dVal = dVal.map(ele => {
// ele = JSON.stringify(ele)
// ele = JSON.parse(ele)
// return ele
// })
// for (let i of res.Data) {
// dDate.push(i.key)
// for (let [index, j] of i.value.entries()) {
// dVal[index].push(j)
// }
// }
// this.setData({
// salesDate: res.Time,
// transformOption2: brokenLines(SeriesName, dVal, dColor, dDate),
// })
// })
// 正负词云
// app.globalData.request({
// action: 'getPositiveAndNegative0528C',
// token: wx.getStorageSync('token'),
// sType:'BrandOverview',
// sTimeType:'34',
// iContrastType:'1',
// sBrand: sBrand.join(',')
// }).then(res=>{
// let positiveWord = []
// let negativeWord = []
// for(let i of res){
// let pobj = {}
// let nobj = {}
// pobj.name = i.key
// nobj.name = i.key
// for(let j of i.value){
// if(j.key=='正面词'){
// pobj.value = j.value.map(ele=>{
// return [ele.key,ele.value]
// })
// }else{
// nobj.value = j.value.map(ele=>{
// return [ele.key,ele.value]
// })
// }
// }
// positiveWord.push(pobj)
// negativeWord.push(nobj)
// }
// this.setData({
// positiveWord,
// negativeWord
// })
// })
//正面词云
let posPromise = []
let negPromise = []
for(let i of sRele){
posPromise.push(
app.globalData.request({
action: 'getPositiveC',
token: wx.getStorageSync('token'),
sType: 'EventContrast',
...brandRatioTime,
iContrastType: '3',
sRele:i
})
)
negPromise.push(
app.globalData.request({
action: 'getNegativeC',
token: wx.getStorageSync('token'),
sType: 'EventContrast',
...brandRatioTime,
iContrastType: '3',
sRele:i
})
)
}
Promise.all(posPromise).then(res=>{
let positive =[]
for(let [index,i] of res.entries()){
let obj = {}
if(index==0){
obj.Name='事件一'
}else{
obj.Name='事件二'
}
obj.value =[]
Object.keys(i[0].Data).forEach(ele=>{
obj.value.push([ele,i[0].Data[ele]])
})
positive.push(obj)
}
this.setData({
positive
})
})
Promise.all(negPromise).then(res=>{
let negative =[]
for(let [index,i] of res.entries()){
let obj = {}
if(index==0){
obj.Name='事件一'
}else{
obj.Name='事件二'
}
obj.value =[]
Object.keys(i[0].Data).forEach(ele=>{
obj.value.push([ele,i[0].Data[ele]])
})
negative.push(obj)
}
this.setData({
negative
})
})
},
},
@ -213,8 +215,11 @@ Component({
spreadActive: index,
})
},
changeModalHot2(event) {
changeNegative(event) {
let index = event.detail.index
this.setData({
negativeWordActive: index,
})
},
}
})

@ -151,25 +151,27 @@
/>
</scroll-view>
</view>
<!-- 词云 -->
<!-- <view class="cloud_box">
<view class="cloud_box">
<view class="cloud_title">
<view style="width: 45%;">负词云对比</view>
<view style="width: 45%;">负词云对比</view>
<view style="width:50%;margin-right: 32rpx; ">
<van-tabs type="card" active="{{ topActive2 }}" color="#BBBBBB" bind:change="changeModalHot2">
<van-tab title="组一"></van-tab>
<van-tab title="组二"></van-tab>
<van-tab title="组三"></van-tab>
<van-tabs type="card" active="{{ negativeWordActive }}" color="#BBBBBB" bind:change="changeNegative">
<van-tab title="正面"></van-tab>
<van-tab title="负面"></van-tab>
</van-tabs>
</view>
</view>
<view class="cloud_content" wx:for="{{negativeWord}}" wx:for-index="index" wx:key="index">
<view class="">{{item.name}}</view>
<view class="">
<view>
<word-cloud canvasId="{{'w'+index}}" list="{{item.value}}" width="100%" height="200" color="#0284FF"></word-cloud>
</view>
<view class="cloud_content" wx:for="{{positive}}" wx:for-index="index" wx:key="index" wx:if="{{negativeWordActive==0}}">
<view style="margin-left: 32rpx;">{{item.Name}}</view>
<view style="margin-top: -140rpx;margin-left: 40rpx;">
<word-cloud canvasId="{{'w'+index}}" list="{{item.value}}" width="100%" height="230" color="#0284FF"></word-cloud>
</view>
</view>
</view> -->
<view class="cloud_content" wx:for="{{negative}}" wx:for-index="index" wx:key="index" wx:if="{{negativeWordActive==1}}">
<view style="margin-left: 32rpx;">{{item.Name}}</view>
<view style="margin-top: -140rpx;margin-left: 40rpx;">
<word-cloud canvasId="{{'w'+index}}" list="{{item.value}}" width="100%" height="230" color="#0284FF"></word-cloud>
</view>
</view>
</view>

@ -20,7 +20,13 @@ Component({
brandTop: [],
brandTopData: [],
cloudActive: 0, //词云
evalOption:negaposiOption([],[])
evalOption:negaposiOption([],[]),
positiveWord:[],
negativeWord:[],
negativeWordActive:0,
positiveWordActive:0,
positive:[],
negative:[]
},
lifetimes: {
attached() {
@ -203,41 +209,43 @@ Component({
})
})
//正负词云
// app.globalData.request({
// action: 'getPositiveAndNegative0528C',
// token: wx.getStorageSync('token'),
// sType:'BrandOverview',
// sTimeType:'34',
// iContrastType:'1',
// sGuid: sGuid.join(',')
// }).then(res=>{
// let positiveWord = []
// let negativeWord = []
// for(let i of res){
// let pobj = {}
// let nobj = {}
// pobj.name = i.key
// nobj.name = i.key
// for(let j of i.value){
// if(j.key=='正面词'){
// pobj.value = j.value.map(ele=>{
// return [ele.key,ele.value]
// })
// }else{
// nobj.value = j.value.map(ele=>{
// return [ele.key,ele.value]
// })
// }
// }
// positiveWord.push(pobj)
// negativeWord.push(nobj)
// }
// this.setData({
// positiveWord,
// negativeWord
// })
app.globalData.request({
action: 'getPositiveAndNegative0528C',
token: wx.getStorageSync('token'),
sType:'BrandOverview',
...brandRatioTime,
iContrastType: '4',
sGuid: sGuid.join(',')
}).then(res=>{
let positiveWord = []
let negativeWord = []
for(let [index,i] of res.entries()){
let pobj = {}
let nobj = {}
pobj.name = themeName[index]
nobj.name = themeName[index]
for(let j of i.value){
if(j.key=='正面词'){
pobj.value = j.value.map(ele=>{
return [ele.key,ele.value]
})
}else{
nobj.value = j.value.map(ele=>{
return [ele.key,ele.value]
})
}
}
positiveWord.push(pobj)
negativeWord.push(nobj)
}
this.setData({
positiveWord,
negativeWord,
positive:[positiveWord[0],positiveWord[1]],
negative:[negativeWord[0],negativeWord[1]],
})
// })
})
},
},
@ -255,8 +263,19 @@ Component({
brandTop: obj[index]
})
},
changeModalHot2(event) {
changeNegative(event) {
let index = event.detail.index
this.setData({
negativeWordActive: index,
negative: [this.data.negativeWord[index*2],this.data.negativeWord[index*2+1]]
})
},
changePositive(event) {
let index = event.detail.index
this.setData({
positiveWordActive: index,
positive: [this.data.positiveWord[index*2],this.data.positiveWord[index*2+1]]
})
},
}
})

@ -99,24 +99,39 @@
</view>
</view>
<!-- 词云 -->
<!-- <view class="cloud_box">
<view class="cloud_box">
<view class="cloud_title">
<view style="width: 45%;">面词云对比</view>
<view style="width: 45%;">面词云对比</view>
<view style="width:50%;margin-right: 32rpx; ">
<van-tabs type="card" active="{{ topActive2 }}" color="#BBBBBB" bind:change="changeModalHot2">
<van-tabs type="card" active="{{positiveWordActive }}" color="#BBBBBB" bind:change="changePositive">
<van-tab title="组一"></van-tab>
<van-tab title="组二"></van-tab>
<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="cloud_content" wx:for="{{negativeWord}}" wx:for-index="index" wx:key="index">
<view class="">{{item.name}}</view>
<view class="">
<view>
<word-cloud canvasId="{{'w'+index}}" list="{{item.value}}" width="100%" height="200" color="#0284FF"></word-cloud>
<view class="cloud_content" wx:for="{{positive}}" wx:for-index="index" wx:key="index">
<view style="margin-left: 32rpx;">{{item.name}}</view>
<view style="margin-top: -140rpx;margin-left: 40rpx;">
<word-cloud canvasId="{{'w'+index}}" list="{{item.value}}" width="100%" height="230" color="#0284FF"></word-cloud>
</view>
</view>
</view>
<view class="cloud_box">
<view class="cloud_title">
<view style="width: 45%;">负面词云对比</view>
<view style="width:50%;margin-right: 32rpx; ">
<van-tabs type="card" active="{{ negativeWordActive }}" color="#BBBBBB" bind:change="changeNegative">
<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="cloud_content" wx:for="{{negative}}" wx:for-index="index" wx:key="index">
<view style="margin-left: 32rpx;">{{item.name}}</view>
<view style="margin-top: -140rpx;margin-left: 40rpx;">
<word-cloud canvasId="{{'w'+index}}" list="{{item.value}}" width="100%" height="230" color="#0284FF"></word-cloud>
</view>
</view>
</view> -->
</view>
Loading…
Cancel
Save