From a8be77309614566397a67d7715820d9b03ceebb7 Mon Sep 17 00:00:00 2001 From: meo <18801474720@163.com> Date: Wed, 6 Mar 2019 14:51:06 +0800 Subject: [PATCH] =?UTF-8?q?[=E9=A6=96=E9=A1=B5=E5=A2=9E=E5=8A=A0=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E6=A1=86][=E5=A2=9E=E5=8A=A0]:[]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/images/arrow.png | Bin 0 -> 366 bytes pages/index/searchbar/index.js | 92 +++++++--- pages/index/searchbar/index.wxml | 35 +++- pages/index/searchbar/index.wxss | 279 ++++++++++++++++++++++++++++++- 4 files changed, 375 insertions(+), 31 deletions(-) create mode 100644 assets/images/arrow.png diff --git a/assets/images/arrow.png b/assets/images/arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..de0feea2aa8156904f7dc38e7451ddd1d94e38d1 GIT binary patch literal 366 zcmV-!0g?WRP)x$!LUsVNtPF#pHxYILFT_jFPwrpy6h#)*%HcTg8-DSQ;%6)k}ehWnzq z@j>uVG$-C09*gF}d%?NT9C&9qH#!#Y1n>4?0+pTj>DYHjNT0t84+$Ew5Z^pE;l9B_ zz~^(?`EX5uY2VKF!XJ(9IrF_Y@m2V<&_4JJ__NWj_!j(C&@T7}{%YuZcnkkDG(e~} z_O~MN&0^~|1bYHCDm4By6|eCMs_a`Qi`YaG^CzZU5~#e;xUJ(K0c*P( { + console.log(res) + let businessObj = [{ id: 0, title: "全部", type: 1 }]; + that.setData({ + lists: res.data.list.concat(businessObj).sort(compare("id")) + }); + console.log(that.data.lists) + }) + .catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) + }, + getList: function (pageNum) { let that = this; Http.get({ url: config.api.merchantList, data: { pageNum: pageNum, - pageSize: pageSize + pageSize: 15 } }).then(res => { + console.log(res) that.setData({ merchantVoList: res.data.list }) - console.log(res) - }).catch(err => { - console.log(err) + console.log(that.data.merchantVoList) }) + .catch(err => { + wx.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) }, phone: function (e) { let that = this; if (e.currentTarget.dataset.merchantlinkphone) { wx.makePhoneCall({ phoneNumber: e.currentTarget.dataset.merchantlinkphone - }); + }) } }, /** @@ -85,12 +133,18 @@ Page({ */ onReachBottom: function () { - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - } -}) \ 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; + } + } +} diff --git a/pages/index/searchbar/index.wxml b/pages/index/searchbar/index.wxml index 57e4467..54fc318 100644 --- a/pages/index/searchbar/index.wxml +++ b/pages/index/searchbar/index.wxml @@ -1,12 +1,31 @@ - -