|
|
import { GET } from '../../../libs/request/request.js';
|
|
|
import config from '../../../config.js'
|
|
|
|
|
|
Page({
|
|
|
|
|
|
/**
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
collectionInfo: {
|
|
|
isLoading: false,
|
|
|
hasMore: true,
|
|
|
currentPage: 1,
|
|
|
collectionList: [],
|
|
|
},
|
|
|
list: [{ 'default_images': 'http://img11.static.yhbimg.com/goodsimg/2018/10/18/17/01ea80f9b7b26d037e8e2867b1e8d1aad1.jpg', 'price': '9', 'id': '10000082', 'product_name': 'Air Jordan Future GS “Bleached Turquoise”' }, { 'default_images': 'http://img11.static.yhbimg.com/goodsimg/2018/10/18/17/01ea80f9b7b26d037e8e2867b1e8d1aad1.jpg', 'price': '9', 'id': '10000082', 'product_name': 'Air Jordan Future GS “Bleached Turquoise”' }, { 'default_images': 'http://img11.static.yhbimg.com/goodsimg/2018/10/18/17/01ea80f9b7b26d037e8e2867b1e8d1aad1.jpg', 'price': '9', 'id': '10000082', 'product_name': 'Air Jordan Future GS “Bleached Turquoise”' }, { 'default_images': 'http://img11.static.yhbimg.com/goodsimg/2018/10/18/17/01ea80f9b7b26d037e8e2867b1e8d1aad1.jpg', 'price': '9', 'id': '10000082', 'product_name': 'Air Jordan Future GS “Bleached Turquoise”' }],
|
|
|
_triggerObserer: true,
|
|
|
},
|
...
|
...
|
@@ -16,6 +25,62 @@ Page({ |
|
|
this.setData({
|
|
|
_triggerObserer: !_triggerObserer,
|
|
|
})
|
|
|
|
|
|
this.fetchCollectionList();
|
|
|
},
|
|
|
|
|
|
fetchCollectionList: function () {
|
|
|
// let that = this;
|
|
|
// let collectionInfo = that.data.collectionInfo;
|
|
|
|
|
|
// console.log('====================================');
|
|
|
// console.log(collectionInfo);
|
|
|
// console.log('====================================');
|
|
|
|
|
|
// if (collectionInfo.isLoading || !collectionInfo.hasMore) {
|
|
|
// return;
|
|
|
// }
|
|
|
// collectionInfo.isLoading = true;
|
|
|
// that.setData({
|
|
|
// collectionInfo
|
|
|
// })
|
|
|
|
|
|
// wx.showLoading({
|
|
|
// title: '',
|
|
|
// })
|
|
|
|
|
|
// let params = {
|
|
|
// method: 'ufo.user.favoriteList',
|
|
|
// uid: '500031152',
|
|
|
// page: collectionInfo.currentPage,
|
|
|
// limit: 20,
|
|
|
// debug: 'XYZ'
|
|
|
// }
|
|
|
|
|
|
// GET({
|
|
|
// url: config.domains.api,
|
|
|
// params: params,
|
|
|
// }).then(data => {
|
|
|
// console.log(data)
|
|
|
// if (data && data.code == 200 && data.list) {
|
|
|
// let list = data.list;
|
|
|
|
|
|
// collectionInfo.isLoading = false;
|
|
|
// collectionInfo.collectionList = collectionInfo.collectionList.concat(list);
|
|
|
// let hasMore = collectionInfo.currentPage < data.totalPage;
|
|
|
// collectionInfo.hasMore = hasMore;
|
|
|
// if (hasMore) {
|
|
|
// collectionInfo.currentPage = collectionInfo.currentPage + 1;
|
|
|
// }
|
|
|
// that.setData({
|
|
|
// collectionInfo,
|
|
|
// })
|
|
|
// }
|
|
|
|
|
|
// }).catch(error => {
|
|
|
// collectionInfo.isLoading = false;
|
|
|
// console.error(error);
|
|
|
// })
|
|
|
},
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -57,7 +122,7 @@ Page({ |
|
|
* 页面上拉触底事件的处理函数
|
|
|
*/
|
|
|
onReachBottom: function () {
|
|
|
|
|
|
this.fetchCollectionList();
|
|
|
},
|
|
|
|
|
|
/**
|
...
|
...
|
|