mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-10-09 19:16:44 +00:00
清理无用文件和资源,调整代码格式统一双引号,修复部分组件路径引用问题 删除大量无用图片资源和组件文件,统一代码风格使用双引号,修复国际化文件路径引用,调整部分组件逻辑,优化项目结构
61 lines
1.6 KiB
TypeScript
61 lines
1.6 KiB
TypeScript
import { store } from "@/store";
|
|
import ParamsAPI, { ConfigTable } from "@/api/module_system/params";
|
|
import { defineStore } from "pinia";
|
|
|
|
interface ConfigState {
|
|
// 网站信息
|
|
sys_web_title: ConfigTable;
|
|
sys_web_version: ConfigTable;
|
|
sys_web_description: ConfigTable;
|
|
// 网站图标
|
|
sys_login_background: ConfigTable;
|
|
sys_web_favicon: ConfigTable;
|
|
sys_web_logo: ConfigTable;
|
|
// 安全隐私配置
|
|
sys_keep_record: ConfigTable;
|
|
sys_web_clause: ConfigTable;
|
|
sys_web_copyright: ConfigTable;
|
|
sys_web_privacy: ConfigTable;
|
|
sys_git_code: ConfigTable;
|
|
sys_help_doc: ConfigTable;
|
|
// 接口安全配置
|
|
white_api_list_path: ConfigTable;
|
|
ip_black_list: ConfigTable;
|
|
// 演示环境配置
|
|
demo_enable: ConfigTable;
|
|
ip_white_list: ConfigTable;
|
|
}
|
|
|
|
export const useConfigStore = defineStore("config", {
|
|
state: () => ({
|
|
configData: {} as ConfigState,
|
|
isConfigLoaded: false,
|
|
configLoading: false,
|
|
}),
|
|
|
|
actions: {
|
|
async getConfig(force = false) {
|
|
if ((this.isConfigLoaded && !force) || this.configLoading) {
|
|
return;
|
|
}
|
|
this.configLoading = true;
|
|
try {
|
|
const response = await ParamsAPI.getInitConfig();
|
|
response.data.data.forEach((item: ConfigTable) => {
|
|
if (item.config_value !== undefined) {
|
|
this.configData[item.config_key as keyof ConfigState] = item;
|
|
}
|
|
});
|
|
this.isConfigLoaded = true;
|
|
} finally {
|
|
this.configLoading = false;
|
|
}
|
|
},
|
|
},
|
|
persist: true,
|
|
});
|
|
|
|
export function useConfigStoreHook() {
|
|
return useConfigStore(store);
|
|
}
|