From 49a3b118e1f85bd00ef1754ef08601c813975cfc Mon Sep 17 00:00:00 2001 From: valarchie <343928303@qq.com> Date: Sat, 5 Aug 2023 14:48:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=94=B9API=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E7=9A=84=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/{common.ts => common/login.ts} | 10 +++ src/api/routes.ts | 10 --- src/api/{system.ts => system/notice.ts} | 69 ------------------- src/api/user.ts | 34 --------- src/router/index.ts | 2 +- src/router/utils.ts | 4 +- src/store/modules/types.ts | 2 +- src/store/modules/user.ts | 2 +- src/utils/auth.ts | 2 +- .../system/log/operationLog/description.vue | 2 +- src/views/system/notice/utils/hook.tsx | 4 +- 11 files changed, 19 insertions(+), 122 deletions(-) rename src/api/{common.ts => common/login.ts} (92%) delete mode 100644 src/api/routes.ts rename src/api/{system.ts => system/notice.ts} (50%) delete mode 100644 src/api/user.ts diff --git a/src/api/common.ts b/src/api/common/login.ts similarity index 92% rename from src/api/common.ts rename to src/api/common/login.ts index b82a541..e5748eb 100644 --- a/src/api/common.ts +++ b/src/api/common/login.ts @@ -96,3 +96,13 @@ export const loginByPassword = (data: LoginByPasswordDTO) => { export const getLoginUserInfo = () => { return http.request>("get", "/getLoginUserInfo"); }; + +type Result = { + success: boolean; + data: Array; +}; + +/** 获取动态菜单 */ +export const getAsyncRoutes = () => { + return http.request("get", "/getRouters"); +}; diff --git a/src/api/routes.ts b/src/api/routes.ts deleted file mode 100644 index 7b0c13a..0000000 --- a/src/api/routes.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { http } from "@/utils/http"; - -type Result = { - success: boolean; - data: Array; -}; - -export const getAsyncRoutes = () => { - return http.request("get", "/getRouters"); -}; diff --git a/src/api/system.ts b/src/api/system/notice.ts similarity index 50% rename from src/api/system.ts rename to src/api/system/notice.ts index 290a9f1..62931e4 100644 --- a/src/api/system.ts +++ b/src/api/system/notice.ts @@ -1,24 +1,5 @@ import { http } from "@/utils/http"; -type Result = { - success: boolean; - data?: { - /** 列表数据 */ - list: Array; - /** 总条目数 */ - total?: number; - /** 每页显示条目个数 */ - pageSize?: number; - /** 当前页数 */ - currentPage?: number; - }; -}; - -type ResultDept = { - success: boolean; - data?: Array; -}; - export interface SystemNoticeQuery extends BasePageQuery { noticeType: string; noticeTitle: string; @@ -43,21 +24,6 @@ export type SystemNoticeRequest = { status: number; }; -/** 获取用户管理列表 */ -export const getUserList = (data?: object) => { - return http.request("post", "/user", { data }); -}; - -/** 获取角色管理列表 */ -export const getRoleList = (data?: object) => { - return http.request("post", "/role", { data }); -}; - -/** 获取部门管理列表 */ -export const getDeptList = (data?: object) => { - return http.request("post", "/dept", { data }); -}; - /** 获取系统通知列表 */ export const getSystemNoticeListApi = (params?: SystemNoticeQuery) => { return http.request>>( @@ -96,38 +62,3 @@ export const deleteSystemNoticeApi = (data: Array) => { } }); }; - -type OperationLogDTO = { - operationId: number; - businessType: number; - businessTypeStr: string; - requestMethod: string; - requestModule: string; - requestUrl: string; - calledMethod: string; - operatorType: number; - operatorTypeStr: string; - userId: number; - username: string; - operatorIp: string; - operatorLocation: string; - deptId: number; - deptName: string; - operationParam: string; - operationResult: string; - status: number; - statusStr: string; - errorStack: string; - operationTime: Date; -}; - -/** 获取操作日志列表 */ -export const getOperationLogListApi = (params?: SystemNoticeQuery) => { - return http.request>>( - "get", - "/operationLog/list", - { - params - } - ); -}; diff --git a/src/api/user.ts b/src/api/user.ts deleted file mode 100644 index 3c56c4c..0000000 --- a/src/api/user.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { http } from "@/utils/http"; - -export type UserResult = { - success: boolean; - data: { - /** 用户名 */ - username: string; - /** 当前登陆用户的角色 */ - roles: Array; - /** `token` */ - accessToken: string; - /** 用于调用刷新`accessToken`的接口时所需的`token` */ - refreshToken: string; - /** `accessToken`的过期时间(格式'xxxx/xx/xx xx:xx:xx') */ - expires: Date; - }; -}; - -export type RefreshTokenResult = { - success: boolean; - data: { - /** `token` */ - accessToken: string; - /** 用于调用刷新`accessToken`的接口时所需的`token` */ - refreshToken: string; - /** `accessToken`的过期时间(格式'xxxx/xx/xx xx:xx:xx') */ - expires: Date; - }; -}; - -/** 登录 */ -export const getLogin = (data?: object) => { - return http.request("post", "/login", { data }); -}; diff --git a/src/router/index.ts b/src/router/index.ts index b23c59f..8565cd2 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -25,7 +25,7 @@ import { buildHierarchyTree } from "@/utils/tree"; import { isUrl, openLink, storageSession, isAllEmpty } from "@pureadmin/utils"; import remainingRouter from "./modules/remaining"; -import { TokenDTO } from "@/api/common"; +import { TokenDTO } from "@/api/common/login"; /** 自动导入全部静态路由,无需再手动引入!匹配 src/router/modules 目录(任何嵌套级别)中具有 .ts 扩展名的所有文件,除了 remaining.ts 文件 * 如何匹配所有文件请看:https://github.com/mrmlnc/fast-glob#basic-syntax diff --git a/src/router/utils.ts b/src/router/utils.ts index 6302d9d..cb0930c 100644 --- a/src/router/utils.ts +++ b/src/router/utils.ts @@ -27,8 +27,8 @@ const IFrame = () => import("@/layout/frameView.vue"); const modulesRoutes = import.meta.glob("/src/views/**/*.{vue,tsx}"); // 动态路由 -import { getAsyncRoutes } from "@/api/routes"; -import { TokenDTO } from "@/api/common"; +import { getAsyncRoutes } from "@/api/common/login"; +import { TokenDTO } from "@/api/common/login"; function handRank(routeInfo: any) { const { name, path, parentId, meta } = routeInfo; diff --git a/src/store/modules/types.ts b/src/store/modules/types.ts index cdf679b..d3484fa 100644 --- a/src/store/modules/types.ts +++ b/src/store/modules/types.ts @@ -1,5 +1,5 @@ import { RouteRecordName } from "vue-router"; -import { DictionaryData } from "../../api/common"; +import { DictionaryData } from "../../api/common/login"; export type cacheType = { mode: string; diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index 5c1497b..8fdf59e 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -6,7 +6,7 @@ import { router, resetRouter } from "@/router"; import { storageSession } from "@pureadmin/utils"; import { useMultiTagsStoreHook } from "@/store/modules/multiTags"; import { removeToken, sessionKey } from "@/utils/auth"; -import { DictionaryData, TokenDTO } from "@/api/common"; +import { DictionaryData, TokenDTO } from "@/api/common/login"; import { storageLocal } from "@pureadmin/utils"; const dictionaryListKey = "ag-dictionary-list"; diff --git a/src/utils/auth.ts b/src/utils/auth.ts index d499574..7bf0a11 100644 --- a/src/utils/auth.ts +++ b/src/utils/auth.ts @@ -2,7 +2,7 @@ import Cookies from "js-cookie"; import { storageSession } from "@pureadmin/utils"; import { useUserStoreHook } from "@/store/modules/user"; import { aesEncrypt, aesDecrypt } from "@/utils/crypt"; -import { TokenDTO } from "@/api/common"; +import { TokenDTO } from "@/api/common/login"; /** * 原版前端token实现 diff --git a/src/views/system/log/operationLog/description.vue b/src/views/system/log/operationLog/description.vue index 74da416..564beb3 100644 --- a/src/views/system/log/operationLog/description.vue +++ b/src/views/system/log/operationLog/description.vue @@ -1,6 +1,6 @@