wylyl22 3 years ago
parent f9923eeb0c
commit 0dbef463f6

@ -81,6 +81,7 @@ Component({
}) })
}) })
console.log("这是数据",time) console.log("这是数据",time)
// console.log("这是数据"+lValue) // console.log("这是数据"+lValue)
// console.log("这是数据"+lName) // console.log("这是数据"+lName)

@ -1,26 +1,9 @@
const app = getApp(); const app = getApp();
import sHistogram from "../../option/sColumnarOption" import sHistogram from "../../option/sColumnarOption"
// const dx=['长安','大众','丰田','吉利','哈佛'] const color2=['#FF4852','#FF6E25','#FFBF00','#20CC62','#00D6D6','#00AAFF','#7257FF','#7257FF']
const dx = []
const ds=[]
// [1400, 2400, 1000, 2800, 1000, 400, 1200],
// [100, 2000, 1500, 1800, 1490, 900, 310],
// [1400, 200, 150, 1340, 1600, 1900, 1310],
// [6545, 3456, 1500, 4500, 1700, 1900, 3100],
// [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 color2=['#FF4852','#FF6E25','#FFBF00','#20CC62','#00D6D6','#00AAFF','#7257FF']
Component({ Component({
data: { data: {
showChart: true, showChart: true,
brandOption:sHistogram(dx,ds,data,color2),
modelOption: sHistogram(dx,ds,data,color2)
}, },
onShow() { onShow() {
this.getTabBar().init(); this.getTabBar().init();
@ -28,44 +11,71 @@ Component({
}, },
lifetimes: { lifetimes: {
attached() { attached() {
app.globalData.request({action: 'getHomeBrandSourceType0528', sType: 'Home', sTimeType: 34, sQueryType: 2}).then(res => { let sTimeType = wx.getStorageSync("sTimeType") || 34;
let sStartTime = wx.getStorageSync("sStartTime") || '';
let sEndTime = wx.getStorageSync("sEndTime") || '';
this.getData(sTimeType, sStartTime, sEndTime);
},
},
methods: {
changeTime(e){
let sTimeType = e.detail.sTimeType;
let sStartTime = e.detail.sStartTime;
let sEndTime = e.detail.sEndTime;
this.getData(sTimeType, sStartTime, sEndTime);
},
getData(sTimeType, sStartTime, sEndTime){
wx.showToast({
title: '加载中',
icon: 'loading',
duration: 300000
})
app.globalData.request({action: 'getHomeBrandSourceType0528', sType: 'Home', sTimeType: sTimeType, sStartTime: sStartTime,sEndTime: sEndTime,sQueryType: 1}).then(res => {
const arr = []
const arr1=[[],[],[],[],[],[],[],[]]
const arr2=[]
res.forEach(ele => {
arr.push(ele.key)
ele.value.forEach(e=>{
arr2.push(e.key)
})
for(let i=0;i<ele.value.length;i++){
arr1[i].push(ele.value[i].value)
}
})
this.setData({
brandOption:sHistogram(arr,arr1,arr2,color2),
})
})
app.globalData.request({action: 'getHomeBrandSourceType0528', sType: 'Home', sTimeType: sTimeType, sStartTime: sStartTime,sEndTime: sEndTime, sQueryType: 2}).then(res => {
const arr = [] const arr = []
const arr1=[] const arr1=[[],[],[],[],[],[],[],[]]
const arr2=[] const arr2=[]
const arr3=[]
const arr4=[]
res.forEach(ele => { res.forEach(ele => {
// let ol = { arr.push(ele.key)
// dx:ele.key ele.value.forEach(e=>{
// } arr2.push(e.key)
arr.push(ele.key) })
ele.value.forEach(val =>{ for(let i=0;i<ele.value.length;i++){
arr1.push(val.value) arr1[i].push(ele.value[i].value)
arr2.push(val.key) }
})
// 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({ this.setData({
brandOption:sHistogram(arr,arr1,arr3,color2), modelOption:sHistogram(arr,arr1,arr2,color2),
}) })
console.log('111',arr) setTimeout(() =>{
console.log('111',arr1) wx.hideToast();
console.log('111',arr3) },500)
}) })
}, },
},
methods: {
priceSel(e){ priceSel(e){
this.setData({ this.setData({
intervalSel: e.currentTarget.dataset.index intervalSel: e.currentTarget.dataset.index
}) })
}, },
} }
}) })

@ -1,6 +1,6 @@
<view> <view>
<!-- 时间组件 --> <!-- 时间组件 -->
<time-component></time-component> <time-component bindchange="changeTime"></time-component>
<view class="brand"> <view class="brand">
<view class="text">品牌传播声量</view> <view class="text">品牌传播声量</view>
<view class="brand_tu"> <view class="brand_tu">

@ -28,6 +28,13 @@ export default function sHistogram(dx=[],ds=[],data=[],color2=[]) {
top: 40, top: 40,
containLabel: true containLabel: true
}, },
dataZoom: [{ //添加X轴滚动条
type: 'inside',
show: false,
start: 50,
end: 10,
handleSize: 5
}],
yAxis: [ yAxis: [
{ {
type: 'value', type: 'value',
@ -40,7 +47,7 @@ export default function sHistogram(dx=[],ds=[],data=[],color2=[]) {
axisLabel: { axisLabel: {
color: '#999999',//y轴文本颜色 color: '#999999',//y轴文本颜色
textStyle: { textStyle: {
fontSize : 9 fontSize : 8
} }
}, },
splitLine: { //分割线 splitLine: { //分割线

Loading…
Cancel
Save