|
@@ -8,7 +8,7 @@ const setConfig = (cfg?: unknown) => {
|
|
config = Object.assign(config, cfg);
|
|
config = Object.assign(config, cfg);
|
|
};
|
|
};
|
|
|
|
|
|
-const getConfig = (key?: string): ServerConfigs => {
|
|
|
|
|
|
+const getConfig = (key?: string): PlatformConfigs => {
|
|
if (typeof key === "string") {
|
|
if (typeof key === "string") {
|
|
const arr = key.split(".");
|
|
const arr = key.split(".");
|
|
if (arr && arr.length) {
|
|
if (arr && arr.length) {
|
|
@@ -27,11 +27,11 @@ const getConfig = (key?: string): ServerConfigs => {
|
|
};
|
|
};
|
|
|
|
|
|
/** 获取项目动态全局配置 */
|
|
/** 获取项目动态全局配置 */
|
|
-export const getServerConfig = async (app: App): Promise<undefined> => {
|
|
|
|
|
|
+export const getPlatformConfig = async (app: App): Promise<undefined> => {
|
|
app.config.globalProperties.$config = getConfig();
|
|
app.config.globalProperties.$config = getConfig();
|
|
return axios({
|
|
return axios({
|
|
method: "get",
|
|
method: "get",
|
|
- url: `${VITE_PUBLIC_PATH}serverConfig.json`
|
|
|
|
|
|
+ url: `${VITE_PUBLIC_PATH}platform-config.json`
|
|
})
|
|
})
|
|
.then(({ data: config }) => {
|
|
.then(({ data: config }) => {
|
|
let $config = app.config.globalProperties.$config;
|
|
let $config = app.config.globalProperties.$config;
|
|
@@ -45,7 +45,7 @@ export const getServerConfig = async (app: App): Promise<undefined> => {
|
|
return $config;
|
|
return $config;
|
|
})
|
|
})
|
|
.catch(() => {
|
|
.catch(() => {
|
|
- throw "请在public文件夹下添加serverConfig.json配置文件";
|
|
|
|
|
|
+ throw "请在public文件夹下添加platform-config.json配置文件";
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
|