From 0c1998d09edc524644082626d9310b68ab919e77 Mon Sep 17 00:00:00 2001 From: dengj <209192278@qq.com> Date: Fri, 17 Nov 2023 10:53:17 +0800 Subject: [PATCH] =?UTF-8?q?=E9=82=93=E6=B4=81=20:=20=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/my/edit/edit.vue | 9 +++------ pages/my/my.vue | 10 +++++----- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/pages/my/edit/edit.vue b/pages/my/edit/edit.vue index fa9a520..cf30d09 100644 --- a/pages/my/edit/edit.vue +++ b/pages/my/edit/edit.vue @@ -25,7 +25,7 @@ data() { return { Info: { - avatar: [], + avatar: '', username: '', avatarUrl: '' } @@ -36,10 +36,9 @@ getUserInfo() { this.$api.getUser().then(res => { const data = res.data.data - console.log('头像昵称', res); if (data) { - this.avatar = this.$api.imgUrl + data.avatar - this.avatarUrl = '/' + data.avatar + this.Info.avatar = this.$api.imgUrl + data.avatar + this.avatarUrl = data.avatar this.Info.username = data.nickname } }).finally(_ => {}) @@ -98,8 +97,6 @@ }, onLoad() { let that = this - this.$data.Info.username = wx.getStorageSync('nickname') - this.$data.Info.avatar = wx.getStorageSync('avatar') this.getUserInfo() } } diff --git a/pages/my/my.vue b/pages/my/my.vue index 32beca2..b3583a0 100644 --- a/pages/my/my.vue +++ b/pages/my/my.vue @@ -56,9 +56,6 @@ return } this.isLoad = true - // this.$data.account = wx.getStorageSync('account') - // this.$data.username = wx.getStorageSync('nickname') - this.getInfo() }, methods: { reOnLoad() { @@ -68,6 +65,9 @@ return } this.isLoad = true + if(this.isLoad){ + this.getInfo() + } }, failToLoad() { uni.reLaunch({ @@ -97,11 +97,11 @@ //---------页面调用接口示例------------ getInfo() { this.$api.getUser().then(res => { - console.log('userInfo', res); var data = res.data.data if (data) { - this.src = uni.getStorageSync('img_url') + data.avatar + this.src = this.$api.imgUrl + data.avatar this.username = data.nickname + this.account = data.sn } }) }