From 73cf2229fd2f539288037cb99b84709f705a9777 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?TOP=E7=B3=AF=E7=B1=B3?= <1130395124@qq.com> Date: Sat, 1 Apr 2023 12:25:27 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E3=80=81=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E3=80=81=E6=9C=8D=E5=8A=A1=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E4=B8=8B=E6=8B=89=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages.json | 9 +++++--- src/pages/index/index.vue | 47 ++++++++++++++++++++++---------------- src/pages/service/cate.vue | 25 ++++++++++++-------- src/pages/service/list.vue | 11 +++++++-- 4 files changed, 58 insertions(+), 34 deletions(-) diff --git a/src/pages.json b/src/pages.json index e4725f5..b407129 100644 --- a/src/pages.json +++ b/src/pages.json @@ -3,7 +3,8 @@ { "path": "pages/index/index", "style": { - "navigationBarTitleText": "熊熊安装队" + "navigationBarTitleText": "熊熊安装队", + "enablePullDownRefresh": true } }, { @@ -21,13 +22,15 @@ { "path": "pages/service/cate", "style": { - "navigationBarTitleText": "分类" + "navigationBarTitleText": "分类", + "enablePullDownRefresh": true } }, { "path": "pages/service/list", "style": { - "navigationBarTitleText": "服务列表" + "navigationBarTitleText": "服务列表", + "enablePullDownRefresh": true } }, { diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 4394643..97d7f74 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -120,31 +120,38 @@ export default { WidgetModal, }, onLoad() { - // 首页轮播 - this.$request({ - api: "index.banner", - }).then((response) => { - response.data.forEach((item) => { - this.bannerList.push({ - image: item.image, - }); - }); - }); - // 系统公告 - this.$models.system.notifyList().then((list) => { - this.notifyList = list; - }); - // 导航 - this.$models.system.navList().then((list) => { - this.installServiceList = list.install; - this.aftermarketServiceList = list.aftermarket; - }); + this.initPage(); }, onShow() {}, onReady() {}, onReachBottom() {}, - onPullDownRefresh() {}, + onPullDownRefresh() { + this.initPage(); + uni.stopPullDownRefresh(); + }, methods: { + initPage() { + this.bannerList = []; + // 首页轮播 + this.$request({ + api: "index.banner", + }).then((response) => { + response.data.forEach((item) => { + this.bannerList.push({ + image: item.image, + }); + }); + }); + // 系统公告 + this.$models.system.notifyList().then((list) => { + this.notifyList = list; + }); + // 导航 + this.$models.system.navList().then((list) => { + this.installServiceList = list.install; + this.aftermarketServiceList = list.aftermarket; + }); + }, /** * 跳转 */ diff --git a/src/pages/service/cate.vue b/src/pages/service/cate.vue index e03d6cd..815ea49 100644 --- a/src/pages/service/cate.vue +++ b/src/pages/service/cate.vue @@ -80,14 +80,7 @@ export default { x: x - this.$utils.rpx2px(20), y: y - this.$utils.rpx2px(40), }; - // 加载分类 - this.data.push({ - id: 0, - name: "热门推荐", - cover: "", - child: await this.hotCate(), - }); - this.loadCate(); + this.initPage(); }, onShow() { this.newId = this.currentId = this.currentCateId; @@ -98,8 +91,22 @@ export default { this.$store.commit("system/currentCateId", this.newId); }, onReachBottom() {}, - onPullDownRefresh() {}, + onPullDownRefresh() { + this.initPage(); + uni.stopPullDownRefresh(); + }, methods: { + async initPage() { + this.data = []; + // 加载分类 + this.data.push({ + id: 0, + name: "热门推荐", + cover: "", + child: await this.hotCate(), + }); + this.loadCate(); + }, /** * 推荐 */ diff --git a/src/pages/service/list.vue b/src/pages/service/list.vue index f5c2e5b..afdee26 100644 --- a/src/pages/service/list.vue +++ b/src/pages/service/list.vue @@ -65,13 +65,20 @@ export default { return; } this.currentId = e.id; - this.loadList(e.id); + this.initPage(); }, onShow() {}, onReady() {}, onReachBottom() {}, - onPullDownRefresh() {}, + onPullDownRefresh() { + this.initPage(); + uni.stopPullDownRefresh(); + }, methods: { + initPage() { + this.data = []; + this.loadList(this.currentId); + }, /** * 加载列表 */