diff --git a/src/views/user/UserList.vue b/src/views/user/UserList.vue index 62784cc..9ba4e9a 100644 --- a/src/views/user/UserList.vue +++ b/src/views/user/UserList.vue @@ -1149,11 +1149,21 @@ const handleAvatarModify = async (row) => { avatarForm.user_id = row.UserId avatarForm.cover_id = row.CoverID || '' currentEditUser.value = row - - // 直接使用 row.avatarUrl(来自 user.cover)渲染当前头像 - // row.avatarUrl 已经在 fetchUserList 中从 user.cover 映射过来 - currentAvatarUrl.value = row.avatarUrl || '' - + currentAvatarUrl.value = '' + + if (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 }