Merge pull request 'dengjie' (#69) from dengjie into dev

Reviewed-on: http://git.hchyun.com/feashow/pupil/pulls/69
This commit is contained in:
odjbin
2023-01-30 15:15:34 +00:00

View File

@@ -34,6 +34,7 @@
data() {
return {
avatar: '',
avatarUrl: '',
model: {
userInfo: {
name: ''
@@ -57,7 +58,7 @@
//获取头像昵称
getUser() {
this.$apiServe.getUser().then(res => {
console.log('头像昵称', res.data);
// console.log('头像昵称', res.data);
var data = res.data.data
this.avatar = data.avatar
this.model.userInfo.name = data.nickname
@@ -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,22 @@
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])
const result = this.updatePromise(res.tempFilePaths[0]) //上传图片
result.then(value => {
this.avatar = value
this.avatarUrl = '/' + value
console.log(this.avatarUrl);
})
}
}
});
},
//提交头像和昵称
handleSubmit() {
console.log('昵称', this.model.userInfo.name);
console.log('头像', this.avatar);
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)