Authored by QC-L

添加拼团列表上拉加载 reivew by 黄敬囿

... ... @@ -73,6 +73,8 @@ Page(Object.assign({
isLogin: false,
bannerSrc:null,
bannerUrl: null,
loading: false,
page: 1,
actionsheet: {
componentId: 'shareActionSheet',
... ... @@ -197,7 +199,14 @@ Page(Object.assign({
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
if (this.data.loading) return;
let page = this.data.page || 1;
page = page + 1;
this.setData({
page,
loading: true
})
this._loadGroupList(page);
},
/**
... ... @@ -207,10 +216,10 @@ Page(Object.assign({
},
_getGroupList(page) {
_getGroupList() {
this.commonService.getGroupList({
limit: 20,
page
page: 1
}).then(res => {
if (res.code === 200 && res.data) {
this.setData({
... ... @@ -220,6 +229,31 @@ Page(Object.assign({
});
},
_loadGroupList(page) {
this.commonService.getGroupList({
limit: 20,
page
}).then(res => {
if (res.code === 200 && res.data) {
let groupList = this.data.groupList || [];
if (res.data.list.length > 0) {
this.setData({
groupList: groupList.concat(res.data.list),
loading: false,
})
} else {
this.setData({
loading: false
})
}
}
}).catch(error => {
this.setData({
loading: false
});
});
},
_init() {
let params = {
actPrizeId: this.data.actPrizeId
... ...