diff --git a/components/indexCom/atlasChild/index.js b/components/indexCom/atlasChild/index.js index 88b1168..c7fb57f 100644 --- a/components/indexCom/atlasChild/index.js +++ b/components/indexCom/atlasChild/index.js @@ -74,6 +74,7 @@ Component({ arr1.push(o) }) const resArr = arr1.slice(0,50) + console.log(resArr); this.setData({ HotWords: resArr, showTu: true diff --git a/components/option/multipleColumn.js b/components/option/multipleColumn.js index 6adbd73..2809021 100644 --- a/components/option/multipleColumn.js +++ b/components/option/multipleColumn.js @@ -1,7 +1,6 @@ export default function multipleColumn(columnName = [], xMsg = [], data = []) { const valData = [] const color = ['#ff4852', '#ff6e25', '#ffbf00', '#20cc62', '#00d6d6', '#0084ff'] - console.log(xMsg); for (let [index, i] of data.entries()) { let ojb = { name: i.name, diff --git a/components/option/stackedBarChart.js b/components/option/stackedBarChart.js index 40484dd..99414ae 100644 --- a/components/option/stackedBarChart.js +++ b/components/option/stackedBarChart.js @@ -2,7 +2,6 @@ export default function stack(yName=[],data=[],color=[]){ let msgData = [] let arr = ['正面','中性','负面',] for(let [index,i] of data.entries()){ - console.log(i); let obj = { type: 'bar', stack: 'total', diff --git a/components/option/stackingLineOption.js b/components/option/stackingLineOption.js index fff0fba..be25eec 100644 --- a/components/option/stackingLineOption.js +++ b/components/option/stackingLineOption.js @@ -1,130 +1,133 @@ // 多折线 export default function brokenLines(dName = [], dValue = [], dColor = [], dx = []) { - return { - tooltip: { - trigger: "axis", - backgroundColor: "#08182F", - color: "#fff", - borderColor: "#3373CC", - textStyle: { - color: "#fff", //设置文字颜色 - fontSize: 9 + return { + tooltip: { + trigger: "axis", + backgroundColor: "#08182F", + color: "#fff", + borderColor: "#3373CC", + textStyle: { + color: "#fff", //设置文字颜色 + fontSize: 9 + }, + extraCssText: "box-shadow: 0px 0px 10px 0px #3373CC;", + confine: true, }, - extraCssText: "box-shadow: 0px 0px 10px 0px #3373CC;", - confine: true, - }, - legend: { - icon: 'rectangle', //data图标样式 - itemWidth: 8, //data图标大小 - itemHeight: 8, - left: 5, - textStyle: { - fontSize: 8, - fontWeight: 400 - }, - // data: ['微博', '其他','短视频', '微信','APP', '论坛', '新闻'], - data: dName - // color:['#FF4852','#FF6E25','#FFBF00','#20CC62','#00D6D6','#00AAFF','#7257FF'], - }, //图表位置 - grid: { - left: 7, - right: 7, - bottom: 7, - top: 36, - containLabel: true - }, - yAxis: [{ - type: 'value', - axisTick: { - show: false //去除刻度线 - }, - axisLine: { - show: false //去除轴线 - }, - axisLabel: { - color: '#999999', //y轴文本颜色 - textStyle: { - fontSize: 9 + legend: { + icon: 'rectangle', //data图标样式 + itemWidth: 8, //data图标大小 + itemHeight: 8, + left: 5, + textStyle: { + fontSize: 8, + fontWeight: 400 + }, + // data: ['微博', '其他','短视频', '微信','APP', '论坛', '新闻'], + data: dName + // color:['#FF4852','#FF6E25','#FFBF00','#20CC62','#00D6D6','#00AAFF','#7257FF'], + }, //图表位置 + grid: { + left: 7, + right: 7, + bottom: 7, + top: 36, + containLabel: true }, - formatter: (value) => { - if (value >= 10000) { - value = (value / 10000) + '万'; - } - return value; - } - }, - splitLine: { //分割线 - // lineStyle:{ - // // color:"#2d3436" + yAxis: [{ + type: 'value', + axisTick: { + show: false //去除刻度线 + }, + axisLine: { + show: false //去除轴线 + }, + axisLabel: { + color: '#999999', //y轴文本颜色 + textStyle: { + fontSize: 9 + }, + formatter: (value) => { + if (value >= 10000) { + value = (value / 10000) + '万'; + } + return value; + } + }, + splitLine: { //分割线 + // lineStyle:{ + // // color:"#2d3436" - // } - show: true, - lineStyle: { - type: 'dashed', - color: '#E8E8E8', - } - } - }], - xAxis: [{ - type: 'category', - // data: ['00:00', '04:00', '08:00', '12:00', '16:00', '20:00', '24:00'], - data: dx, - axisTick: { - show: false //去除刻度线 - }, - axisLine: { - show: false, //去除轴线 - }, - axisLabel: { - color: '#999999', //x轴文本颜色 - textStyle: { - fontSize: 9 - }, - formatter: (value) => { - let rex = "00:00:00"; - let isCont = false; - let str = value; - for (let i = 0; i < dx.length - 1; i++) { - //连续两条带小时 - if (dx[i].indexOf(rex) === -1 && dx[i + 1].indexOf(rex) === -1) { - isCont = true; - break; + // } + show: true, + lineStyle: { + type: 'dashed', + color: '#E8E8E8', + } } - } - if (isCont == true) { - str = value.substring(10, 16) - } else { - str = value.substring(5, 10) - } - return str; - } + }], + xAxis: [{ + type: 'category', + // data: ['00:00', '04:00', '08:00', '12:00', '16:00', '20:00', '24:00'], + data: dx, + axisTick: { + show: false //去除刻度线 + }, + axisLine: { + show: false, //去除轴线 + }, + axisLabel: { + color: '#999999', //x轴文本颜色 + textStyle: { + fontSize: 9 + }, + formatter: (value) => { + let rex = "00:00:00"; + let isCont = false; + let str = value; + for (let i = 0; i < dx.length - 1; i++) { + //连续两条带小时 + if (dx[i].indexOf(rex) === -1 && dx[i + 1].indexOf(rex) === -1) { + isCont = true; + break; + } + } + if(value.length==7){ + return str + } + if (isCont == true) { + str = value.substring(10, 16) + } else { + str = value.substring(5, 10) + } + return str; + } - } - }], - series: Multiple(dName, dValue, dColor) - } + } + }], + series: Multiple(dName, dValue, dColor) + } } function Multiple(dName = [], dValue = [], dColor = []) { - // MS true为单fales为双 - let list = [] - for (let i = 0; i < dName.length; i++) { - // const element = array[index]; + // MS true为单fales为双 + let list = [] + for (let i = 0; i < dName.length; i++) { + // const element = array[index]; - list.push({ - name: dName[i], - type: 'line', - symbol: 'none', //去圆点 - data: dValue[i], - itemStyle: { - normal: { - color: dColor[i], - lineStyle: { - color: dColor[i] - } - } - } - }) - } - return list; + list.push({ + name: dName[i], + type: 'line', + symbol: 'none', //去圆点 + data: dValue[i], + itemStyle: { + normal: { + color: dColor[i], + lineStyle: { + color: dColor[i] + } + } + } + }) + } + return list; } \ No newline at end of file diff --git a/pages/varComm/pages/brandRatio/survey/index.js b/pages/varComm/pages/brandRatio/survey/index.js index d215904..fa8308c 100644 --- a/pages/varComm/pages/brandRatio/survey/index.js +++ b/pages/varComm/pages/brandRatio/survey/index.js @@ -7,14 +7,22 @@ const app = getApp() const dColor=['#FF4852','#FF6E25','#FFBF00','#20CC62','#00D6D6','#00AAFF','#7257FF'] Component({ data:{ + imageUrl: getApp().globalData.imageUrl, showChart: true, transformOption: brokenLines([],[],[],[]), + transformOption2:brokenLines([],[],[],[]), brandOption: histogram([],[],[],'#0084FF'), brandOption2: histogram([],[],[],'#20cc62'), brandOption3:multipleColumn([],[],[]), brandOption4:sHistogram(), stackOption:stack([],[],['#00aaff','#20cc62','#ff4852']), boxArr:new Array(6), + topActive:0, //品牌传播 + brandTop:[], + brandTopData:[], + cloudActive:0, //词云 + positiveWord:[], + negativeWord:[],//负面 }, lifetimes:{ attached() { @@ -28,8 +36,8 @@ Component({ //信息量趋势数据 app.globalData.request({ action: 'getCountTime0528C', - token: 't%2BrswgjvzGM=', sType:'BrandOverview', + token: wx.getStorageSync('token'), sTimeType:'34', iContrastType:'1', sBrand: sBrand.join(',') @@ -49,7 +57,7 @@ Component({ } Object.keys(dataObj).forEach(ele=>{ dVal.push(dataObj[ele]) - }) + }) this.setData({ transformOption: brokenLines(sBrand,dVal,dColor,dtime), }) @@ -57,7 +65,7 @@ Component({ //整体信息量 app.globalData.request({ action: 'getContrastCount0528C', - token: 't%2BrswgjvzGM=', + token: wx.getStorageSync('token'), sType:'BrandOverview', sTimeType:'34', iContrastType:'1', @@ -76,7 +84,7 @@ Component({ //整体互动人数 app.globalData.request({ action: 'getInteractCount0528C', - token: 't%2BrswgjvzGM=', + token: wx.getStorageSync('token'), sType:'BrandOverview', sTimeType:'34', iContrastType:'1', @@ -95,7 +103,7 @@ Component({ //品牌条形对比 app.globalData.request({ action: 'getAffectionsC', - token: 't%2BrswgjvzGM=', + token: wx.getStorageSync('token'), sType:'BrandOverview', sTimeType:'34', iContrastType:'1', @@ -109,7 +117,6 @@ Component({ data[1].push(i.Data['中性']) data[2].push(i.Data['负面']) } - console.log(data); this.setData({ stackOption:stack(yMsg,data,['#00aaff','#20cc62','#ff4852']) }) @@ -117,7 +124,7 @@ Component({ //渠道分布 app.globalData.request({ action: 'getSourcetypeC', - token: 't%2BrswgjvzGM=', + token: wx.getStorageSync('token'), sType:'BrandOverview', sTimeType:'34', iContrastType:'1', @@ -143,31 +150,124 @@ Component({ //重点媒体 app.globalData.request({ action: 'getSourceCount0528C', - token: 't%2BrswgjvzGM=', + token: wx.getStorageSync('token'), sType:'BrandOverview', sTimeType:'34', iContrastType:'1', sBrand: sBrand.join(',') }).then(res=>{ - let data = [] + let xMsg = [] for(let i of res[0].value){ - let obj = {name:i.key,data:[]} - data.push(obj) + xMsg.push(i.key) } - for(let i of res){ + let data = new Array(res.length).fill([]) + for(let [index,i] of res.entries()){ for(let j of i.value){ - for(let k of data){ - if(j.key==k.name) { - k.data.push(j.value) - break - } - } + data[index].push(j.value) } } - data=data.map(ele=>{ return ele = ele.data}) - console.log(data); - + //横轴,数据,纵轴 + this.setData({ + brandOption4:sHistogram(xMsg,data,sBrand,[]) + }) + }) + //品牌传播TOP媒体 + app.globalData.request({ + action: 'getSourceTopCount0528C', + token: wx.getStorageSync('token'), + sType:'BrandOverview', + sTimeType:'34', + iContrastType:'1', + sBrand: sBrand.join(',') + }).then(res=>{ + this.setData({ + brandTop:[res[0],res[1]], + brandTopData:res + }) }) - } + //销量对比 + app.globalData.request({ + action: 'getCheZhuCountTimeC', + token: wx.getStorageSync('token'), + sType:'Marketing1C', + iContrastType:'1', + sBrand: sBrand.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(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 + // }) + + // }) + }, + +}, +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 + console.log(index); + + this.setData({ + topActive: index, + brandTop:obj[index] + }) + }, + changeModalHot2(event) { + + }, } }) \ No newline at end of file diff --git a/pages/varComm/pages/brandRatio/survey/index.json b/pages/varComm/pages/brandRatio/survey/index.json index 74e09c2..19af129 100644 --- a/pages/varComm/pages/brandRatio/survey/index.json +++ b/pages/varComm/pages/brandRatio/survey/index.json @@ -1,6 +1,7 @@ { "usingComponents": { - "c-echars": "../../../../../../components/c-echars/index" + "c-echars": "../../../../../../components/c-echars/index", + "word-cloud": "../../../../../components/word-cloud/index" }, "component": true } \ No newline at end of file diff --git a/pages/varComm/pages/brandRatio/survey/index.wxml b/pages/varComm/pages/brandRatio/survey/index.wxml index f17216c..8f09847 100644 --- a/pages/varComm/pages/brandRatio/survey/index.wxml +++ b/pages/varComm/pages/brandRatio/survey/index.wxml @@ -34,8 +34,95 @@ 重点媒体传播对比 - + + + + + 品牌传播TOP媒体 + + + + + + + + + + {{brandTop[0].key}} + + + 排名 + 车型 + 传播量 + + + + + + + + + + + + {{"0"+(index+1)}} + {{item.key}} + {{item.value}} + + + + {{brandTop[1].key}} + + + 排名 + 车型 + 传播量 + + + + + + + + + + + + {{"0"+(index+1)}} + {{item.key}} + {{item.value}} + + + + + 销量对比 + + + + + + \ No newline at end of file diff --git a/pages/varComm/pages/brandRatio/survey/index.wxss b/pages/varComm/pages/brandRatio/survey/index.wxss index ff7f863..85c4d37 100644 --- a/pages/varComm/pages/brandRatio/survey/index.wxss +++ b/pages/varComm/pages/brandRatio/survey/index.wxss @@ -15,4 +15,55 @@ 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; } \ No newline at end of file