Page({ data: { type: 1, page: 1, has_more: true, lists: [], company_id: wx.getStorageSync('company_id'), }, /** * @param {type} 1管理 2员工 4 企业风采 5 企业视频 */ onLoad: function (options) { switch (options.type) { case '1': wx.setNavigationBarTitle({ // title: '企业主页-管理层', title: '员工列表', }) this.users(); break; case '2': wx.setNavigationBarTitle({ title: '企业主页-员工层', }) break; case '4': wx.setNavigationBarTitle({ title: '企业风采', }) this.graces(); break; case '5': wx.setNavigationBarTitle({ title: '企业视频', }) this.videos(); break; default: break; } this.setData({ type: options.type }) }, // 获取企业风采列表 graces() { wx.$api.companyModule.graces(wx.getStorageSync('company_id'), this.data.page).then(res => { console.log(res); var lists = this.data.lists.concat(res.data) if (res.page.has_more) { this.setData({ has_more: res.page.has_more, page: page + 1, lists: lists }) } else { this.setData({ has_more: res.page.has_more, lists: lists }) } }) }, // 获取企业宣传视频列表 videos() { wx.$api.companyModule.videos(wx.getStorageSync('company_id'), this.data.page).then(res => { console.log(res); var lists = this.data.lists.concat(res.data) if (res.page.has_more) { this.setData({ has_more: res.page.has_more, page: page + 1, lists: lists }) } else { this.setData({ has_more: res.page.has_more, lists: lists }) } }) }, // 获取企业员工页面 users() { wx.$api.companyModule.users(wx.getStorageSync('company_id'), this.data.page).then(res => { console.log(res); var lists = this.data.lists.concat(res.data) if (res.page.has_more) { this.setData({ has_more: res.page.has_more, page: page + 1, lists: lists }) } else { this.setData({ has_more: res.page.has_more, lists: lists }) } }) }, // 触底加载更多 onReachBottom() { console.log('触底') if (this.data.has_more) { if (this.data.type == 4) { this.graces(); } else if (this.data.type == 5) { this.videos(); } else if (this.data.type == 1 || this.data.type == 2) { this.users(); } } else { wx.showToast({ icon: 'none', title: '没有更多', }) } } })