微信小程序-翻页

function cardInfo( flag, currentPage,that){
wx.showLoading({
title: '加载中',
});
wx.request({
url: 'https://www.lenfshion.com/projectmng/appuser/exchangelist',
method: "POST",
data: {
apptoken: wx.getStorageSync("token"),
flag: flag,
currentPage: currentPage
},
header: {
'content-type': 'application/json'
},
success: function (res) {
// console.log(res.data);
wx.hideLoading();
if(res.data.result=="01"){
cardlength = res.data.list.length;
if (currentPage==1){
var cardList = res.data.list;
for (var i = 0; i < cardlength; i++) {
faceImg = imgUrl + cardList[i].face;
cardList[i].face = faceImg;
}
// 赋值
if (cardlength == 0) {
if (that.data.currentTab == 0) {
that.setData({
cardList: cardList,
numberdisplay: false,
})
state1 = false;
} else if (that.data.currentTab == 1) {
that.setData({
exchangeList: cardList,
changeDisplay: false,
})
state2 = false;
} else {
that.setData({
CollectionList: cardList,
callDisplay: false,
})
state3 = false;
}
} else {
if (that.data.currentTab == 0) {
that.setData({
cardList: cardList,
numberdisplay: true,
})
state1 = false;
} else if (that.data.currentTab == 1) {
that.setData({
exchangeList: cardList,
changeDisplay: true,
})
state2 = false;
} else {
that.setData({
CollectionList: cardList,
callDisplay: true,
})
state3 = false;
}
}
}else{
if (cardlength == "0") {
return
}
var cardMore = '';
var cardList = res.data.list
for (var i = 0; i < cardlength; i++) {
faceImg = imgUrl + cardList[i].face;
cardList[i].face = faceImg;
var arr = that.data.cardList;
arr.push(res.data.list[i]);
cardMore = arr;
}
// 加载更多
if (that.data.currentTab==0){
that.setData({
cardList: cardMore,
numberdisplay: true
})
} else if (that.data.currentTab == 1){
that.setData({
exchangeList: cardMore,
changeDisplay: true
})
}else{
that.setData({
CollectionList: cardMore,
callDisplay: true
})
}
}
}else{
getApp().maskInfos(res.data.result, res.data.msg);
}
}
});
}

posted on 2017-12-28 12:13  再胖十斤就好  阅读(3071)  评论(0编辑  收藏  举报

导航