You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

129 lines
4.4 KiB

3 years ago
const app = getApp();
3 years ago
import brokenLine from "../../option/stackingLineOption"
const dName=['微博', '其他','短视频', '微信','APP', '论坛', '新闻']
const dValue=[
3 years ago
[250, 326, 178, 349, 900, 1300, 140,],
3 years ago
[200, 382, 661, 34, 909, 1308, 150],
[20, 32, 41, 354, 90, 130, 10],
[210, 322, 551, 364, 960, 1307, 10],
[1520, 1052, 141, 174, 1690, 250, 220],
[1400, 2000, 1500, 1800, 1490, 900, 310],
[25, 167, 564, 256, 1009, 2000, 140]]
const dColor=['#FF4852','#FF6E25','#FFBF00','#20CC62','#00D6D6','#00AAFF','#7257FF']
3 years ago
const dx=['00:00', '04:00', '08:00', '12:00', '16:00', '20:00', '24:00']
3 years ago
Component({
data: {
3 years ago
// totallist:totallist,
3 years ago
imageUrl: getApp().globalData.imageUrl,
3 years ago
active:0,
3 years ago
countYear: 0,
count6month: 0,
countAll: 0,
3 years ago
totallist: [],
3 years ago
showChart: true,
3 years ago
dataOption: brokenLine(dName,dValue,dColor,dx)
3 years ago
},
3 years ago
3 years ago
lifetimes: {
attached() {
3 years ago
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.getAmount(sTimeType, sStartTime, sEndTime);
this.getTrend(sTimeType, sStartTime, sEndTime);
},
getData(sTimeType, sStartTime, sEndTime){
wx.showToast({
title: '加载中',
icon: 'loading',
duration: 300000
})
this.getAmount(sTimeType, sStartTime, sEndTime),
this.getTrend(sTimeType, sStartTime, sEndTime)
setTimeout(() =>{
wx.hideToast();
},500)
},
// 入库数据趋势
getTrend(sTimeType, sStartTime, sEndTime){
let obj={
action:'getSourcetypeTimeDynamicHome',
sType:'Home',
sTimeType:sTimeType,
sStartTime:sStartTime,
sEndTime:sEndTime
}
app.globalData.request(obj).then(res=>{
const data=res
const time=[]
const list=[]
// Object.keys(data).forEach(e=>{
// time.push(e)
// // e.data.forEach(item=>{
// // list.push(item)
// // })
// })
console.log("这是数据"+data)
// console.log("这是数据"+time)
// console.log("这是数据"+list)
})
},
// 入库数据量
getAmount(sTimeType, sStartTime, sEndTime){
let obj={
action: 'getHomeCount0528',
sType: 'Home',
sTimeType:sTimeType,
sStartTime:sStartTime,
sEndTime:sEndTime,
iStatus: 1}
app.globalData.request(obj).then(res => {
3 years ago
const data = res;
const sourcetypeCount = data.sourcetypeCount || [];
const arr = []
3 years ago
const imgObj = {'微博': '/weibo.png', '微信': '/weixin.png', 'APP': '/app.png', '论坛': '/luntan.png', '新闻': '/xinwen.png', '其他': '/qita.png', '短视频': '/shipin.png'}
3 years ago
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
})
})
3 years ago
},
3 years ago
priceSel(e){
this.setData({
intervalSel: e.currentTarget.dataset.index
})
3 years ago
},
3 years ago
dynamic(){
wx.navigateTo({
url: "/pages/index/total/tatal"
})
},
3 years ago
}
})