Merge pull request '邓洁 : 获取个人信息接口' (#60) from djj into master

Reviewed-on: http://git.feashow.cn/odjbin/city-store-transfer/pulls/60
This commit is contained in:
odjbin
2023-11-17 03:01:27 +00:00
2 changed files with 8 additions and 11 deletions

View File

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

View File

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