|
@@ -12,6 +12,7 @@ Page({
|
|
|
vtype:'北京',
|
|
|
ktype:'0',
|
|
|
inputValue:"",
|
|
|
+ pageindex: 1
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -40,6 +41,14 @@ Page({
|
|
|
})
|
|
|
|
|
|
},
|
|
|
+ /**
|
|
|
+ * 页面上拉触底事件的处理函数
|
|
|
+ */
|
|
|
+ onReachBottom: function () {
|
|
|
+ this.setData({pageindex:this.data.pageindex+=1})
|
|
|
+ this.gettasklist()
|
|
|
+ },
|
|
|
+
|
|
|
onClose() {
|
|
|
this.setData({ show: false });
|
|
|
},
|
|
@@ -62,22 +71,29 @@ Page({
|
|
|
city_id:id,
|
|
|
key:key,
|
|
|
lng:lat,
|
|
|
- lat:lng
|
|
|
+ lat:lng,
|
|
|
+ page: that.data.pageindex
|
|
|
}, "get").then(function (res) {
|
|
|
console.log(res);
|
|
|
if (res.code != 200) {
|
|
|
wx.showLoading({
|
|
|
title: res.message.msg,
|
|
|
})
|
|
|
+ that.setData({pageindex: that.data.pageindex -= 1})
|
|
|
setTimeout(function () {
|
|
|
wx.hideLoading();
|
|
|
}, 1000);
|
|
|
|
|
|
} else {
|
|
|
wx.hideLoading();
|
|
|
- that.setData({
|
|
|
- taskInfo:res.message.data
|
|
|
- })
|
|
|
+ if (that.data.pageindex == 1) {
|
|
|
+ that.setData({taskInfo: []})
|
|
|
+ }
|
|
|
+ if (res.message.data.length > 0) {
|
|
|
+ that.setData({taskInfo: that.data.taskInfo.concat(res.message.data)})
|
|
|
+ } else {
|
|
|
+ that.setData({pageindex: that.data.pageindex -= 1})
|
|
|
+ }
|
|
|
}
|
|
|
}).catch(function (err) {
|
|
|
|