From defbc141803f8de19c20a264bbe8e0f089ad919c Mon Sep 17 00:00:00 2001 From: zhuchunyun Date: Wed, 28 Aug 2024 19:06:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/ManageList.vue | 33 ++++++++++++++++++++++++++------- pages/index/index.vue | 10 +++++----- 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/pages/index/ManageList.vue b/pages/index/ManageList.vue index 239e237..3721ae7 100644 --- a/pages/index/ManageList.vue +++ b/pages/index/ManageList.vue @@ -30,7 +30,13 @@ export default { data() { return { - courseList: [] + courseList: [], + + param:{ + pageNum:1, + pageSize:10, + total:0 + } } }, onShow() { @@ -41,10 +47,11 @@ uni.stopPullDownRefresh() }, onReachBottom() { - // this.show = true - setTimeout(() => { - console.log("加载执行"); - }, 2000) + // 触底加载 + if (this.courseList.length < this.param.total) { + this.param.pageNum++ + this.findCourseList() + } }, methods: { @@ -53,8 +60,20 @@ url: `/drivingSchool/system/reservationCourse/applet/getReservationCourseList`, method: 'get' }) - this.courseList = res.data - console.log(this.courseList); + if (res.code == 0) { + if (this.param.pageNum != 1) { + this.courseList = this.courseList.concat(res.data.records) + } else { + this.courseList = res.data.records + } + this.param.total = res.data.total + } else { + uni.showToast({ + title: "网络不佳请稍后再试", + icon: 'error' + }) + } + }, goDetails() { uni.navigateTo({ diff --git a/pages/index/index.vue b/pages/index/index.vue index 2ad0803..34654ac 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -88,7 +88,7 @@ - + {{item.createTime}} @@ -201,14 +201,14 @@ url: `/drivingSchool/system/reservationCourse/applet/getReservationCourseList`, method: 'get' }) - this.courseList = res.data + this.courseList = res.data.records }, getUserInfo() { request({ - url: '/jx/auth/getJxInfo', + url: '/getJxInfo', method: 'get' }).then((res) => { - if (res.code == 0) { + if (res.code == 200) { this.schoolInfo = res.data.schoolInfo uni.setStorageSync("roles", res.data.roles) uni.setStorageSync("deptId", res.data.schoolInfo.deptId) @@ -220,7 +220,7 @@ url: '/drivingSchool/system/reservationCourse/applet/getHomeData', method: 'get' }).then((res) => { - if (res.code == 0) { + if (res.code == 200) { this.dataInfo = res.data } })