// pages/educations-list/index.js const app = getApp() Page({ /** * 页面的初始数据 */ data: { show: false, loadShow:false, loginName:'', userName:'', deptId:'', projectName:'', projectId:'', jumpState:'', //参数 DeviceGroupData: [], numTime:0, attendNumber:0, imgShow:false, initData:{}, trainingList:[], type:'', pageNo:1, pageSize:10, pageFlag:true, activeState:4, titleName:'三级安全教育', trainingType:'', startDate:'', endDate:'', collaborateRanksId:'', imgUrl:'' }, //项目切换 返回值 onProjectSelect(e){ this.onClickShow(); let projectId = e.detail.id; let projectName = e.detail.text; app.globalData.projectId = projectId; app.globalData.projectName = projectName; this.setData({ projectId:projectId, projectName:projectName, }) let data = {"jumpState":this.data.jumpState}; this.onLoad(data); }, winterPut(e){ this.setData({ imgShow:true, imgUrl:e.currentTarget.dataset.url }) }, //关闭放大的图片 closeImages(){ this.setData({ imgShow:false }) }, //筛选条件 screenCondition(e){ this.setData({ collaborateRanksId:e.detail.typeId, startDate:e.detail.startDate, endDate:e.detail.endDate, pageNo:1, type:1 }) this.getTrainingList(); this.getTrainingNumberOfPeopleCount(); }, showPopup() { this.setData({ show: true }); }, onClose() { this.setData({ show: false }); }, onClickShow() { this.setData({ loadShow: true }); }, onClickHide() { this.setData({ loadShow: false }); }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { var that = this; //加载蒙版 that.onClickShow(); //获取缓存数据 wx.getStorage({ key: 'userinfo', success:function(res){ that.setData({ loginName:res.data.loginName, userName:res.data.userName, deptId:res.data.deptId, projectName: app.globalData.projectName, projectId:app.globalData.projectId, initData:{text:app.globalData.projectName,id:app.globalData.projectId}, jumpState:options.jumpState, titleName:'三级安全教育', activeState:4, pageNo:1, type:1, trainingType:4, startDate:'', endDate:'', collaborateRanksId:'' }) that.getTrainingList(); that.getTrainingNumberOfPeopleCount(); that.getCollaborativeTeam(); } }) }, /** * 教育培训列表 */ getTrainingList(){ var that = this; wx.request({ url: app.globalData.reqUrl+'/weixin/training/getTrainingList', data:{ "projectId":this.data.projectId, "trainingType":this.data.trainingType, "pageNo":(this.data.pageNo-1)*this.data.pageSize, "startDate":this.data.startDate, "endDate":this.data.endDate, "collaborateRanksId":this.data.collaborateRanksId, }, method:"get", success:function(res){ if(res.data.length < that.data.pageSize){ that.setData({ pageFlag:false }) }else{ that.setData({ pageFlag:true }) } let array; if(that.data.type == 1){ array = []; }else{ array = that.data.trainingList } for(let i = 0;i