|
@@ -26,7 +26,7 @@
|
|
|
<!-- <view><u-avatar :src="avatarUrl"></u-avatar></view> -->
|
|
|
<!-- #ifdef H5 -->
|
|
|
<button type="button" class="button" @click="onChooseImage">
|
|
|
- <u-avatar :src="avatarUrl" mode="aspectFill"></u-avatar>
|
|
|
+ <u-avatar :src="avatarUrl+ '?imageView2/2/w/80'" mode="aspectFill"></u-avatar>
|
|
|
</button>
|
|
|
<!-- #endif -->
|
|
|
|
|
@@ -119,17 +119,16 @@
|
|
|
count: 1, //默认9
|
|
|
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
|
|
sourceType: ['album'], //从相册选择
|
|
|
- success: (res) => {
|
|
|
- console.log(res.tempFilePaths[0]);
|
|
|
- _this.avatarUrl = res.tempFilePaths[0] // 将选择的图片路径预览
|
|
|
- $http.upload(res.tempFilePaths[0]).then(res2 => {
|
|
|
- uni.hideLoading();
|
|
|
- console.log('res2',res2);
|
|
|
- if (res.code == 0) {
|
|
|
- _this.avatar = res2.data.fileName
|
|
|
- }
|
|
|
- }).catch(() => {
|
|
|
- uni.hideLoading();
|
|
|
+ success: (res) => {
|
|
|
+ _this.avatarUrl = res.tempFilePaths[0] // 将选择的图片路径预览
|
|
|
+ $http.upload(res.tempFilePaths[0]).then(res2 => {
|
|
|
+ uni.hideLoading();
|
|
|
+ if (res2.code == 0) {
|
|
|
+ this.avatarUrl = res.tempFilePaths[0]
|
|
|
+ this.avatar = res2.data.fileName
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ uni.hideLoading();
|
|
|
})
|
|
|
}
|
|
|
});
|