From b5f669d21bd527e56dd4229c448c2b9564f7e9d1 Mon Sep 17 00:00:00 2001 From: liuyongli <1598631486@qq.com> Date: Fri, 15 Jul 2022 14:32:16 +0800 Subject: [PATCH] no message --- components/indexCom/eventChild/index.js | 10 ++++++- components/indexCom/insightChild/index.js | 2 +- components/indexCom/soundChild/index.js | 34 +++++++++++++++-------- components/option/columnarOption.js | 23 +++++++++------ components/option/sColumnarOption.js | 4 +-- 5 files changed, 49 insertions(+), 24 deletions(-) diff --git a/components/indexCom/eventChild/index.js b/components/indexCom/eventChild/index.js index fbd8323..3638298 100644 --- a/components/indexCom/eventChild/index.js +++ b/components/indexCom/eventChild/index.js @@ -9,6 +9,11 @@ Component({ lifetimes: { attached() { + wx.showToast({ + title: '加载中', + icon: 'loading', + duration: 300000 + }) app.globalData.request({action: 'getEventsListH', sType: 'Home', sTimeType: 3}).then(res => { const arr = [] res.forEach(ele => { @@ -24,7 +29,10 @@ Component({ }) this.setData({ questes: arr, - }) + }) + setTimeout(() =>{ + wx.hideToast(); + },500) }) }, }, diff --git a/components/indexCom/insightChild/index.js b/components/indexCom/insightChild/index.js index ca0d6c1..efcd418 100644 --- a/components/indexCom/insightChild/index.js +++ b/components/indexCom/insightChild/index.js @@ -47,7 +47,7 @@ Component({ arr1.push(ele.value) }) this.setData({ - brandOption: histogram(arr,arr1,"#20CC62") + brandOption: histogram(arr,arr1,"#0084FF") }) setTimeout(() =>{ wx.hideToast(); diff --git a/components/indexCom/soundChild/index.js b/components/indexCom/soundChild/index.js index 625882c..7307429 100644 --- a/components/indexCom/soundChild/index.js +++ b/components/indexCom/soundChild/index.js @@ -11,8 +11,8 @@ const ds=[] // [3123, 2313, 313, 4355, 1490, 2900, 2310], // [1400, 5434, 1544, 533, 1454, 1900, 3310], // [1400, 5434, 1544, 533, 1454, 1900, 3310],] -const data=['微博','其他','短视频','微信','APP','论坛','新闻'] -// const data = [] +// const data=['微博','其他','短视频','微信','APP','论坛','新闻'] +const data = [] const color2=['#FF4852','#FF6E25','#FFBF00','#20CC62','#00D6D6','#00AAFF','#7257FF'] Component({ @@ -30,23 +30,33 @@ Component({ attached() { app.globalData.request({action: 'getHomeBrandSourceType0528', sType: 'Home', sTimeType: 34, sQueryType: 2}).then(res => { const arr = [] + const arr1=[] + const arr2=[] + const arr3=[] + const arr4=[] res.forEach(ele => { - let ol = { - dx:ele.key - } + // let ol = { + // dx:ele.key + // } + arr.push(ele.key) ele.value.forEach(val =>{ - let obj = { - ds:val.value, - data:val.key - } - arr.push(obj) + arr1.push(val.value) + arr2.push(val.key) }) - arr.push(ol) + // arr.push(ol) }) + // for (let index = 0; index < 7; index++) { + // arr3.push(arr2[index]) + // } + for (let index = 0; index < 7; index++) { + arr3.push(arr2[index]) + } this.setData({ - brandOption: arr, + brandOption:sHistogram(arr,arr1,arr3,color2), }) console.log('111',arr) + console.log('111',arr1) + console.log('111',arr3) }) }, }, diff --git a/components/option/columnarOption.js b/components/option/columnarOption.js index 3fd4ba5..5529c72 100644 --- a/components/option/columnarOption.js +++ b/components/option/columnarOption.js @@ -47,7 +47,7 @@ export default function histogram(dx=[],ds=[],color1='',direction=true) { axisLabel: { color: '#999999',//x轴文本颜色 textStyle: { - fontSize : 9 + fontSize : 8 } } @@ -64,15 +64,15 @@ export default function histogram(dx=[],ds=[],color1='',direction=true) { axisLabel: { color: '#999999',//y轴文本颜色 textStyle: { - fontSize : 9 - } + fontSize : 8 + }, }, splitLine: { //分割线 // lineStyle:{ // // color:"#2d3436" // } show: true, - lineStyle: { + lineStyle: { type: 'dashed', color: '#E8E8E8', } @@ -92,7 +92,13 @@ export default function histogram(dx=[],ds=[],color1='',direction=true) { color: '#999999',//y轴文本颜色 textStyle: { fontSize : 9 - } + }, + formatter:(value) => { + if(value >= 10000){ + value = (value / 10000) + '万'; + } + return value; + } }, splitLine: { //分割线 // lineStyle:{ @@ -127,10 +133,11 @@ export default function histogram(dx=[],ds=[],color1='',direction=true) { series:{ type: 'bar', data: ds, + barWidth : 24, stack:"Search Engine", - emphasis: {//折线图的高亮状态。 - focus: "series",//聚焦当前高亮的数据所在的系列的所有图形。 - }, + emphasis: {//折线图的高亮状态。 + focus: "series",//聚焦当前高亮的数据所在的系列的所有图形。 + }, itemStyle: { normal:{ color: color1, diff --git a/components/option/sColumnarOption.js b/components/option/sColumnarOption.js index 87da3ee..4c7862c 100644 --- a/components/option/sColumnarOption.js +++ b/components/option/sColumnarOption.js @@ -83,7 +83,7 @@ export default function sHistogram(dx=[],ds=[],data=[],color2=[]) { function columar(data=[],ds=[],color2=[]){ // MS判断多条数据还是单条数据 true为单条false为多条 let list=[] - for (let i = 0; i < color2.length; i++) { + for (let i = 0; i < data.length; i++) { // MS? // list.push({ // type: 'bar', @@ -102,7 +102,7 @@ function columar(data=[],ds=[],color2=[]){ // } // }) : list.push({ - name: data[i].name, + name: data[i], type: 'bar', barWidth : 24, data: ds[i],