码迷,mamicode.com
首页 > 微信 > 详细

微信小程序-翻页

时间:2017-12-28 14:02:35      阅读:484      评论:0      收藏:0      [点我收藏+]

标签:eth   push   ide   als   set   current   func   user   log   

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);
}
}
});
}

微信小程序-翻页

标签:eth   push   ide   als   set   current   func   user   log   

原文地址:https://www.cnblogs.com/weiwentaweb/p/8135038.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!