diff --git a/pages/searchbar/searchbar.js b/pages/searchbar/searchbar.js index b00d1e5..4ff7ad9 100644 --- a/pages/searchbar/searchbar.js +++ b/pages/searchbar/searchbar.js @@ -17,8 +17,8 @@ Page({ floor: null, teljpgUrl: imgurl.teljpg.url }, - lastSearch: Date.now(), - onShow: function attached() { + // lastSearch: Date.now(), + onShow(){ this.getbuildingfloorlist(); if (this.data.focus) { this.setData({ @@ -26,21 +26,6 @@ Page({ }); } }, - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { - let that = this; - that.data.page++; - that.setData({ - page: that.data.page - }); - // 如果是最后一页 - //就不发送请求 - if (!that.data.isLastPage || that.data.isFirstPage && that.data.isLastPage) { - this.getList(this.data.building.id, this.data.floor.id, that.data.page) - } - }, phone: function (e) { let that = this; if (e.currentTarget.dataset.merchantlinkphone) { @@ -80,7 +65,9 @@ Page({ floor: this.data.multiArray[1][e.detail.value[1]], }) this.getList(this.data.building.id, this.data.floor.id, 1); - + this.setData({ + page:1 + }) this.setData({ searchText: this.data.building.name + this.data.floor.floorName }) @@ -184,11 +171,25 @@ Page({ }, selectResult: function selectResult(e) { var index = e.currentTarget.dataset.index; - var item = this.data.result[index]; this.triggerEvent('selectresult', { index: index, item: item }); + }, + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + let that = this; + that.data.page++; + that.setData({ + page: that.data.page + }); + // 如果是最后一页 + //就不发送请求 + if (!that.data.isLastPage || that.data.isFirstPage && that.data.isLastPage) { + this.getList(this.data.building.id, this.data.floor.id, that.data.page) + } } }) \ No newline at end of file