feat: 管理中心路由调整、选择公司逻辑调整
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
import { fetchEnterpriseInfo } from '@/api/all/login';
|
||||
|
||||
interface EnterpriseInfo {
|
||||
id: number;
|
||||
name: string;
|
||||
@ -13,18 +15,11 @@ interface EnterpriseState {
|
||||
|
||||
export const useEnterpriseStore = defineStore('enterprise', {
|
||||
state: (): EnterpriseState => ({
|
||||
// todo 暂时写死,登录功能完成后记得重置为null哦
|
||||
enterpriseInfo: {
|
||||
id: 1,
|
||||
name: '企业1',
|
||||
update_name_quota: 2,
|
||||
used_update_name_count: 1,
|
||||
sub_account_quota: 2,
|
||||
used_sub_account_count: 0,
|
||||
},
|
||||
enterpriseInfo: null,
|
||||
}),
|
||||
actions: {
|
||||
setEnterpriseInfo(enterpriseInfo: EnterpriseInfo) {
|
||||
console.log('setEnterpriseInfo', enterpriseInfo);
|
||||
this.enterpriseInfo = enterpriseInfo;
|
||||
},
|
||||
setEnterpriseName(name: string) {
|
||||
@ -45,5 +40,12 @@ export const useEnterpriseStore = defineStore('enterprise', {
|
||||
getEnterpriseInfo(): EnterpriseInfo | null {
|
||||
return this.enterpriseInfo;
|
||||
},
|
||||
async updateEnterpriseInfo() {
|
||||
const res = await fetchEnterpriseInfo(this.enterpriseInfo!.id);
|
||||
const { code, data } = res;
|
||||
if (code === 200) {
|
||||
this.setEnterpriseInfo(data);
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user