feat(store): 新增用户和企业信息管理功能
- 在 user store 中添加 userInfo 相关状态和操作 - 创建 enterprise store管理企业信息 - 更新相关组件以使用新的 store 方法
This commit is contained in:
39
src/stores/modules/enterprise/index.ts
Normal file
39
src/stores/modules/enterprise/index.ts
Normal file
@ -0,0 +1,39 @@
|
||||
interface EnterpriseInfo {
|
||||
id: number;
|
||||
name: string;
|
||||
update_name_quota: number;
|
||||
used_update_name_count: number;
|
||||
sub_account_quota: number;
|
||||
used_sub_account_count: number;
|
||||
}
|
||||
|
||||
export const useEnterpriseStore = defineStore('enterprise', {
|
||||
state: () => ({
|
||||
// todo 暂时写死,登录功能完成后记得重置为null哦
|
||||
enterpriseInfo: {
|
||||
id: 1,
|
||||
name: '企业1',
|
||||
update_name_quota: 2,
|
||||
used_update_name_count: 1,
|
||||
sub_account_quota: 2,
|
||||
used_sub_account_count: 2,
|
||||
},
|
||||
}),
|
||||
actions: {
|
||||
setEnterpriseInfo(enterpriseInfo: EnterpriseInfo) {
|
||||
this.enterpriseInfo = enterpriseInfo;
|
||||
},
|
||||
setEnterpriseName(name: string) {
|
||||
this.enterpriseInfo.name = name;
|
||||
},
|
||||
incUsedUpdateNameCount() {
|
||||
this.enterpriseInfo.used_update_name_count++;
|
||||
},
|
||||
incUsedSubAccountCount() {
|
||||
this.enterpriseInfo.used_sub_account_count++;
|
||||
},
|
||||
getEnterpriseInfo(): EnterpriseInfo {
|
||||
return this.enterpriseInfo;
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user