perf: 登录逻辑调整

This commit is contained in:
rd
2025-09-11 12:04:54 +08:00
parent 44e1ea9a06
commit 7e6e086098
11 changed files with 103 additions and 104 deletions

View File

@ -1,7 +1,5 @@
import { fetchEnterpriseInfo } from '@/api/all/login';
import { useSidebarStore } from '@/stores/modules/side-bar';
import { useUserStore } from '@/stores/modules/user';
import { glsWithCatch, slsWithCatch, rlsWithCatch } from '@/utils/stroage';
import { glsWithCatch, slsWithCatch } from '@/utils/stroage';
interface EnterpriseInfo {
id: number | string;
@ -11,6 +9,8 @@ interface EnterpriseInfo {
sub_account_quota: number;
used_sub_account_count: number;
permissions: string[];
[key: string]: any;
}
interface EnterpriseState {
@ -21,6 +21,12 @@ export const useEnterpriseStore = defineStore('enterprise', {
state: (): EnterpriseState => ({
enterpriseInfo: (glsWithCatch('enterpriseInfo') && JSON.parse(glsWithCatch('enterpriseInfo') as string)) || null,
}),
getters: {
// 企业已开通/试用中
isOpenEnterprise(): boolean {
return [1, 2].includes(this.enterpriseInfo?.subscribe_status);
},
},
actions: {
setEnterpriseInfo(enterpriseInfo: EnterpriseInfo) {
this.enterpriseInfo = enterpriseInfo;