|
|
@@ -21,7 +21,6 @@ Page({ |
|
|
|
jumpIndex(e) { |
|
|
|
let that = this; |
|
|
|
let index = e.currentTarget.dataset.menuindex; |
|
|
|
console.log(index) |
|
|
|
that.setData({ |
|
|
|
indexId: index, |
|
|
|
businessId: index |
|
|
@@ -43,7 +42,7 @@ Page({ |
|
|
|
* 生命周期函数--监听页面加载 |
|
|
|
*/ |
|
|
|
onLoad: function (options) { |
|
|
|
var that = this |
|
|
|
let that = this; |
|
|
|
wx.getSystemInfo({ |
|
|
|
success: function (res) { |
|
|
|
that.setData({ |
|
|
@@ -51,34 +50,26 @@ Page({ |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 生命周期函数--监听页面显示 |
|
|
|
*/ |
|
|
|
onShow: function () { |
|
|
|
let that = this; |
|
|
|
that.getBussiness(); |
|
|
|
that.getList(1,0); |
|
|
|
that.getList(1, 0); |
|
|
|
}, |
|
|
|
getBussiness:function(){ |
|
|
|
let that = this; |
|
|
|
Http.get({ |
|
|
|
url: config.api.businessList, |
|
|
|
}).then(res => { |
|
|
|
console.log(res) |
|
|
|
let businessObj = [{ id: 0, title: "全部", type: 1, createDate:0}]; |
|
|
|
that.setData({ |
|
|
|
lists: res.data.concat(businessObj).sort(compare("createDate")) |
|
|
|
lists: [{ id: 0, title: "全部", type: 1 }].concat(res.data) |
|
|
|
}); |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
wx.showToast({ |
|
|
|
title: err.errMsg, |
|
|
|
icon: 'none', |
|
|
|
duration: 2000, |
|
|
|
mask: false |
|
|
|
}); |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
wx.showToast({ |
|
|
|
title: err.errMsg, |
|
|
|
icon: 'none', |
|
|
|
duration: 2000, |
|
|
|
mask: false |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
getList: function (page, businessId) { |
|
|
|
let that = this; |
|
|
@@ -148,16 +139,3 @@ Page({ |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
function compare(pro) { |
|
|
|
return function (obj2, obj1) { |
|
|
|
var val1 = obj1[pro]; |
|
|
|
var val2 = obj2[pro]; |
|
|
|
if (val1 < val2) { |
|
|
|
return 1; |
|
|
|
} else if (val1 > val2) { |
|
|
|
return -1; |
|
|
|
} else { |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
} |