|
@@ -33,8 +33,8 @@ Page({
|
|
* 页面上拉触底事件的处理函数
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
*/
|
|
onReachBottom: function () {
|
|
onReachBottom: function () {
|
|
- this.setData({pageindex:this.data.pageindex+=1})
|
|
|
|
- this.gettasklist()
|
|
|
|
|
|
+ // this.setData({pageindex:this.data.pageindex+=1})
|
|
|
|
+ // this.gettasklist()
|
|
},
|
|
},
|
|
bindinput(e){
|
|
bindinput(e){
|
|
this.setData({
|
|
this.setData({
|
|
@@ -60,6 +60,15 @@ Page({
|
|
})
|
|
})
|
|
console.log(`当前值:${value}, 当前索引:${index}`);
|
|
console.log(`当前值:${value}, 当前索引:${index}`);
|
|
},
|
|
},
|
|
|
|
+ deWeightThree(arr){
|
|
|
|
+ let map = new Map();
|
|
|
|
+ for (let item of arr) {
|
|
|
|
+ if (!map.has(item.id)) {
|
|
|
|
+ map.set(item.id, item);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return [...map.values()];
|
|
|
|
+ },
|
|
gettasklist(){
|
|
gettasklist(){
|
|
var that=this
|
|
var that=this
|
|
var lng=wx.getStorageSync('longitude');
|
|
var lng=wx.getStorageSync('longitude');
|
|
@@ -78,21 +87,24 @@ Page({
|
|
wx.showLoading({
|
|
wx.showLoading({
|
|
title: res.message.msg,
|
|
title: res.message.msg,
|
|
})
|
|
})
|
|
- that.setData({pageindex: that.data.pageindex -= 1})
|
|
|
|
|
|
+ // that.setData({pageindex: that.data.pageindex -= 1})
|
|
setTimeout(function () {
|
|
setTimeout(function () {
|
|
wx.hideLoading();
|
|
wx.hideLoading();
|
|
}, 1000);
|
|
}, 1000);
|
|
|
|
|
|
} else {
|
|
} else {
|
|
wx.hideLoading();
|
|
wx.hideLoading();
|
|
- 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})
|
|
|
|
- }
|
|
|
|
|
|
+ let arrtask = that.deWeightThree(res.message.data)
|
|
|
|
+
|
|
|
|
+ that.setData({taskInfo: arrtask})
|
|
|
|
+ // 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) {
|
|
}).catch(function (err) {
|
|
|
|
|