From abe50fb4b76d859a2d2eb5f9e423097102f6c570 Mon Sep 17 00:00:00 2001 From: xiaowen <372193233@qq.com> Date: Wed, 7 Sep 2022 19:22:38 +0800 Subject: [PATCH] cxw-010203 --- components/word-cloud/WordCloud.js | 1 - components/word-cloud/index.js | 1 - .../pages/brandInsight/weiboInsight/index.js | 18 ++++++++++++++---- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/components/word-cloud/WordCloud.js b/components/word-cloud/WordCloud.js index 5affe1a..735650d 100644 --- a/components/word-cloud/WordCloud.js +++ b/components/word-cloud/WordCloud.js @@ -520,7 +520,6 @@ class WordCloud { this.settings.list.forEach(function(item) { that._putWord(item); }) - console.log(this.wordData) return this.wordData }; } diff --git a/components/word-cloud/index.js b/components/word-cloud/index.js index 94fd34e..74e3757 100644 --- a/components/word-cloud/index.js +++ b/components/word-cloud/index.js @@ -83,7 +83,6 @@ Component({ if (this.data.canvas) { const wordCloud = new WordCloud(this.data.canvas, this.data.options) wordData = wordCloud.start(); - console.log(wordData) this.setData({ wordData, width, diff --git a/pages/insight/pages/brandInsight/weiboInsight/index.js b/pages/insight/pages/brandInsight/weiboInsight/index.js index 2a602f6..d22bf64 100644 --- a/pages/insight/pages/brandInsight/weiboInsight/index.js +++ b/pages/insight/pages/brandInsight/weiboInsight/index.js @@ -5,6 +5,7 @@ import circleOption from '../../../../../components/option/circleOption' import pieOption from '../../../../../components/option/pieOption' import pictographicOption from '../../../../../components/option/percentRankOption' import negaposiOption from '../../../../../components/option/negaposiOption' +import {doStr} from "../../../../../utils/doStr" const app = getApp(); const dColor=['#FF4852','#FF6E25','#FFBF00','#20CC62','#00D6D6'] Component({ @@ -255,15 +256,20 @@ Component({ sEndTime: wx.getStorageSync('sEndTime') || '', sBrand: wx.getStorageSync('sBrand') || '', }).then(res => { - let dName = []; let dPositive = [];let dNegative = []; + let [dName,dPositive,dNegative] = [[], [], []]; res.forEach(ele => { dName.push(ele.key); let total = ele.value[0].value*1 + ele.value[2].value*1; // ele.value.forEach(e => { // total = total + e.value * 1 // }) - dPositive.push((ele.value[0].value * 100 / total).toFixed(0)); - dNegative.push((ele.value[2].value * 100 / total).toFixed(0)); + if(total == 0) { + dPositive.push(0) + dNegative.push(0) + } else { + dPositive.push((ele.value[0].value * 100 / total).toFixed(0)); + dNegative.push((ele.value[2].value * 100 / total).toFixed(0)); + } }); this.setData({affNegaposi: negaposiOption(dName,dPositive,dNegative)}) }); @@ -425,7 +431,11 @@ Component({ sQingGan: this.data.kolActive == 0?1:2, iSize: 6 }).then(res => { - this.setData({kolData: res}) + let data = res || []; + data.forEach(ele => { + ele._source.user_author = doStr(ele._source.user_author, 10) + }) + this.setData({kolData: data}) }); }, changeActive(event) {