将行业热门话题洞察的需要修改成columns

This commit is contained in:
lq
2025-06-21 16:57:01 +08:00
29 changed files with 1312 additions and 150 deletions

View File

@ -0,0 +1,49 @@
interface EnterpriseInfo {
id: number;
name: string;
update_name_quota: number;
used_update_name_count: number;
sub_account_quota: number;
used_sub_account_count: number;
}
interface EnterpriseState {
enterpriseInfo: EnterpriseInfo | null;
}
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: 2,
},
}),
actions: {
setEnterpriseInfo(enterpriseInfo: EnterpriseInfo) {
this.enterpriseInfo = enterpriseInfo;
},
setEnterpriseName(name: string) {
if (this.enterpriseInfo) {
this.enterpriseInfo.name = name;
}
},
incUsedUpdateNameCount() {
if (this.enterpriseInfo) {
this.enterpriseInfo.used_update_name_count++;
}
},
incUsedSubAccountCount() {
if (this.enterpriseInfo) {
this.enterpriseInfo.used_sub_account_count++;
}
},
getEnterpriseInfo(): EnterpriseInfo | null {
return this.enterpriseInfo;
},
},
});

View File

@ -19,6 +19,13 @@ interface UserState {
token: string;
userInfo: UserInfo | null;
companyInfo: CompanyInfo | null;
isLogin: boolean;
}
interface UserInfo {
id: number;
mobile: string;
name: string;
}
export const useUserStore = defineStore('user', {
@ -26,67 +33,47 @@ export const useUserStore = defineStore('user', {
token: localStorage.getItem('accessToken') || '',
userInfo: null,
companyInfo: null,
isLogin: false,
}),
actions: {
setToken(token: String) {
const _token = `Bearer ${token}`;
this.token = _token;
localStorage.setItem('accessToken', _token);
// 设置 Token
setToken(token: string) {
this.token = `Bearer ${token}`;
localStorage.setItem('accessToken', this.token);
},
// 存储用户信息
// 获取 Token
getToken() {
return this.token;
},
// 设置用户信息
setUserInfo(userInfo: UserInfo | null) {
this.userInfo = userInfo;
if (userInfo) {
localStorage.setItem('userInfo', JSON.stringify(userInfo));
} else {
localStorage.removeItem('userInfo');
}
},
// 获取用户信息
getUserInfo(): UserInfo | null {
const userInfoStr = localStorage.getItem('userInfo');
if (userInfoStr) {
try {
return JSON.parse(userInfoStr);
} catch (error) {
console.error('解析用户信息失败:', error);
return null;
}
}
return null;
return this.userInfo;
},
// 存储公司信息
// 设置公司信息
setCompanyInfo(companyInfo: CompanyInfo | null) {
this.companyInfo = companyInfo;
if (companyInfo) {
localStorage.setItem('companyInfo', JSON.stringify(companyInfo));
} else {
localStorage.removeItem('companyInfo');
}
},
// 获取公司信息
getCompanyInfo(): CompanyInfo | null {
const companyInfoStr = localStorage.getItem('companyInfo');
if (companyInfoStr) {
try {
return JSON.parse(companyInfoStr);
} catch (error) {
console.error('解析公司信息失败:', error);
return null;
}
}
return null;
return this.companyInfo;
},
// 删除 token
deleteToken() {
this.token = '';
localStorage.removeItem('accessToken');
// 登录状态
setIsLogin(isLogin: boolean) {
this.isLogin = isLogin;
},
},
getIsLogin(): boolean {
return this.isLogin;
}
}
});