import brokenLines from "../../../components/option/stackingLineOption" import histogram from "../../../components/option/singleColumnarOption" import multipleColumn from "../../../components/option/multipleColumn" const app = getApp() const dColor = ['#FF4852','#FFBF00', '#FF6E25', '#20CC62', '#00D6D6', '#00AAFF', '#7257FF'] Component({ data: { imageUrl: getApp().globalData.imageUrl, showChart: true, channelOption:multipleColumn(), transformOption2: brokenLines([], [], [], []), brandOption: histogram([], [], [], '#0084FF'), boxArr: new Array(6), topActive: 0, //品牌传播 brandTop: [], brandTopData: [], }, lifetimes: { attached() { let brandRatioTime = wx.getStorageSync('brandRatioTime') this.setData({ boxArr: wx.getStorageSync('themeData') }) let themeName=['主题一','主题二','主题三','主题四','主题五','主题六'] let numb=0 let sGuid = [] this.data.boxArr.forEach((ele) => { if (ele) sGuid.push(ele.Guids),numb+=1 }) themeName.length = numb //尾翼TOP媒体 app.globalData.request({ action: 'getSourceTopCount0528C', token: app.globalData.getStorage('token'), sType: 'BrandWeiYi', ...brandRatioTime, iContrastType: '4', iSize:'10', sGuid: sGuid.join(',') }).then(res => { for(let [index,i] of res.entries()){ res.key = themeName[index] } this.setData({ brandTop: [res[0], res[1]], brandTopData: res }) }) //分渠道信息量 app.globalData.request({ action: 'getSourcetypeC', token: app.globalData.getStorage('token'), sType: 'BrandWeiYi', iContrastType: '4', ...brandRatioTime, sGuid: sGuid.join(',') }).then(res=>{ let arr = [] let channelMsg = [] for (let [index,i] of res.entries()) { let obj = { name: themeName[index] } let da = [] Object.keys(i.Data).forEach(ele => { da.push(i.Data[ele]) channelMsg.push(ele) }) obj.data = da arr.push(obj) } channelMsg = [...new Set(channelMsg)] this.setData({ channelOption: multipleColumn(themeName, channelMsg, arr), }) }) //尾翼趋势 app.globalData.request({ action: 'getCountTime0528C', token: app.globalData.getStorage('token'), sType: 'BrandWeiYi', iContrastType: '4', ...brandRatioTime, sGuid: sGuid.join(',') }).then(res => { let dDate = [] let dVal = new Array(res[0].value.length).fill([]) dVal = dVal.map(ele => { ele = JSON.stringify(ele) ele = JSON.parse(ele) return ele }) for (let i of res) { dDate.push(i.key) for (let [index, j] of i.value.entries()) { dVal[index].push(j) } } this.setData({ salesDate: res.Time, transformOption2: brokenLines(themeName, dVal, dColor, dDate), }) }) }, }, 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) { }, } })