From fdf05e01f50f9e8f5dfacf1cc6efec6686faafce Mon Sep 17 00:00:00 2001 From: xuechunyuan <17853500702@163.com> Date: Mon, 21 Aug 2023 16:08:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=B0=E5=9D=80=E5=88=97=E8=A1=A8=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 2 +- pages/pages_zhentou/myPage/address.vue | 79 ++++++++++++++++++++------ pages/pages_zhentou/myPage/myPage.vue | 11 ++++ 3 files changed, 74 insertions(+), 18 deletions(-) diff --git a/App.vue b/App.vue index ddd00f5..a412bfb 100644 --- a/App.vue +++ b/App.vue @@ -70,7 +70,7 @@ url: this.globalData.baseUrl + '/weChatUser/getWeChatUser?openId=' + this.globalData.openId, method: 'GET', success: (res) => { - console.log(res) + // console.log(res) if (res.data.code == 200) { uni.setStorageSync('userInfo', JSON.stringify(res.data.data)); uni.setStorageSync('phone', res.data.data.phone); diff --git a/pages/pages_zhentou/myPage/address.vue b/pages/pages_zhentou/myPage/address.vue index f114370..e44a23a 100644 --- a/pages/pages_zhentou/myPage/address.vue +++ b/pages/pages_zhentou/myPage/address.vue @@ -13,11 +13,13 @@ {{item.address}} - + + @@ -25,42 +27,85 @@ export default { data() { return { - addressData:[ - {name:'张晓明',phone:'132****1021',status:0,label:'家',address:'山东省青岛市市南区香港中路7号甲亚麦国际中心7层2097户东户'}, - {name:'张三',phone:'131****0021',status:1,label:'家',address:'山东省青岛市市南区香港中路7号甲亚麦国际中心7层2017户西户'}, - {name:'李四',phone:'132****3201',status:1,label:'家',address:'山东省青岛市市南区香港中路7号甲亚麦国际中心'}, - {name:'王五',phone:'132****0015',status:1,label:'家',address:'山东省青岛市市南区香港中路7号甲亚麦国际中心7层'}, - ] + addressData: [], + current: 0, + size: 10, + hasMore: true, + status: '', + contentText: { + contentdown: "点击查看更多", + contentrefresh: "正在加载...", + contentnomore: "没有更多数据了", + } + } + }, + onLoad() { + let userInfo = uni.getStorageSync('userInfo'); + if (userInfo) { + this.userInfo = JSON.parse(userInfo); + if (this.userInfo.id != undefined) { + this.loadMore(); + } } }, methods: { - + //加载更多 + loadMore() { + console.log('loadmore') + if (this.hasMore) { + this.current = this.current + 1; + this.staus = 'loading'; + uni.request({ + url: getApp().globalData.baseUrl + '/address/list?userId=' + this.userInfo.id + '¤t=' + this + .current + '&size=' + this.size, + method: 'GET', + success: (res) => { + if (res.data.code == 200) { + this.addressData = this.addressData.concat(res.data.data.records); + if (res.data.data.records.length == 0 || res.data.data.total < this.size) { + this.hasMore = false; + this.status = 'nomore'; + } else { + this.status = 'more'; + } + } else { + uni.showToast({ + title: res.data.msg, + icon: 'none' + }) + } + }, + }) + } + }, + } } + \ No newline at end of file diff --git a/pages/pages_zhentou/myPage/myPage.vue b/pages/pages_zhentou/myPage/myPage.vue index 70d91e3..289afee 100644 --- a/pages/pages_zhentou/myPage/myPage.vue +++ b/pages/pages_zhentou/myPage/myPage.vue @@ -27,6 +27,17 @@