// pages/new-map/map.js const app = getApp(); Page({ /** * 页面的初始数据 */ data: { currentId: '', //传值与list id 相同 showPopup: false, bottom: "500rpx", showUp: false, longitude:'', latitude:'', markers: [], userLongitude:'', userLatitude:'', userMarkers:[], list:[], lists:[], userHatId:'', //页面跳转参数 loginName:'', userName:'', projectId:'', projectName:'' , index:'', userLocationList:{}, active1:true, active2:false, active3:false, ryshow:false, }, onClickShow() { this.setData({ ryshow: true }); }, onClickHide() { this.setData({ ryshow: false }); }, upward() { this.setData({ showUp: true }); this.setData({ bottom: "500rpx" }); let userLocationList = this.data.userLocationList; this.selectUserHardHatById(userLocationList[0].id,userLocationList) }, downward() { this.setData({ showUp: false }); this.setData({ bottom: "50rpx" }); }, showPopup() { this.setData({ showPopup: true }); }, onClose() { this.setData({ showPopup: false }); }, selectList(){ this.setData({ showPopup: false }); }, showActive:function(event){ this.onClickShow(); var type = event.currentTarget.dataset.type; if(type =="1"){ this.setData({ active1:true, active2:false, active3:false, showUp: false, currentId:'' }) //查询当天工时排行 this.selectUserAttendance(this.data.projectId,"day"); }else if(type == "2"){ this.setData({ active1:false, active2:true, active3:false, showUp: false, currentId:'' }) //查询本周工时排行 this.selectUserAttendance(this.data.projectId,"week"); }else{ this.setData({ active1:false, active2:false, active3:true, showUp: false, currentId:'' }) //查询本月工时排行 this.selectUserAttendance(this.data.projectId,"month"); } }, //页面初始化 onLoad: function (options) { this.onClickShow(); var that = this; //调用wx.getSystemInfo接口,然后动态绑定组件高度 wx.getSystemInfo({ success: function (res) { that.setData({ height: res.windowHeight }) } }), //获取缓存中数据 wx.getStorage({ key: 'userinfo', success:function(res){ that.setData({ loginName:res.data.loginName, userName:res.data.userName, projectId:app.globalData.projectId, projectName:app.globalData.projectName, index:options.index, userLocationList:JSON.parse(options.userLocationList), userHatId:options.id, currentId:options.id, }) } }) //页面初始化判断页面显示 if(options.skipState =="1"){ this.setData({ showUp: true }) //查询单个人员安全帽信息 this.selectUserHardHatById(options.id,JSON.parse(options.userLocationList)); }else{ this.setData({ showPopup:true }) } //判断列表今日、本周、本月显示 that.decideData(options.state); //获取当天的工时排行 that.selectUserAttendance(app.globalData.projectId,options.state,options.skipState); }, //根据id查询安全帽数据 selectUserHardHatById:function(id,userLocationList){ var that = this; wx.request({ url: app.globalData.reqUrl+'/weixin/userinfo/selectUserHardhatById', data:{ "id":id }, method:"GET", success:function(res){ that.onClickHide(); if(res.data.length>0){ var markers = []; for(var i=0;i0){ var markers = []; var userLocationList = gsph.data.userLocationList; for(var i=0;i