mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-11-07 02:57:13 +08:00
新增:新增上传头像 API,采用本地存储方式存储头像
This commit is contained in:
@@ -1,12 +1,20 @@
|
||||
import { UserState } from '@/store/modules/login/types';
|
||||
import Unknown from '../assets/images/avatar/unknown.png';
|
||||
import Male from '../assets/images/avatar/male.png';
|
||||
import Female from '../assets/images/avatar/female.png';
|
||||
|
||||
export default function getAvatar(gender: number | undefined) {
|
||||
if (gender === 1) {
|
||||
export default function getAvatar(loginStore: UserState) {
|
||||
const userAvatar = loginStore.avatar;
|
||||
if (userAvatar) {
|
||||
const baseUrl = import.meta.env.VITE_API_BASE_URL;
|
||||
return `${baseUrl}/avatar/${userAvatar}`;
|
||||
}
|
||||
|
||||
const userGender = loginStore.gender;
|
||||
if (userGender === 1) {
|
||||
return Male;
|
||||
}
|
||||
if (gender === 2) {
|
||||
if (userGender === 2) {
|
||||
return Female;
|
||||
}
|
||||
return Unknown;
|
||||
|
||||
Reference in New Issue
Block a user