From a2a4370327e24a5febd28df15931e81cd9a710a9 Mon Sep 17 00:00:00 2001 From: Mrxtyyp <1126084777@qq.com> Date: Mon, 27 May 2024 21:38:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/js/request.js | 4 ++-- pages/index/worker-home.vue | 26 ++++++++++++-------------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/common/js/request.js b/common/js/request.js index f6952d7..5932ba8 100644 --- a/common/js/request.js +++ b/common/js/request.js @@ -548,9 +548,9 @@ export default { }) return res[1].data; }, - async getWorkerList(params = {}) { + async getWorkerList(params = {}, pageNum, pageSize) { let res = await uni.request({ - url: '/worker/app/list', + url: `/worker/app/list?pageNum=${pageNum}&pageSize=${pageSize}`, method: 'POST', data: params }) diff --git a/pages/index/worker-home.vue b/pages/index/worker-home.vue index 57fc11d..fa57fa3 100644 --- a/pages/index/worker-home.vue +++ b/pages/index/worker-home.vue @@ -213,9 +213,9 @@ otherCityWorkers: [], loadMoreStatus: '', hasMoreData: false, - pageNum: 0, - otherCityWorkersPageNum: 0, - pageSize: 0, + pageNum: 1, + otherCityWorkersPageNum: 1, + pageSize: 10, stickyTop: this.CustomBar, searchInfo: {}, curPositionDistrictId: -1, @@ -232,8 +232,8 @@ }, methods: { async loadData() { - this.pageNum = this.$globalData.initPageNum; - this.pageSize = this.$globalData.initPageSize; + // this.pageNum = this.$globalData.initPageNum; + // this.pageSize = this.$globalData.initPageSize; // 获取当前定位 await this.getCurAreaArr(); await this.loadRegionList(); @@ -285,11 +285,10 @@ } this.workerInfos = this.workerInfos.concat(res.rows); this.pageNum++; - if (rowsLength === this.pageSize) { - this.$refs.loadStatusBar1.showLoadMore(); - } + this.$refs.loadStatusBar1.showLoadMore(); + } else { + this.$refs.loadStatusBar1.showLoadOver(); } - this.$refs.loadStatusBar1.showLoadOver(); } catch (e) { console.error(e) this.$refs.loadStatusBar1.showLoadErr(); @@ -301,16 +300,15 @@ params.exceptParentAreaId = this.searchInfo.area && this.searchInfo.area.length ? this.searchInfo.area[1].areaId : null; this.$refs.loadStatusBar2.showLoading(); try { - let res = await this.$request.getWorkerList(params); + let res = await this.$request.getWorkerList(params, params.pageNum, params.pageSize); let rowsLength = res.rows.length; if (rowsLength > 0) { this.otherCityWorkers = this.otherCityWorkers.concat(res.rows); this.otherCityWorkersPageNum++; - if (rowsLength === this.pageSize) { - this.$refs.loadStatusBar2.showLoadMore(); - } + this.$refs.loadStatusBar2.showLoadMore(); + } else { + this.$refs.loadStatusBar2.showLoadOver(); } - this.$refs.loadStatusBar2.showLoadOver(); } catch (e) { console.error(e) this.$refs.loadStatusBar2.showLoadErr();