api
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user