|
@@ -7,7 +7,9 @@ Page({
|
|
|
*/
|
|
|
data: {
|
|
|
photoBoxList: [],
|
|
|
- hiddenFlag: true
|
|
|
+ hiddenFlag: true,
|
|
|
+ page: 1,
|
|
|
+ totalSize: 0
|
|
|
},
|
|
|
|
|
|
//点击跳转到相册
|
|
@@ -38,7 +40,7 @@ Page({
|
|
|
}
|
|
|
})
|
|
|
}else {
|
|
|
- this.getPhotoBoxList();
|
|
|
+ this.getPhotoBoxList(1, 7);
|
|
|
this.setData({
|
|
|
hiddenFlag: true
|
|
|
})
|
|
@@ -54,14 +56,19 @@ Page({
|
|
|
})
|
|
|
return false;
|
|
|
}
|
|
|
- this.getPhotoBoxList();
|
|
|
+ this.getPhotoBoxList(1, 7);
|
|
|
},
|
|
|
|
|
|
- getPhotoBoxList() {
|
|
|
- httpRequestApi.getPhotoBoxList().success((res) => {
|
|
|
+ getPhotoBoxList(pageNo, pageSize) {
|
|
|
+ httpRequestApi.getPhotoBoxList({
|
|
|
+ pageNo,
|
|
|
+ pageSize
|
|
|
+ }).success((res) => {
|
|
|
this.setData({
|
|
|
- photoBoxList: res.data.data.list
|
|
|
+ photoBoxList: res.data.data.list,
|
|
|
+ totalSize: res.data.data.totalSize
|
|
|
})
|
|
|
+ wx.hideLoading();
|
|
|
})
|
|
|
},
|
|
|
|
|
@@ -76,7 +83,7 @@ Page({
|
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
onShow: function () {
|
|
|
- this.getPhotoBoxList();
|
|
|
+ this.getPhotoBoxList(1, 7);
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -134,5 +141,21 @@ Page({
|
|
|
console.log("转发失败:" + JSON.stringify(res));
|
|
|
}
|
|
|
}
|
|
|
+ },
|
|
|
+ /*上拉加载更多*/
|
|
|
+ onBottom: function (e) {
|
|
|
+ if(this.data.totalSize <= 10 * this.data.page){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ wx.showLoading({
|
|
|
+ title: '加载中。。。。。。',
|
|
|
+ })
|
|
|
+ setTimeout( () => {
|
|
|
+ this.data.page++;
|
|
|
+ this.setData({
|
|
|
+ page: this.data.page++
|
|
|
+ })
|
|
|
+ this.getPhotoBoxList(1, 10 * this.data.page);
|
|
|
+ },2000)
|
|
|
}
|
|
|
})
|