From 04698b60f3f0dca9d3874219c7f2c5386a4eaf5a Mon Sep 17 00:00:00 2001 From: meo <18801474720@163.com> Date: Wed, 5 Dec 2018 16:02:26 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=B8=9A=E6=80=81=E5=A2=9E=E5=8A=A0=E5=85=A8?= =?UTF-8?q?=E9=83=A8]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/coupons/index.js | 20 ++++++++++++++++++-- pages/user/index.wxml | 2 +- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/pages/index/coupons/index.js b/pages/index/coupons/index.js index 52473ba..4bc7201 100644 --- a/pages/index/coupons/index.js +++ b/pages/index/coupons/index.js @@ -187,9 +187,12 @@ Component({ type: 1 } }).then(res => { + console.log(res) + let businessObj = [{id:0,title: "全部",type: 1}]; that.setData({ - tabs: res.data.list + tabs: res.data.list.concat(businessObj).sort(compare("id")) }); + console.log(that.data.tabs) }) .catch(err => { wx.showToast({ @@ -208,4 +211,17 @@ Component({ }) that.getList(0, 1); } -}); \ No newline at end of file +}); +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; + } + } +} \ No newline at end of file diff --git a/pages/user/index.wxml b/pages/user/index.wxml index 64c88c4..1ee2be9 100644 --- a/pages/user/index.wxml +++ b/pages/user/index.wxml @@ -74,7 +74,7 @@ - 我的特权 + 特享礼遇