fix: 修改头像预览问题
This commit is contained in:
@@ -1149,11 +1149,21 @@ const handleAvatarModify = async (row) => {
|
|||||||
avatarForm.user_id = row.UserId
|
avatarForm.user_id = row.UserId
|
||||||
avatarForm.cover_id = row.CoverID || ''
|
avatarForm.cover_id = row.CoverID || ''
|
||||||
currentEditUser.value = row
|
currentEditUser.value = row
|
||||||
|
currentAvatarUrl.value = ''
|
||||||
// 直接使用 row.avatarUrl(来自 user.cover)渲染当前头像
|
|
||||||
// row.avatarUrl 已经在 fetchUserList 中从 user.cover 映射过来
|
if (row.avatarUrl) {
|
||||||
currentAvatarUrl.value = row.avatarUrl || ''
|
currentAvatarUrl.value = row.avatarUrl
|
||||||
|
} else if (row.CoverID) {
|
||||||
|
try {
|
||||||
|
const res = await getFileDetail({ file_id: row.CoverID })
|
||||||
|
if (res.data.code === 200 && res.data.data?.url) {
|
||||||
|
currentAvatarUrl.value = res.data.data.url
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取头像失败:', error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
avatarDialogVisible.value = true
|
avatarDialogVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user