fix: 加载优化、vip状态优化、apikey优化
This commit is contained in:
@@ -1,18 +1,21 @@
|
||||
import { useUserStore } from '@/stores/index.js';
|
||||
|
||||
const userStore = useUserStore();
|
||||
// 判断是否是 VIP 用户
|
||||
export function isUserVip(): boolean {
|
||||
const userStore = useUserStore();
|
||||
console.log('isUserVip----', userStore);
|
||||
|
||||
// 获取用户角色信息
|
||||
const userRoles = userStore.userInfo?.roles ?? [];
|
||||
const isUserVip = userRoles.some((role: any) => role.roleCode === 'YiXinAi-Vip');
|
||||
const userRoles = userStore.userInfo?.roles ?? [];
|
||||
return userRoles.some((role: any) => role.roleCode === 'YiXinAi-Vip');
|
||||
}
|
||||
|
||||
// 用户头像
|
||||
const userProfilePicture = userStore.userInfo?.user?.icon ? `${import.meta.env.VITE_WEB_BASE_API}/file/${userStore.userInfo.user.icon}` : `/images/user.png`;
|
||||
// 系统头像
|
||||
const systemProfilePicture = `/images/logo.png`;
|
||||
export function getUserProfilePicture(): string {
|
||||
const userStore = useUserStore();
|
||||
return userStore.userInfo?.user?.icon
|
||||
? `${import.meta.env.VITE_WEB_BASE_API}/file/${userStore.userInfo.user.icon}`
|
||||
: `/images/user.png`;
|
||||
}
|
||||
|
||||
export {
|
||||
isUserVip,
|
||||
systemProfilePicture,
|
||||
userProfilePicture,
|
||||
};
|
||||
// 系统头像(可以常量)
|
||||
export const systemProfilePicture = `/images/logo.png`;
|
||||
|
||||
Reference in New Issue
Block a user