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 } })