|
@@ -98,7 +98,7 @@ getUserInfo()
|
|
|
|
|
|
|
|
//设置头像 /app/appUser/setAvatar 入参 avatarfile
|
|
//设置头像 /app/appUser/setAvatar 入参 avatarfile
|
|
|
function setAvatar(avatarfile) {
|
|
function setAvatar(avatarfile) {
|
|
|
- uni.$u.http.post('/app/appUser/setAvatar', { avatarfile }).then(res => {
|
|
|
|
|
|
|
+ uni.$u.http.post('/app/appUser/setAvatar?avatarfile='+avatarfile).then(res => {
|
|
|
if (res.code == 200) {
|
|
if (res.code == 200) {
|
|
|
userInfo.value.avatar = avatarfile
|
|
userInfo.value.avatar = avatarfile
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
@@ -123,10 +123,9 @@ const handleEditAvatar = () => {
|
|
|
"Authorization": token
|
|
"Authorization": token
|
|
|
},
|
|
},
|
|
|
success: (uploadRes) => {
|
|
success: (uploadRes) => {
|
|
|
- console.log(uploadRes,'uploadRes')
|
|
|
|
|
const data = JSON.parse(uploadRes.data)
|
|
const data = JSON.parse(uploadRes.data)
|
|
|
if (data.code === 200) {
|
|
if (data.code === 200) {
|
|
|
- setAvatar(data.data)
|
|
|
|
|
|
|
+ setAvatar(data.url)
|
|
|
} else {
|
|
} else {
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
|
title: '上传失败',
|
|
title: '上传失败',
|