fix: 修复头像显示异常

This commit is contained in:
皓月归尘 2025-02-19 01:33:26 +08:00
parent dd8351b343
commit 53800f765b
3 changed files with 3 additions and 4 deletions

View File

@ -44,7 +44,7 @@ export function useNav() {
const userAvatar = computed(() => { const userAvatar = computed(() => {
return isAllEmpty(useUserStoreHook()?.avatar) return isAllEmpty(useUserStoreHook()?.avatar)
? Avatar ? Avatar
: useUserStoreHook()?.avatar; : `/api/${useUserStoreHook()?.avatar}`;
}); });
/** 昵称(如果昵称为空则显示用户名) */ /** 昵称(如果昵称为空则显示用户名) */

View File

@ -94,7 +94,7 @@ const onSubmit = async (formEl: FormInstance) => {
<h3 class="my-8">个人信息</h3> <h3 class="my-8">个人信息</h3>
<el-form ref="userInfoFormRef" label-position="top" :model="userInfo"> <el-form ref="userInfoFormRef" label-position="top" :model="userInfo">
<el-form-item label="头像"> <el-form-item label="头像">
<el-avatar :size="80" :src="userInfo.avatar" /> <el-avatar :size="80" :src="`/api/${userInfo.avatar}`" />
<el-upload <el-upload
ref="uploadRef" ref="uploadRef"
accept="image/*" accept="image/*"

View File

@ -31,9 +31,8 @@ const username = computed(() => {
}); });
/** 用户头像 */ /** 用户头像 */
const userAvatar = computed(() => { const userAvatar = computed(() => {
console.log(useUserStoreHook()?.avatar);
if (useUserStoreHook()?.avatar) { if (useUserStoreHook()?.avatar) {
return useUserStoreHook()?.avatar; return `/api/${useUserStoreHook()?.avatar}`;
} else { } else {
} }
return Avatar; return Avatar;