diff --git a/pages/discountCardList/discountCardList.js b/pages/discountCardList/discountCardList.js index 5e52f67..795cb79 100644 --- a/pages/discountCardList/discountCardList.js +++ b/pages/discountCardList/discountCardList.js @@ -50,27 +50,6 @@ Page({ }) } }, - onShow: 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({ - tabs: res.data.concat(businessObj).sort(compare("createDate")) - }); - console.log(that.data.tabs) - }) - .catch(err => { - wx.showToast({ - title: err.errMsg, - icon: 'none', - duration: 2000, - mask: false - }); - }) - }, //点击跳转到券详情页面 gotouse: function (e) { console.log(e.currentTarget.dataset.couponid) diff --git a/pages/index/searchbar/index.js b/pages/index/searchbar/index.js index cb45a1a..73b6b10 100644 --- a/pages/index/searchbar/index.js +++ b/pages/index/searchbar/index.js @@ -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; - } - } -} diff --git a/pages/index/searchbar/index.wxml b/pages/index/searchbar/index.wxml index 8039e52..3a055a2 100644 --- a/pages/index/searchbar/index.wxml +++ b/pages/index/searchbar/index.wxml @@ -3,11 +3,11 @@ - - + + - {{item.title}} - + {{item.title}} + diff --git a/pages/main/coupons/index.js b/pages/main/coupons/index.js index 31e26b3..4041b25 100644 --- a/pages/main/coupons/index.js +++ b/pages/main/coupons/index.js @@ -185,12 +185,9 @@ Component({ Http.get({ url: config.api.businessList }).then(res => { - console.log(res) - let businessObj = [{ id: 0, title: "全部", type: 1, createDate:0}]; that.setData({ - tabs: res.data.concat(businessObj).sort(compare("createDate")) + tabs: [{ id: 0, title: "全部", type: 1 }].concat(res.data) }); - console.log(that.data.tabs) }) .catch(err => { wx.showToast({ diff --git a/pages/spellDetail/index.json b/pages/spellDetail/index.json index b88162e..5188e07 100644 --- a/pages/spellDetail/index.json +++ b/pages/spellDetail/index.json @@ -2,5 +2,6 @@ "navigationBarTitleText": "拼团详情", "usingComponents": {}, "navigationBarBackgroundColor": "#F13C42", + "navigationBarTextStyle": "white", "enablePullDownRefresh": true } \ No newline at end of file