Jelajahi Sumber

refactor: 接口命名规则统一为`kebab-case`串式命名法

xiaoxian521 1 tahun lalu
induk
melakukan
320ee2b206

+ 1 - 1
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

+ 1 - 1
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

+ 1 - 1
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

+ 1 - 1
mock/asyncRoutes.ts

@@ -200,7 +200,7 @@ const tabsRouter = {
 
 export default [
   {
-    url: "/getAsyncRoutes",
+    url: "/get-async-routes",
     method: "get",
     response: () => {
       return {

+ 2 - 2
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",

+ 1 - 1
mock/map.ts

@@ -25,7 +25,7 @@ const mapList = (): Array<mapType> => {
 
 export default [
   {
-    url: "/getMapInfo",
+    url: "/get-map-info",
     method: "get",
     response: () => {
       return {

+ 1 - 1
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) {

+ 0 - 0
public/serverConfig.json → public/platform-config.json


+ 1 - 1
src/api/list.ts

@@ -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 });
 };
 
 /** 版本日志 */

+ 1 - 1
src/api/mock.ts

@@ -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 });
 };

+ 1 - 1
src/api/routes.ts

@@ -6,5 +6,5 @@ type Result = {
 };
 
 export const getAsyncRoutes = () => {
-  return http.request<Result>("get", "/getAsyncRoutes");
+  return http.request<Result>("get", "/get-async-routes");
 };

+ 1 - 1
src/api/user.ts

@@ -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 });
 };

+ 4 - 4
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<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配置文件";
     });
 };
 

+ 1 - 1
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;
   });

+ 2 - 2
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();

+ 1 - 1
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(
     {

+ 6 - 6
types/global.d.ts

@@ -72,10 +72,10 @@ declare global {
   interface TableColumnList extends Array<TableColumns> {}
 
   /**
-   * 对应 `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;
   }
 }