diff --git a/components/option/sColumnarOption.js b/components/option/sColumnarOption.js index fe54152..adf78b5 100644 --- a/components/option/sColumnarOption.js +++ b/components/option/sColumnarOption.js @@ -84,7 +84,7 @@ export default function sHistogram(dx = [], ds = [], data = [], color2 = []) { axisLabel: { color: '#999999', //x轴文本颜色 textStyle: { - fontSize: 9 + fontSize: 6 } } diff --git a/pages/varComm/pages/brandRatio/index.json b/pages/varComm/pages/brandRatio/index.json index 2571870..e076d6f 100644 --- a/pages/varComm/pages/brandRatio/index.json +++ b/pages/varComm/pages/brandRatio/index.json @@ -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": "品牌对比" } diff --git a/pages/varComm/pages/brandRatio/index.wxml b/pages/varComm/pages/brandRatio/index.wxml index cd24fb5..c035972 100644 --- a/pages/varComm/pages/brandRatio/index.wxml +++ b/pages/varComm/pages/brandRatio/index.wxml @@ -30,7 +30,8 @@ - + + diff --git a/pages/varComm/pages/brandRatio/survey/index.js b/pages/varComm/pages/brandRatio/survey/index.js index b69b0c6..f691763 100644 --- a/pages/varComm/pages/brandRatio/survey/index.js +++ b/pages/varComm/pages/brandRatio/survey/index.js @@ -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) diff --git a/pages/varComm/pages/brandRatio/weibo/index.js b/pages/varComm/pages/brandRatio/weibo/index.js new file mode 100644 index 0000000..fef0a52 --- /dev/null +++ b/pages/varComm/pages/brandRatio/weibo/index.js @@ -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) { + + }, + } +}) \ No newline at end of file diff --git a/pages/varComm/pages/brandRatio/weibo/index.json b/pages/varComm/pages/brandRatio/weibo/index.json new file mode 100644 index 0000000..19af129 --- /dev/null +++ b/pages/varComm/pages/brandRatio/weibo/index.json @@ -0,0 +1,7 @@ +{ + "usingComponents": { + "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/weibo/index.wxml b/pages/varComm/pages/brandRatio/weibo/index.wxml new file mode 100644 index 0000000..22afaf3 --- /dev/null +++ b/pages/varComm/pages/brandRatio/weibo/index.wxml @@ -0,0 +1,116 @@ + + + + 微博信息量对比 + + + + + + + 微博互动人数 + + + + + + 微博大V对比 + + + + + + + 微博调性对比 + + + + + + + + + + 微博内容方向对比 + + + + + + + + + + {{brandTop[0].Name}} + + + 排名 + 车型 + 传播量 + + + + + + + + + + + + {{"0"+(index+1)}} + {{item.key}} + {{item.value}} + + + + {{brandTop[1].Name}} + + + 排名 + 车型 + 传播量 + + + + + + + + + + + + {{"0"+(index+1)}} + {{item.key}} + {{item.value}} + + + + + + 活跃用户信息 + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/varComm/pages/brandRatio/weibo/index.wxss b/pages/varComm/pages/brandRatio/weibo/index.wxss new file mode 100644 index 0000000..2bbcb19 --- /dev/null +++ b/pages/varComm/pages/brandRatio/weibo/index.wxss @@ -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; +} \ No newline at end of file