|
|
|
@ -83,7 +83,8 @@
|
|
|
|
|
chooseImage |
|
|
|
|
} from "@/utils"; |
|
|
|
|
import { |
|
|
|
|
VUE_APP_API_URL |
|
|
|
|
VUE_APP_API_URL, |
|
|
|
|
BXG_TENANT_ID |
|
|
|
|
} from "@/config"; |
|
|
|
|
import { |
|
|
|
|
postUserEdit, |
|
|
|
@ -192,7 +193,44 @@
|
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
onChooseAvatar(e) { |
|
|
|
|
this.avatar = e.detail.avatarUrl; |
|
|
|
|
uni.getImageInfo({ |
|
|
|
|
src: e.detail.avatarUrl, |
|
|
|
|
success: image => { |
|
|
|
|
// console.log(image) |
|
|
|
|
uni.showLoading({ title: '图片上传中', mask: true }) |
|
|
|
|
uni.uploadFile({ |
|
|
|
|
url: `${VUE_APP_API_URL}/api/upload`, |
|
|
|
|
file: image, |
|
|
|
|
filePath: image.path, |
|
|
|
|
header: { |
|
|
|
|
Authorization: 'Bearer ' + store.getters.token, |
|
|
|
|
'tenant-id': BXG_TENANT_ID |
|
|
|
|
}, |
|
|
|
|
name: 'file', |
|
|
|
|
success: res => { |
|
|
|
|
this.avatar = JSON.parse(res.data).data; |
|
|
|
|
console.log('this.avatar', this.avatar) |
|
|
|
|
}, |
|
|
|
|
fail: err => { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '上传图片失败', |
|
|
|
|
icon: 'none', |
|
|
|
|
duration: 2000, |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
complete: res => { |
|
|
|
|
uni.hideLoading() |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
fail: err => { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '获取图片信息失败', |
|
|
|
|
icon: 'none', |
|
|
|
|
duration: 2000, |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
chooseImage() { |
|
|
|
|
chooseImage((img) => { |
|
|
|
|