mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-11-09 13:53:38 +08:00
refactor: 接口命名规则统一为kebab-case串式命名法
This commit is contained in:
@@ -10,7 +10,7 @@ type Result = {
|
||||
|
||||
/** 卡片列表 */
|
||||
export const getCardList = (data?: object) => {
|
||||
return http.request<Result>("post", "/getCardList", { data });
|
||||
return http.request<Result>("post", "/get-card-list", { data });
|
||||
};
|
||||
|
||||
/** 版本日志 */
|
||||
|
||||
@@ -7,5 +7,5 @@ type Result = {
|
||||
|
||||
/** 地图数据 */
|
||||
export const mapJson = (params?: object) => {
|
||||
return http.request<Result>("get", "/getMapInfo", { params });
|
||||
return http.request<Result>("get", "/get-map-info", { params });
|
||||
};
|
||||
|
||||
@@ -6,5 +6,5 @@ type Result = {
|
||||
};
|
||||
|
||||
export const getAsyncRoutes = () => {
|
||||
return http.request<Result>("get", "/getAsyncRoutes");
|
||||
return http.request<Result>("get", "/get-async-routes");
|
||||
};
|
||||
|
||||
@@ -35,5 +35,5 @@ export const getLogin = (data?: object) => {
|
||||
|
||||
/** 刷新token */
|
||||
export const refreshTokenApi = (data?: object) => {
|
||||
return http.request<RefreshTokenResult>("post", "/refreshToken", { data });
|
||||
return http.request<RefreshTokenResult>("post", "/refresh-token", { data });
|
||||
};
|
||||
|
||||
@@ -8,7 +8,7 @@ const setConfig = (cfg?: unknown) => {
|
||||
config = Object.assign(config, cfg);
|
||||
};
|
||||
|
||||
const getConfig = (key?: string): ServerConfigs => {
|
||||
const getConfig = (key?: string): PlatformConfigs => {
|
||||
if (typeof key === "string") {
|
||||
const arr = key.split(".");
|
||||
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();
|
||||
return axios({
|
||||
method: "get",
|
||||
url: `${VITE_PUBLIC_PATH}serverConfig.json`
|
||||
url: `${VITE_PUBLIC_PATH}platform-config.json`
|
||||
})
|
||||
.then(({ data: config }) => {
|
||||
let $config = app.config.globalProperties.$config;
|
||||
@@ -45,7 +45,7 @@ export const getServerConfig = async (app: App): Promise<undefined> => {
|
||||
return $config;
|
||||
})
|
||||
.catch(() => {
|
||||
throw "请在public文件夹下添加serverConfig.json配置文件";
|
||||
throw "请在public文件夹下添加platform-config.json配置文件";
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ export function useLayout() {
|
||||
}
|
||||
};
|
||||
|
||||
/** 清空缓存后从serverConfig.json读取默认配置并赋值到storage中 */
|
||||
/** 清空缓存后从platform-config.json读取默认配置并赋值到storage中 */
|
||||
const layout = computed(() => {
|
||||
return $storage?.layout.layout;
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@ import router from "./router";
|
||||
import { setupStore } from "@/store";
|
||||
import ElementPlus from "element-plus";
|
||||
import { useI18n } from "@/plugins/i18n";
|
||||
import { getServerConfig } from "./config";
|
||||
import { getPlatformConfig } from "./config";
|
||||
import { createApp, Directive } from "vue";
|
||||
import { MotionPlugin } from "@vueuse/motion";
|
||||
import { useEcharts } from "@/plugins/echarts";
|
||||
@@ -45,7 +45,7 @@ app.component("FontIcon", FontIcon);
|
||||
import { Auth } from "@/components/ReAuth";
|
||||
app.component("Auth", Auth);
|
||||
|
||||
getServerConfig(app).then(async config => {
|
||||
getPlatformConfig(app).then(async config => {
|
||||
setupStore(app);
|
||||
app.use(router);
|
||||
await router.isReady();
|
||||
|
||||
@@ -4,7 +4,7 @@ import Storage from "responsive-storage";
|
||||
import { routerArrays } from "@/layout/types";
|
||||
import { responsiveStorageNameSpace } from "@/config";
|
||||
|
||||
export const injectResponsiveStorage = (app: App, config: ServerConfigs) => {
|
||||
export const injectResponsiveStorage = (app: App, config: PlatformConfigs) => {
|
||||
const nameSpace = responsiveStorageNameSpace();
|
||||
const configObj = Object.assign(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user