From 64d40cbbbf8143f4265b56fbf5c24b0a2877e358 Mon Sep 17 00:00:00 2001 From: 2256907009 <2256907009@qq.com> Date: Mon, 20 Apr 2026 16:04:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E5=A4=B4=E5=83=8F?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/user/UserList.vue | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) 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 }