修复没有设置头像的显示异常

This commit is contained in:
lxy
2025-01-07 10:29:32 +08:00
parent e8f5edd9c3
commit 73edafb95f

View File

@@ -3,6 +3,8 @@ import { UserInfosStates } from './interface';
import { Session } from '/@/utils/storage';
import { request } from '../utils/service';
import { getBaseURL } from '../utils/baseUrl';
import headerImage from '/@/assets/img/headerImage.png';
/**
* 用户信息
* @methods setUserInfos 设置用户信息
@@ -73,7 +75,7 @@ export const useUserInfo = defineStore('userInfo', {
method: 'get',
}).then((res:any)=>{
this.userInfos.username = res.data.name;
this.userInfos.avatar = getBaseURL(res.data.avatar);
this.userInfos.avatar = (res.data.avatar && getBaseURL(res.data.avatar)) || headerImage;
this.userInfos.name = res.data.name;
this.userInfos.email = res.data.email;
this.userInfos.mobile = res.data.mobile;