...
|
...
|
@@ -19,13 +19,13 @@ Page({ |
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
this.fetchCollectionList();
|
|
|
|
|
|
},
|
|
|
|
|
|
fetchCollectionList: function () {
|
|
|
fetchCollectionList: function (reload) {
|
|
|
let that = this;
|
|
|
let collectionInfo = that.data.collectionInfo;
|
|
|
if (collectionInfo.isLoading || !collectionInfo.hasMore) {
|
|
|
if ((collectionInfo.isLoading || !collectionInfo.hasMore) && !reload) {
|
|
|
return;
|
|
|
}
|
|
|
collectionInfo.isLoading = true;
|
...
|
...
|
@@ -49,7 +49,11 @@ Page({ |
|
|
.then(data => {
|
|
|
if (data) {
|
|
|
let list = data.product_list;
|
|
|
collectionInfo.collectionList = collectionInfo.collectionList.concat(list);
|
|
|
if (reload) {
|
|
|
collectionInfo.collectionList = list;
|
|
|
} else {
|
|
|
collectionInfo.collectionList = collectionInfo.collectionList.concat(list);
|
|
|
}
|
|
|
collectionInfo.isLoading = false;
|
|
|
collectionInfo.currentPage = data.page;
|
|
|
|
...
|
...
|
@@ -88,7 +92,7 @@ Page({ |
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
onShow: function () {
|
|
|
|
|
|
this.fetchCollectionList(true);
|
|
|
},
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -116,7 +120,7 @@ Page({ |
|
|
* 页面上拉触底事件的处理函数
|
|
|
*/
|
|
|
onReachBottom: function () {
|
|
|
this.fetchCollectionList();
|
|
|
this.fetchCollectionList(false);
|
|
|
},
|
|
|
|
|
|
/**
|
...
|
...
|
|