From f9bd93bf85d9283c342402cd6c10455e0ce296ae Mon Sep 17 00:00:00 2001 From: meo <18801474720@163.com> Date: Wed, 24 Apr 2019 12:01:14 +0800 Subject: [PATCH] =?UTF-8?q?[ID1001383][=E4=BF=AE=E6=94=B9]:[=E4=BA=91?= =?UTF-8?q?=E7=AB=AF=E6=B5=8B=E8=AF=95=EF=BC=9AC=E7=AB=AF-1.=E9=97=A8?= =?UTF-8?q?=E5=BA=97=E5=87=BA=E7=8E=B0=E9=87=8D=E5=A4=8D=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=EF=BC=8C2.=E4=B8=9A=E6=80=81=E5=B1=95=E7=A4=BA=E5=95=86?= =?UTF-8?q?=E6=88=B7=E4=B9=9F=E6=9C=89=E9=97=AE=E9=A2=98=EF=BC=8C3.?= =?UTF-8?q?=E6=AF=8F=E6=AC=A1=E9=BB=98=E8=AE=A4=E5=9C=A8=E5=85=A8=E9=83=A8?= =?UTF-8?q?=E4=B8=8B]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/discountCardList/discountCardList.js | 21 ----------- pages/index/searchbar/index.js | 44 ++++++---------------- pages/index/searchbar/index.wxml | 8 ++-- pages/main/coupons/index.js | 5 +-- pages/spellDetail/index.json | 1 + 5 files changed, 17 insertions(+), 62 deletions(-) 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