const app = getApp(); import totallist from "./dataConfig/totallist" import dataOption from "./dataConfig/dataOption" Component({ data: { imageUrl: getApp().globalData.imageUrl, active:0, countYear: 0, count6month: 0, countAll: 0, timelist: ['二十四小时', '最近七天', '最近三十天', '自定义'], totallist: totallist, showChart: true, chartOption: dataOption }, lifetimes: { attached() { app.globalData.request({action: 'getHomeCount0528', sType: 'Home', sTimeType: 3, iStatus: 1}).then(res => { const data = res; const sourcetypeCount = data.sourcetypeCount || []; const arr = [] const imgObj = {'微博': '/weibo.png', '微信': '/weixin.png', 'APP': '/app.png', '论坛': '/luntan.png', '新闻': '/xinwen.png', '其他': '/qita.png'} arr.push({ num: data.count, text: '入库数据', url: '/ruku.png' }) sourcetypeCount.forEach(ele => { let obj = { num: ele.value, text: ele.key + '数据', url: imgObj[ele.key] } arr.push(obj) }) this.setData({ countYear: data.count_year, count6month: data.count_6month, countAll: data.count_all, totallist: arr }) }) }, }, methods: { priceSel(e){ this.setData({ intervalSel: e.currentTarget.dataset.index }) }, dynamic(){ wx.navigateTo({ url: "/pages/index/total/tatal" }) }, } })