diff --git a/packages/packageBuy/pages/shopDetail/shopDetail.vue b/packages/packageBuy/pages/shopDetail/shopDetail.vue index 75eaa5f..af28255 100644 --- a/packages/packageBuy/pages/shopDetail/shopDetail.vue +++ b/packages/packageBuy/pages/shopDetail/shopDetail.vue @@ -681,7 +681,8 @@ return } - this.toDoBuy(); + // 此处用法为在js中调用,需要写uni.$u.throttle() + uni.$u.throttle(this.toDoBuy, 1000); }, toDoBuy: function() { diff --git a/packages/packageBuy/pages/shopList/shopList.vue b/packages/packageBuy/pages/shopList/shopList.vue index a96532b..8e57b6a 100644 --- a/packages/packageBuy/pages/shopList/shopList.vue +++ b/packages/packageBuy/pages/shopList/shopList.vue @@ -26,8 +26,8 @@ --> - - + + @@ -76,7 +76,8 @@ keyword: "", dataList: [], currentPage: 1, - product_type_id: 0 + product_type_id: 0, + isLoading: false } }, @@ -96,7 +97,8 @@ } }, onReachBottom: function(e) { - console.log("onReachBottom", this.currentPage + 1) + if (!isLoading) + console.log("onReachBottom", this.currentPage + 1) this.loadPage(this.currentPage + 1); }, onPullDownRefresh: function(e) { @@ -131,16 +133,16 @@ }, methods: { toback: function() { - let route = getCurrentPages(); - console.log(route) - if (route.length >1) { - uni.navigateBack({ - delta: 1 - }) - } else { - uni.switchTab({ - url: "../../../../pages/home/home" - }) + let route = getCurrentPages(); + console.log(route) + if (route.length > 1) { + uni.navigateBack({ + delta: 1 + }) + } else { + uni.switchTab({ + url: "../../../../pages/home/home" + }) } }, confirm: function() { @@ -155,6 +157,7 @@ loadPage: function(page) { uni.hideKeyboard() var that = this; + that.isLoading = true; weixin.request({ bindThis: that, api: '/api/member/get-products', @@ -168,6 +171,7 @@ utilSuccess: function(r) { var res = r.data.data; + that.isLoading = false; var hasNoMore = that.dataList.length < 6 && page > 1; if (hasNoMore || res.length == 0 && page > 1) { diff --git a/pages/home/home.vue b/pages/home/home.vue index f2ef3c4..2ade3c8 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -91,7 +91,8 @@ currentPage: 1, dataList: [], dataActiveList: [], - indexNav: [] + indexNav: [], + isLoading: false } }, onLoad() { @@ -114,7 +115,8 @@ } }, onReachBottom() { - this.loadPage((this.currentPage + 1), '', 6, 1) + if (true) + this.loadPage((this.currentPage + 1), '', 6, 1) }, methods: { async getNav(code) { @@ -132,7 +134,7 @@ } }) }, - toAction: function(item) { + toAction: function(item) { console.log(item) if (item.link) { uni.redirectTo({ @@ -163,6 +165,7 @@ loadPage: function(page, product_type_id, page_size, type) { uni.hideKeyboard() var that = this; + this.isLoading = true; weixin.request({ bindThis: that, api: '/api/member/get-products', @@ -175,6 +178,7 @@ }, utilSuccess: function(r) { var res = r.data.data; + that.isLoading = false; for (var m of res) { // m.created_at = m.created_at.split("T")[0] + " " + m.created_at.split("T")[ // 1]