/* * 手太欠 * 愿这世界都如故事里一样 美好而动人~ */ Page({ /** * 页面的初始数据 */ data: { teamsInfo : '', perfInfo : '', childrenArr : [], page : {}, //分页信息 lodingStats : false, //加载状态 }, /** * 生命周期函数--监听页面加载 */ onLoad(options) {}, /** * 生命周期函数--监听页面显示 */ onShow() { // 我的团队 this.teamInfo(); }, /** * 我的团队 */ teamInfo(page) { wx.$api.user.teamList({ page: page }).then(res => { console.log(res.data) let listArr = this.data.childrenArr, newData = [] if(page == 1 || page == undefined) listArr = [] newData = listArr.concat(res.data.children.data) this.setData({ teamsInfo : res.data.teams, perfInfo : res.data.perf, childrenArr : newData, page : res.data.children.page, lodingStats : false }) wx.stopPullDownRefresh() }).catch(err => {}) }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { // 获取我的团队 this.teamInfo(); }, /** * 上拉加载 */ onReachBottom(){ this.setData({ lodingStats: true }) let pageNumber = this.data.page.current if(this.data.page.has_more){ pageNumber++ // 获取我的团队 this.teamInfo(pageNumber); } } })