loadAllUser(lastOnline, currentPage, limit, pageMax){
//迭代自身
// 最后在线时间 当前页数 每一页数量 页数
var that = this;
console.log(currentPage, eval(pageMax))
return new Promise(resolve => {
if(currentPage > eval(pageMax)){//加载完毕
resolve({
err: 0,
msg: 'success'
})
return
}
that.loadOnePageUser(lastOnline, currentPage, limit).then(res => {
if(!res.err){
that.userList = that.userList.concat(res.userList)
}
currentPage += 1;
setTimeout(function(){
that.loadAllUser(lastOnline, currentPage, limit, pageMax).then(res => {
resolve(res)
})
}, 500)
})
})
}
网友评论