|
@ -150,19 +150,23 @@ export default { |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
onChooseAvatar(e) { |
|
|
onChooseAvatar(e) { |
|
|
console.log(e.detail, "=="); |
|
|
const token = uni.getStorageSync("userInfo") |
|
|
pathToBase64(e.detail.avatarUrl).then((base64) => { |
|
|
? JSON.parse(uni.getStorageSync("userInfo")).token |
|
|
this.Post( |
|
|
: ""; |
|
|
{ |
|
|
const file = e.detail.avatarUrl |
|
|
method: "POST", |
|
|
uni.uploadFile({ |
|
|
base64: base64, |
|
|
url: this.NEWAPIURL_DES + "/system/oss/upload", // 替换为你的上传接口 |
|
|
|
|
|
filePath: file, |
|
|
|
|
|
name: "file", |
|
|
|
|
|
header: { |
|
|
|
|
|
token: token || "", |
|
|
|
|
|
// 添加必要的请求头,如token等 |
|
|
}, |
|
|
}, |
|
|
"/api/common/base64" |
|
|
success: (res) => { |
|
|
).then((res) => { |
|
|
let info = JSON.parse(res.data) |
|
|
if (res.data) { |
|
|
|
|
|
this.Post( |
|
|
this.Post( |
|
|
{ |
|
|
{ |
|
|
avatar: res.data, |
|
|
avatar: info.data.url, |
|
|
}, |
|
|
}, |
|
|
"/api/user/profile" |
|
|
"/api/user/profile" |
|
|
).then((res) => { |
|
|
).then((res) => { |
|
@ -177,9 +181,12 @@ export default { |
|
|
}, |
|
|
}, |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
}, |
|
|
}); |
|
|
fail: (err) => { |
|
|
|
|
|
reject(err); |
|
|
|
|
|
}, |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
uploadImg() { |
|
|
uploadImg() { |
|
|
uni.chooseImage({ |
|
|
uni.chooseImage({ |
|
|