This commit is contained in:
2020-07-07 17:47:00 +08:00
parent 77083c0404
commit 5ede514a02
8 changed files with 230 additions and 90 deletions

View File

@@ -1,7 +1,7 @@
<template>
<view class="edit-info">
<view class="user-info">
<view class="info-avatar">
<view class="info-avatar" @click="changeAvatar">
<u-avatar :src="avatar" :size="120"></u-avatar>
<view class="avatar-text">更换头像</view>
</view>
@@ -67,6 +67,25 @@ export default {
this.getUserInfo();
},
methods: {
changeAvatar() {
const url = this.$u.http.config.baseUrl + '/Upload/uploadfile';
uni.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
sourceType: ['album'],
success: (res) => {
this.avatar = res.tempFilePaths[0];
common.uploadFile({
url: url,
filePath: res.tempFilePaths[0]
}).then(result => {
this.avatar = result;
}, error => {
this.$u.toast(error);
})
}
});
},
getUserInfo() {
this.$u.api.getMemberInfo().then(res => {
if (res.errCode == 0) {