修改头像和昵称
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
data() {
|
||||
return {
|
||||
avatar: '',
|
||||
avatarUrl: '',
|
||||
model: {
|
||||
userInfo: {
|
||||
name: ''
|
||||
@@ -77,7 +78,7 @@
|
||||
success: (res) => {
|
||||
console.log('上传头像', JSON.parse(res.data));
|
||||
// setTimeout(() => {
|
||||
resolve(JSON.parse(res.data).data.uri)
|
||||
resolve(JSON.parse(res.data).data.url)
|
||||
// }, 1000)
|
||||
}
|
||||
});
|
||||
@@ -90,24 +91,24 @@
|
||||
sizeType: ['original', 'compressed'], //original 原图,compressed 压缩图,默认二者都有
|
||||
success: (res) => {
|
||||
// console.log(res.tempFilePaths[0]); //成功则返回图片的本地文件路径列表 tempFilePaths
|
||||
// this.avatar = res.tempFilePaths[0] //更新本地浏览头像图片
|
||||
this.avatar = res.tempFilePaths[0] //更新本地浏览头像图片
|
||||
if (res.tempFilePaths[0]) {
|
||||
this.updatePromise(res.tempFilePaths[0]) //上传图片
|
||||
const result = this.updatePromise(res.tempFilePaths[0]) //上传图片
|
||||
result.then(value => {
|
||||
this.avatarUrl = '/' + value
|
||||
console.log(this.avatarUrl);
|
||||
})
|
||||
}
|
||||
const result = this.updatePromise(res.tempFilePaths[0])
|
||||
result.then(value => {
|
||||
this.avatar = value
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
//提交头像和昵称
|
||||
handleSubmit() {
|
||||
console.log('昵称', this.model.userInfo.name);
|
||||
console.log('头像', this.avatar);
|
||||
console.log('头像', this.avatarUrl);
|
||||
this.$apiServe.updateUser({
|
||||
nickname: this.model.userInfo.name,
|
||||
avatar: this.avatar
|
||||
avatar: this.avatarUrl
|
||||
}).then(res => {
|
||||
console.log('修改头像昵称==', res);
|
||||
this.$toast.success(res.data.msg)
|
||||
|
||||
Reference in New Issue
Block a user