From 320ee2b20673f68ebeb5602be25b88e63799f4bb Mon Sep 17 00:00:00 2001 From: xiaoxian521 <1923740402@qq.com> Date: Wed, 27 Sep 2023 15:09:15 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=8E=A5=E5=8F=A3=E5=91=BD?= =?UTF-8?q?=E5=90=8D=E8=A7=84=E5=88=99=E7=BB=9F=E4=B8=80=E4=B8=BA`kebab-ca?= =?UTF-8?q?se`=E4=B8=B2=E5=BC=8F=E5=91=BD=E5=90=8D=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.en_US.md | 2 +- CHANGELOG.md | 2 +- CHANGELOG.zh_CN.md | 2 +- mock/asyncRoutes.ts | 2 +- mock/list.ts | 4 ++-- mock/map.ts | 2 +- mock/refreshToken.ts | 2 +- public/{serverConfig.json => platform-config.json} | 0 src/api/list.ts | 2 +- src/api/mock.ts | 2 +- src/api/routes.ts | 2 +- src/api/user.ts | 2 +- src/config/index.ts | 8 ++++---- src/layout/hooks/useLayout.ts | 2 +- src/main.ts | 4 ++-- src/utils/responsive.ts | 2 +- types/global.d.ts | 12 ++++++------ 17 files changed, 26 insertions(+), 26 deletions(-) rename public/{serverConfig.json => platform-config.json} (100%) diff --git a/CHANGELOG.en_US.md b/CHANGELOG.en_US.md index 887fc72af1..6beb301b00 100644 --- a/CHANGELOG.en_US.md +++ b/CHANGELOG.en_US.md @@ -322,7 +322,7 @@ - Add front-end single sign-on, test address https://yiming_chang.gitee.io/vue-pure-admin/#/pure-table/index?username=sso&roles=admin&accessToken=eyJhbGciOiJIUzUxMiJ9.admin - Add more examples for [@pureadmin/table](https://github.com/pure-admin/pure-admin-table) and `element-plus` [table](https://element-plus.org /zh-CN/component/table.html) example remains the same - Rich watermark function page (supports customizing various colors, shadows, text, additional attributes, setting undeletable watermarks and setting watermarks for specified elements) -- Optimize the menu, add `MenuArrowIconNoTransition` global configuration, configure it in `public/serverConfig.json`, for the left menu mode, the menu expansion can be set `MenuArrowIconNoTransition: true` to solve +- Optimize the menu, add `MenuArrowIconNoTransition` global configuration, configure it in `public/platform-config.json`, for the left menu mode, the menu expansion can be set `MenuArrowIconNoTransition: true` to solve - Replacement form designer component demo ### 🐞 Bug fixes diff --git a/CHANGELOG.md b/CHANGELOG.md index 887fc72af1..6beb301b00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -322,7 +322,7 @@ - Add front-end single sign-on, test address https://yiming_chang.gitee.io/vue-pure-admin/#/pure-table/index?username=sso&roles=admin&accessToken=eyJhbGciOiJIUzUxMiJ9.admin - Add more examples for [@pureadmin/table](https://github.com/pure-admin/pure-admin-table) and `element-plus` [table](https://element-plus.org /zh-CN/component/table.html) example remains the same - Rich watermark function page (supports customizing various colors, shadows, text, additional attributes, setting undeletable watermarks and setting watermarks for specified elements) -- Optimize the menu, add `MenuArrowIconNoTransition` global configuration, configure it in `public/serverConfig.json`, for the left menu mode, the menu expansion can be set `MenuArrowIconNoTransition: true` to solve +- Optimize the menu, add `MenuArrowIconNoTransition` global configuration, configure it in `public/platform-config.json`, for the left menu mode, the menu expansion can be set `MenuArrowIconNoTransition: true` to solve - Replacement form designer component demo ### 🐞 Bug fixes diff --git a/CHANGELOG.zh_CN.md b/CHANGELOG.zh_CN.md index 1feecc2315..f5de57a0a0 100644 --- a/CHANGELOG.zh_CN.md +++ b/CHANGELOG.zh_CN.md @@ -321,7 +321,7 @@ - 添加前端单点登录,测试地址 https://yiming_chang.gitee.io/vue-pure-admin/#/pure-table/index?username=sso&roles=admin&accessToken=eyJhbGciOiJIUzUxMiJ9.admin - 为 [@pureadmin/table](https://github.com/pure-admin/pure-admin-table) 添加更多的示例和 `element-plus` 的 [table](https://element-plus.org/zh-CN/component/table.html) 示例保持一致 - 丰富水印功能页面(支持自定义各种颜色、阴影、文字、额外属性、设置不可删除水印以及给指定元素设置水印) -- 优化菜单,添加 `MenuArrowIconNoTransition` 全局配置,在 `public/serverConfig.json` 中配置即可,对于出现左侧菜单模式,菜单展开卡顿的可设置 `MenuArrowIconNoTransition: true` 即可解决 +- 优化菜单,添加 `MenuArrowIconNoTransition` 全局配置,在 `public/platform-config.json` 中配置即可,对于出现左侧菜单模式,菜单展开卡顿的可设置 `MenuArrowIconNoTransition: true` 即可解决 - 更换表单设计器组件演示 ### 🐞 Bug fixes diff --git a/mock/asyncRoutes.ts b/mock/asyncRoutes.ts index 24e16a4d66..4f70697d31 100644 --- a/mock/asyncRoutes.ts +++ b/mock/asyncRoutes.ts @@ -200,7 +200,7 @@ const tabsRouter = { export default [ { - url: "/getAsyncRoutes", + url: "/get-async-routes", method: "get", response: () => { return { diff --git a/mock/list.ts b/mock/list.ts index 08e6b10ca3..3fae49f635 100644 --- a/mock/list.ts +++ b/mock/list.ts @@ -2,7 +2,7 @@ import { MockMethod } from "vite-plugin-mock"; export default [ { - url: "/getCardList", + url: "/get-card-list", method: "post", response: () => { return { @@ -559,7 +559,7 @@ export default [ { created_at: "2022-11-21T09:14:22Z", published_at: "2022-11-21T09:15:24Z", - body: "# 3.7.0 (2022-11-21)\r\n\r\n### ✔️ refactor\r\n\r\n- 使用 `intro.js` 替换 `driver.js`\r\n\r\n### 🎫 Feat\r\n\r\n- 添加前端单点登录,测试地址 https://yiming_chang.gitee.io/vue-pure-admin/#/pure-table/index?username=sso&roles=admin&accessToken=eyJhbGciOiJIUzUxMiJ9.admin\r\n- 为 [@pureadmin/table](https://github.com/xiaoxian521/pure-admin-table) 添加更多的示例和 `element-plus` 的 [table](https://element-plus.org/zh-CN/component/table.html) 示例保持一致\r\n- 丰富水印功能页面(支持自定义各种颜色、阴影、文字、额外属性、设置不可删除水印以及给指定元素设置水印)\r\n- 优化菜单,添加 `MenuArrowIconNoTransition` 全局配置,在 `public/serverConfig.json` 中配置即可,对于出现左侧菜单模式,菜单展开卡顿的可设置 `MenuArrowIconNoTransition: true` 即可解决\r\n- 更换表单设计器组件演示\r\n\r\n### 🐞 Bug fixes\r\n\r\n- 修复页内菜单带参互相跳转,标签没有选中高亮\r\n\r\n### 🍏 Perf\r\n\r\n- 删除已废弃的 `$baseUrl`\r\n- 兼容引入某个库导致 `global is not defined` 报错,将 `src/utils/globalPolyfills.ts` 文件引入 `src/main.ts` 即可解决\r\n- 删除 `@vitejs/plugin-legacy`,`vue3` 无法通过任何工具使其支持 `ie`" + body: "# 3.7.0 (2022-11-21)\r\n\r\n### ✔️ refactor\r\n\r\n- 使用 `intro.js` 替换 `driver.js`\r\n\r\n### 🎫 Feat\r\n\r\n- 添加前端单点登录,测试地址 https://yiming_chang.gitee.io/vue-pure-admin/#/pure-table/index?username=sso&roles=admin&accessToken=eyJhbGciOiJIUzUxMiJ9.admin\r\n- 为 [@pureadmin/table](https://github.com/xiaoxian521/pure-admin-table) 添加更多的示例和 `element-plus` 的 [table](https://element-plus.org/zh-CN/component/table.html) 示例保持一致\r\n- 丰富水印功能页面(支持自定义各种颜色、阴影、文字、额外属性、设置不可删除水印以及给指定元素设置水印)\r\n- 优化菜单,添加 `MenuArrowIconNoTransition` 全局配置,在 `public/platform-config.json` 中配置即可,对于出现左侧菜单模式,菜单展开卡顿的可设置 `MenuArrowIconNoTransition: true` 即可解决\r\n- 更换表单设计器组件演示\r\n\r\n### 🐞 Bug fixes\r\n\r\n- 修复页内菜单带参互相跳转,标签没有选中高亮\r\n\r\n### 🍏 Perf\r\n\r\n- 删除已废弃的 `$baseUrl`\r\n- 兼容引入某个库导致 `global is not defined` 报错,将 `src/utils/globalPolyfills.ts` 文件引入 `src/main.ts` 即可解决\r\n- 删除 `@vitejs/plugin-legacy`,`vue3` 无法通过任何工具使其支持 `ie`" }, { created_at: "2022-11-10T04:17:05Z", diff --git a/mock/map.ts b/mock/map.ts index f3a3c58b2e..9210aee104 100644 --- a/mock/map.ts +++ b/mock/map.ts @@ -25,7 +25,7 @@ const mapList = (): Array => { export default [ { - url: "/getMapInfo", + url: "/get-map-info", method: "get", response: () => { return { diff --git a/mock/refreshToken.ts b/mock/refreshToken.ts index 87b89953e6..1b8dc2a371 100644 --- a/mock/refreshToken.ts +++ b/mock/refreshToken.ts @@ -3,7 +3,7 @@ import { MockMethod } from "vite-plugin-mock"; // 模拟刷新token接口 export default [ { - url: "/refreshToken", + url: "/refresh-token", method: "post", response: ({ body }) => { if (body.refreshToken) { diff --git a/public/serverConfig.json b/public/platform-config.json similarity index 100% rename from public/serverConfig.json rename to public/platform-config.json diff --git a/src/api/list.ts b/src/api/list.ts index c389e40485..bd0125e4d9 100644 --- a/src/api/list.ts +++ b/src/api/list.ts @@ -10,7 +10,7 @@ type Result = { /** 卡片列表 */ export const getCardList = (data?: object) => { - return http.request("post", "/getCardList", { data }); + return http.request("post", "/get-card-list", { data }); }; /** 版本日志 */ diff --git a/src/api/mock.ts b/src/api/mock.ts index 3dac0fb8ed..3441b93f28 100644 --- a/src/api/mock.ts +++ b/src/api/mock.ts @@ -7,5 +7,5 @@ type Result = { /** 地图数据 */ export const mapJson = (params?: object) => { - return http.request("get", "/getMapInfo", { params }); + return http.request("get", "/get-map-info", { params }); }; diff --git a/src/api/routes.ts b/src/api/routes.ts index 277c5f3a1f..501ea3c7a8 100644 --- a/src/api/routes.ts +++ b/src/api/routes.ts @@ -6,5 +6,5 @@ type Result = { }; export const getAsyncRoutes = () => { - return http.request("get", "/getAsyncRoutes"); + return http.request("get", "/get-async-routes"); }; diff --git a/src/api/user.ts b/src/api/user.ts index 9f8125b708..66a797cb9b 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -35,5 +35,5 @@ export const getLogin = (data?: object) => { /** 刷新token */ export const refreshTokenApi = (data?: object) => { - return http.request("post", "/refreshToken", { data }); + return http.request("post", "/refresh-token", { data }); }; diff --git a/src/config/index.ts b/src/config/index.ts index 4cd3016654..4eaaa4591a 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -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 => { +export const getPlatformConfig = async (app: App): Promise => { 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 => { return $config; }) .catch(() => { - throw "请在public文件夹下添加serverConfig.json配置文件"; + throw "请在public文件夹下添加platform-config.json配置文件"; }); }; diff --git a/src/layout/hooks/useLayout.ts b/src/layout/hooks/useLayout.ts index 159d072a62..d983a314b4 100644 --- a/src/layout/hooks/useLayout.ts +++ b/src/layout/hooks/useLayout.ts @@ -43,7 +43,7 @@ export function useLayout() { } }; - /** 清空缓存后从serverConfig.json读取默认配置并赋值到storage中 */ + /** 清空缓存后从platform-config.json读取默认配置并赋值到storage中 */ const layout = computed(() => { return $storage?.layout.layout; }); diff --git a/src/main.ts b/src/main.ts index e365fae2e8..f549a4f2fc 100644 --- a/src/main.ts +++ b/src/main.ts @@ -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(); diff --git a/src/utils/responsive.ts b/src/utils/responsive.ts index 73fa54ceee..c439399c73 100644 --- a/src/utils/responsive.ts +++ b/src/utils/responsive.ts @@ -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( { diff --git a/types/global.d.ts b/types/global.d.ts index d96cecac1c..3953672df5 100644 --- a/types/global.d.ts +++ b/types/global.d.ts @@ -72,10 +72,10 @@ declare global { interface TableColumnList extends Array {} /** - * 对应 `public/serverConfig.json` 文件的类型声明 - * @see {@link https://yiming_chang.gitee.io/pure-admin-doc/pages/config/#serverconfig-json} + * 对应 `public/platform-config.json` 文件的类型声明 + * @see {@link https://yiming_chang.gitee.io/pure-admin-doc/pages/config/#platform-config-json} */ - interface ServerConfigs { + interface PlatformConfigs { Version?: string; Title?: string; FixedHeader?: boolean; @@ -108,8 +108,8 @@ declare global { } /** - * 与 `ServerConfigs` 类型不同,这里是缓存到浏览器本地存储的类型声明 - * @see {@link https://yiming_chang.gitee.io/pure-admin-doc/pages/config/#serverconfig-json} + * 与 `PlatformConfigs` 类型不同,这里是缓存到浏览器本地存储的类型声明 + * @see {@link https://yiming_chang.gitee.io/pure-admin-doc/pages/config/#platform-config-json} */ interface StorageConfigs { version?: string; @@ -171,6 +171,6 @@ declare global { interface GlobalPropertiesApi { $echarts: ECharts; $storage: ResponsiveStorage; - $config: ServerConfigs; + $config: PlatformConfigs; } }