fix: 更改API相关接口的路径

This commit is contained in:
valarchie 2023-08-05 14:48:16 +08:00
parent 55814a6a30
commit 49a3b118e1
11 changed files with 19 additions and 122 deletions

View File

@ -96,3 +96,13 @@ export const loginByPassword = (data: LoginByPasswordDTO) => {
export const getLoginUserInfo = () => { export const getLoginUserInfo = () => {
return http.request<ResponseData<TokenDTO>>("get", "/getLoginUserInfo"); return http.request<ResponseData<TokenDTO>>("get", "/getLoginUserInfo");
}; };
type Result = {
success: boolean;
data: Array<any>;
};
/** 获取动态菜单 */
export const getAsyncRoutes = () => {
return http.request<Result>("get", "/getRouters");
};

View File

@ -1,10 +0,0 @@
import { http } from "@/utils/http";
type Result = {
success: boolean;
data: Array<any>;
};
export const getAsyncRoutes = () => {
return http.request<Result>("get", "/getRouters");
};

View File

@ -1,24 +1,5 @@
import { http } from "@/utils/http"; import { http } from "@/utils/http";
type Result = {
success: boolean;
data?: {
/** 列表数据 */
list: Array<any>;
/** 总条目数 */
total?: number;
/** 每页显示条目个数 */
pageSize?: number;
/** 当前页数 */
currentPage?: number;
};
};
type ResultDept = {
success: boolean;
data?: Array<any>;
};
export interface SystemNoticeQuery extends BasePageQuery { export interface SystemNoticeQuery extends BasePageQuery {
noticeType: string; noticeType: string;
noticeTitle: string; noticeTitle: string;
@ -43,21 +24,6 @@ export type SystemNoticeRequest = {
status: number; status: number;
}; };
/** 获取用户管理列表 */
export const getUserList = (data?: object) => {
return http.request<Result>("post", "/user", { data });
};
/** 获取角色管理列表 */
export const getRoleList = (data?: object) => {
return http.request<Result>("post", "/role", { data });
};
/** 获取部门管理列表 */
export const getDeptList = (data?: object) => {
return http.request<ResultDept>("post", "/dept", { data });
};
/** 获取系统通知列表 */ /** 获取系统通知列表 */
export const getSystemNoticeListApi = (params?: SystemNoticeQuery) => { export const getSystemNoticeListApi = (params?: SystemNoticeQuery) => {
return http.request<ResponseData<PageDTO<SystemNoticeDTO>>>( return http.request<ResponseData<PageDTO<SystemNoticeDTO>>>(
@ -96,38 +62,3 @@ export const deleteSystemNoticeApi = (data: Array<number>) => {
} }
}); });
}; };
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<ResponseData<PageDTO<OperationLogDTO>>>(
"get",
"/operationLog/list",
{
params
}
);
};

View File

@ -1,34 +0,0 @@
import { http } from "@/utils/http";
export type UserResult = {
success: boolean;
data: {
/** 用户名 */
username: string;
/** 当前登陆用户的角色 */
roles: Array<string>;
/** `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<UserResult>("post", "/login", { data });
};

View File

@ -25,7 +25,7 @@ import { buildHierarchyTree } from "@/utils/tree";
import { isUrl, openLink, storageSession, isAllEmpty } from "@pureadmin/utils"; import { isUrl, openLink, storageSession, isAllEmpty } from "@pureadmin/utils";
import remainingRouter from "./modules/remaining"; import remainingRouter from "./modules/remaining";
import { TokenDTO } from "@/api/common"; import { TokenDTO } from "@/api/common/login";
/** src/router/modules .ts remaining.ts /** src/router/modules .ts remaining.ts
* https://github.com/mrmlnc/fast-glob#basic-syntax * https://github.com/mrmlnc/fast-glob#basic-syntax

View File

@ -27,8 +27,8 @@ const IFrame = () => import("@/layout/frameView.vue");
const modulesRoutes = import.meta.glob("/src/views/**/*.{vue,tsx}"); const modulesRoutes = import.meta.glob("/src/views/**/*.{vue,tsx}");
// 动态路由 // 动态路由
import { getAsyncRoutes } from "@/api/routes"; import { getAsyncRoutes } from "@/api/common/login";
import { TokenDTO } from "@/api/common"; import { TokenDTO } from "@/api/common/login";
function handRank(routeInfo: any) { function handRank(routeInfo: any) {
const { name, path, parentId, meta } = routeInfo; const { name, path, parentId, meta } = routeInfo;

View File

@ -1,5 +1,5 @@
import { RouteRecordName } from "vue-router"; import { RouteRecordName } from "vue-router";
import { DictionaryData } from "../../api/common"; import { DictionaryData } from "../../api/common/login";
export type cacheType = { export type cacheType = {
mode: string; mode: string;

View File

@ -6,7 +6,7 @@ import { router, resetRouter } from "@/router";
import { storageSession } from "@pureadmin/utils"; import { storageSession } from "@pureadmin/utils";
import { useMultiTagsStoreHook } from "@/store/modules/multiTags"; import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
import { removeToken, sessionKey } from "@/utils/auth"; import { removeToken, sessionKey } from "@/utils/auth";
import { DictionaryData, TokenDTO } from "@/api/common"; import { DictionaryData, TokenDTO } from "@/api/common/login";
import { storageLocal } from "@pureadmin/utils"; import { storageLocal } from "@pureadmin/utils";
const dictionaryListKey = "ag-dictionary-list"; const dictionaryListKey = "ag-dictionary-list";

View File

@ -2,7 +2,7 @@ import Cookies from "js-cookie";
import { storageSession } from "@pureadmin/utils"; import { storageSession } from "@pureadmin/utils";
import { useUserStoreHook } from "@/store/modules/user"; import { useUserStoreHook } from "@/store/modules/user";
import { aesEncrypt, aesDecrypt } from "@/utils/crypt"; import { aesEncrypt, aesDecrypt } from "@/utils/crypt";
import { TokenDTO } from "@/api/common"; import { TokenDTO } from "@/api/common/login";
/** /**
* token实现 * token实现

View File

@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { useUserStoreHook } from "@/store/modules/user"; import { useUserStoreHook } from "@/store/modules/user";
import { OperationLogDTO } from "../../../../api/system/log"; import { OperationLogDTO } from "@/api/system/log";
/** TODO 有其他方式 来换掉这个props 父子组件传值吗? */ /** TODO 有其他方式 来换掉这个props 父子组件传值吗? */
const props = defineProps<OperationLogDTO>(); const props = defineProps<OperationLogDTO>();

View File

@ -1,7 +1,7 @@
import dayjs from "dayjs"; import dayjs from "dayjs";
import editForm from "../form.vue"; import editForm from "../form.vue";
import { message } from "@/utils/message"; import { message } from "@/utils/message";
import { SystemNoticeQuery, getSystemNoticeListApi } from "@/api/system"; import { SystemNoticeQuery, getSystemNoticeListApi } from "@/api/system/notice";
import { addDialog } from "@/components/ReDialog"; import { addDialog } from "@/components/ReDialog";
import { ElMessageBox, Sort } from "element-plus"; import { ElMessageBox, Sort } from "element-plus";
import { AddNoticeRequest } from "../utils/types"; import { AddNoticeRequest } from "../utils/types";
@ -11,7 +11,7 @@ import {
updateSystemNoticeApi, updateSystemNoticeApi,
deleteSystemNoticeApi, deleteSystemNoticeApi,
SystemNoticeRequest SystemNoticeRequest
} from "@/api/system"; } from "@/api/system/notice";
import { reactive, ref, onMounted, h, toRaw } from "vue"; import { reactive, ref, onMounted, h, toRaw } from "vue";
import { useUserStoreHook } from "@/store/modules/user"; import { useUserStoreHook } from "@/store/modules/user";
import { CommonUtils } from "@/utils/common"; import { CommonUtils } from "@/utils/common";