first commit
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import createAxios from '@/utils/request';
|
||||
import type { IAgent } from '@/domain/iAgents';
|
||||
|
||||
export async function getAgentList() {
|
||||
return createAxios<IAgent[]>({
|
||||
url: '/ai/agent',
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
export async function getAgent(id: number) {
|
||||
return createAxios<IAgent>({
|
||||
url: `/ai/agent/${id}`,
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
export async function updateAgent(id: number, data: {enabled: boolean}) {
|
||||
return createAxios({
|
||||
url: `/ai/agent/${id}`,
|
||||
method: 'put',
|
||||
data,
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import createAxios from '@/utils/request';
|
||||
import type {BubbleItemType, ConversationItemType} from "@ant-design/x";
|
||||
|
||||
/** 获取会话列表 */
|
||||
export async function getConversations() {
|
||||
return createAxios<ConversationItemType[]>({
|
||||
url: '/ai/chat/conversations',
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取会话消息 */
|
||||
export async function getMessages(conversationId: string) {
|
||||
return createAxios<BubbleItemType[]>({
|
||||
url: `/ai/chat/messages/${conversationId}`,
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除会话 */
|
||||
export async function deleteConversation(conversationId: string) {
|
||||
return createAxios({
|
||||
url: `/ai/chat/conversations/${conversationId}`,
|
||||
method: 'delete',
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import createAxios from '@/utils/request';
|
||||
import type { IAgentMessage } from '@/domain/iAgents.ts';
|
||||
|
||||
interface PaginatorData<T> {
|
||||
data: T[];
|
||||
total: number;
|
||||
pageSize: number;
|
||||
current: number;
|
||||
}
|
||||
|
||||
/** 获取会话消息列表 */
|
||||
export async function getMessages(conversationId: string, params?: Record<string, any>) {
|
||||
return createAxios<PaginatorData<IAgentMessage>>({
|
||||
url: `/ai/conversation/${conversationId}/messages`,
|
||||
method: 'get',
|
||||
params,
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/** Xin Table 公共接口 */
|
||||
import createAxios from '@/utils/request';
|
||||
import type { AxiosRequestConfig } from "axios";
|
||||
|
||||
type IListParams = {
|
||||
keyword?: string;
|
||||
current?: number;
|
||||
pageSize?: number;
|
||||
} & { [key: string]: unknown }
|
||||
|
||||
/**
|
||||
* 查询详情接口
|
||||
* @param url
|
||||
* @param id
|
||||
* @param options
|
||||
*/
|
||||
export function Get<T,>(
|
||||
url: string,
|
||||
id: number | string,
|
||||
options?: AxiosRequestConfig | undefined
|
||||
){
|
||||
return createAxios<T>({
|
||||
url: url + '/' + id,
|
||||
method: 'get',
|
||||
...(options || {}),
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 公共查询接口
|
||||
* @param url
|
||||
* @param params
|
||||
* @param options
|
||||
*/
|
||||
export function List<T,>(
|
||||
url: string,
|
||||
params?: IListParams,
|
||||
options?: AxiosRequestConfig | undefined
|
||||
){
|
||||
return createAxios<API.ListResponse<T>>({
|
||||
url: url,
|
||||
method: 'get',
|
||||
params,
|
||||
...(options || {}),
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 公共新增接口
|
||||
* @param url
|
||||
* @param data
|
||||
* @param options
|
||||
*/
|
||||
export function Create<T = API.ResponseStructure, Values = any>(
|
||||
url: string,
|
||||
data?: Values,
|
||||
options?: AxiosRequestConfig | undefined
|
||||
){
|
||||
return createAxios<T>({
|
||||
url: url,
|
||||
method: 'post',
|
||||
data,
|
||||
...(options || {}),
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 公共编辑接口
|
||||
* @param url
|
||||
* @param data
|
||||
* @param options
|
||||
*/
|
||||
export function Update<T = API.ResponseStructure, Values = any>(
|
||||
url: string,
|
||||
data?: Values,
|
||||
options?: AxiosRequestConfig | undefined
|
||||
){
|
||||
return createAxios<T>({
|
||||
url: url,
|
||||
method: 'put',
|
||||
data,
|
||||
...(options || {}),
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 公共删除接口
|
||||
* @param url
|
||||
* @param params
|
||||
* @param options
|
||||
*/
|
||||
export function Delete<T,>(
|
||||
url: string,
|
||||
params?: { [key: string]: unknown },
|
||||
options?: AxiosRequestConfig | undefined
|
||||
){
|
||||
return createAxios<T>({
|
||||
url: url,
|
||||
method: 'delete',
|
||||
params,
|
||||
...(options || {}),
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import createAxios from "@/utils/request";
|
||||
|
||||
interface WebInfo {
|
||||
title: string;
|
||||
subtitle: string;
|
||||
describe: string;
|
||||
logo: string;
|
||||
}
|
||||
|
||||
export const getWebInfo = () => {
|
||||
return createAxios<WebInfo>({
|
||||
url: "/index",
|
||||
method: "get",
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
import createAxios from '@/utils/request';
|
||||
import type {AiList} from "@/domain/iAi.ts";
|
||||
|
||||
|
||||
/** 获取 AI 列表 */
|
||||
export async function getAiList() {
|
||||
return createAxios<AiList>({
|
||||
url: '/system/ai/list',
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取 AI 配置 */
|
||||
export async function getAiConfig() {
|
||||
return createAxios({
|
||||
url: '/system/ai/config',
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
/** 保存 AI 配置 */
|
||||
export async function saveAiConfig(data: Record<string, any>) {
|
||||
return createAxios({
|
||||
url: '/system/ai/save',
|
||||
method: 'post',
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 测试 AI 供应商连接 */
|
||||
export async function testAiConnection(provider: string) {
|
||||
return createAxios({
|
||||
url: '/system/ai/test',
|
||||
method: 'post',
|
||||
timeout: 60000,
|
||||
data: { provider },
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import createAxios from "@/utils/request";
|
||||
import type {IDict} from "@/domain/iDict";
|
||||
import type {IDictItem} from "@/domain/iDictItem";
|
||||
|
||||
/**
|
||||
* 获取所有字典数据(带缓存)
|
||||
*/
|
||||
export function getAllDict() {
|
||||
return createAxios<(IDict & { dict_items: IDictItem[] })[]>({
|
||||
url: '/system/dict/list/all',
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
import createAxios from "@/utils/request";
|
||||
import type { ISysFileInfo } from "@/domain/iSysFile";
|
||||
|
||||
export type FileListParams = {
|
||||
group_id?: number;
|
||||
page?: number;
|
||||
pageSize?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件列表
|
||||
* @param params 查询参数
|
||||
*/
|
||||
export function getFileList(params: FileListParams) {
|
||||
return createAxios<API.ListResponse<ISysFileInfo>>({
|
||||
url: '/system/file/list',
|
||||
method: 'get',
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取回收站文件列表
|
||||
* @param params 查询参数
|
||||
*/
|
||||
export function getTrashedFileList(params: {page?: number; pageSize?: number}) {
|
||||
return createAxios<API.ListResponse<ISysFileInfo>>({
|
||||
url: '/system/file/list/trashed',
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
* @param file 文件
|
||||
* @param groupId 文件组ID
|
||||
* @param onProgress 上传进度回调
|
||||
*/
|
||||
export function uploadFile(file: File, groupId: number, onProgress?: (progress: number) => void) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
formData.append('group_id', groupId.toString());
|
||||
return createAxios({
|
||||
timeout: 0,
|
||||
url: '/system/file/list/upload',
|
||||
method: 'post',
|
||||
data: formData,
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
},
|
||||
onUploadProgress: (progressEvent) => {
|
||||
if (onProgress && progressEvent.total) {
|
||||
const progress = Math.round((progressEvent.loaded * 100) / progressEvent.total);
|
||||
onProgress(progress);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文件(软删除)
|
||||
* @param id 文件ID
|
||||
*/
|
||||
export function deleteFile(id: number) {
|
||||
return createAxios({
|
||||
url: `/system/file/list/${id}`,
|
||||
method: 'delete',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除文件(软删除)
|
||||
* @param ids 文件ID数组
|
||||
*/
|
||||
export function batchDeleteFiles(ids: number[]) {
|
||||
return createAxios<{count: number}>({
|
||||
url: '/system/file/list/batch/delete',
|
||||
method: 'delete',
|
||||
data: { ids },
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 彻底删除文件
|
||||
* @param id 文件ID
|
||||
*/
|
||||
export function forceDeleteFile(id: number) {
|
||||
return createAxios({
|
||||
url: `/system/file/list/force-delete/${id}`,
|
||||
method: 'delete',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量彻底删除文件
|
||||
* @param ids 文件ID数组
|
||||
*/
|
||||
export function batchForceDeleteFiles(ids: number[]) {
|
||||
return createAxios<{count: number}>({
|
||||
url: '/system/file/list/batch/force-delete',
|
||||
method: 'delete',
|
||||
data: { ids },
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 恢复文件
|
||||
* @param id
|
||||
* @returns
|
||||
*/
|
||||
export function restoreFile(id: number) {
|
||||
return createAxios({
|
||||
url: `/system/file/list/restore/${id}`,
|
||||
method: 'post',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量恢复文件
|
||||
* @param ids 文件 ID数组
|
||||
* @returns
|
||||
*/
|
||||
export function batchRestoreFiles(ids: number[]) {
|
||||
return createAxios<{count: number}>({
|
||||
url: '/system/file/list/batch/restore',
|
||||
method: 'post',
|
||||
data: { ids },
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制文件
|
||||
* @param ids
|
||||
* @param groupId
|
||||
* @returns
|
||||
*/
|
||||
export function copyFile(ids: number | number[], groupId?: number) {
|
||||
return createAxios<ISysFileInfo>({
|
||||
url: `/system/file/list/copy`,
|
||||
method: 'post',
|
||||
data: { group_id: groupId, ids },
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 移动文件
|
||||
* @param ids
|
||||
* @param groupId
|
||||
* @returns
|
||||
*/
|
||||
export function moveFile(ids: number | number[], groupId?: number) {
|
||||
return createAxios<ISysFileInfo>({
|
||||
url: `/system/file/list/move`,
|
||||
method: 'post',
|
||||
data: { group_id: groupId, ids },
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 重命名文件
|
||||
* @param id 文件ID
|
||||
* @param name 新文件名
|
||||
* @returns
|
||||
*/
|
||||
export function renameFile(id: number, name: string) {
|
||||
return createAxios({
|
||||
url: `/system/file/list/rename/${id}`,
|
||||
method: 'put',
|
||||
data: { name },
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空回收站文件
|
||||
* @returns
|
||||
*/
|
||||
export function cleanTrashed() {
|
||||
return createAxios<{ count: number }>({
|
||||
url: '/system/file/list/clean/trashed',
|
||||
method: 'delete',
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import type { ISysFileGroup } from "@/domain/iSysFileGroup";
|
||||
import createAxios from "@/utils/request";
|
||||
|
||||
// 文件夹相关API
|
||||
export function queryFileGroupList(params?: {keywordSearch: string}) {
|
||||
return createAxios<ISysFileGroup[]>({
|
||||
url: '/system/file/group',
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
export function createFileGroup(params: ISysFileGroup) {
|
||||
return createAxios({
|
||||
url: '/system/file/group',
|
||||
method: 'post',
|
||||
data: params,
|
||||
});
|
||||
}
|
||||
|
||||
export function updateFileGroup(params: ISysFileGroup) {
|
||||
return createAxios({
|
||||
url: `/system/file/group/${params.id}`,
|
||||
method: 'put',
|
||||
data: params,
|
||||
});
|
||||
}
|
||||
|
||||
export function deleteFileGroup(id: number) {
|
||||
return createAxios<boolean>({
|
||||
url: `/system/file/group/${id}`,
|
||||
method: 'delete',
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import createAxios from '@/utils/request';
|
||||
|
||||
/** 获取邮件配置 */
|
||||
export async function getMailConfig() {
|
||||
return createAxios({
|
||||
url: '/system/mail/config',
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
/** 保存邮件配置 */
|
||||
export async function saveMailConfig(data: Record<string, any>) {
|
||||
return createAxios({
|
||||
url: '/system/mail/save',
|
||||
method: 'post',
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 发送测试邮件 */
|
||||
export async function sendTestMail(to: string) {
|
||||
return createAxios({
|
||||
url: '/system/mail/test',
|
||||
method: 'post',
|
||||
data: { to },
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import createAxios from '@/utils/request';
|
||||
|
||||
/** 获取存储配置 */
|
||||
export async function getStorageConfig() {
|
||||
return createAxios({
|
||||
url: '/system/storage/config',
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
/** 保存存储配置 */
|
||||
export async function saveStorageConfig(data: Record<string, any>) {
|
||||
return createAxios({
|
||||
url: '/system/storage/save',
|
||||
method: 'post',
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 测试存储连接 */
|
||||
export async function testStorageConnection(disk: string) {
|
||||
return createAxios({
|
||||
url: '/system/storage/test',
|
||||
method: 'post',
|
||||
timeout: 60000,
|
||||
data: { disk },
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
import createAxios from '@/utils/request';
|
||||
import type { IConfigGroup } from '@/domain/iConfigGroup.ts';
|
||||
import type { IConfigItem } from '@/domain/iConfigItem.ts';
|
||||
|
||||
/** 获取设置组列表 */
|
||||
export async function getConfigGroupList() {
|
||||
return createAxios<IConfigGroup[]>({
|
||||
url: '/system/config/group',
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
/** 新增设置组 */
|
||||
export async function createConfigGroup(data: IConfigGroup) {
|
||||
return createAxios({
|
||||
url: '/system/config/group',
|
||||
method: 'post',
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 更新设置组 */
|
||||
export async function updateConfigGroup(id: number, data: IConfigGroup) {
|
||||
return createAxios({
|
||||
url: `/system/config/group/${id}`,
|
||||
method: 'put',
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除设置组 */
|
||||
export async function deleteConfigGroup(id: number) {
|
||||
return createAxios({
|
||||
url: `/system/config/group/${id}`,
|
||||
method: 'delete',
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取设置项列表 */
|
||||
export async function getConfigItemList(group_id?: number) {
|
||||
return createAxios<IConfigItem[]>({
|
||||
url: '/system/config/items',
|
||||
method: 'get',
|
||||
params: { group_id },
|
||||
});
|
||||
}
|
||||
|
||||
/** 新增设置项 */
|
||||
export async function createConfigItem(data: IConfigItem) {
|
||||
return createAxios<IConfigItem>({
|
||||
url: '/system/config/items',
|
||||
method: 'post',
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 更新设置项 */
|
||||
export async function updateConfigItem(id: number, data: IConfigItem) {
|
||||
return createAxios<IConfigItem>({
|
||||
url: `/system/config/items/${id}`,
|
||||
method: 'put',
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除设置项 */
|
||||
export async function deleteConfigItem(id: number) {
|
||||
return createAxios({
|
||||
url: `/system/config/items/${id}`,
|
||||
method: 'delete',
|
||||
});
|
||||
}
|
||||
|
||||
/** 批量保存设置项值 */
|
||||
export async function saveConfigItems(configs: { id: number; value: string }[]) {
|
||||
return createAxios({
|
||||
url: '/system/config/items/save',
|
||||
method: 'put',
|
||||
data: { configs },
|
||||
});
|
||||
}
|
||||
|
||||
/** 刷新设置缓存 */
|
||||
export async function refreshCache() {
|
||||
return createAxios({
|
||||
url: '/system/config/items/refreshCache',
|
||||
method: 'post'
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
import createAxios from '@/utils/request';
|
||||
import type {ISysDept} from "@/domain/iSysDept.ts";
|
||||
import React from "react";
|
||||
import type ISysUser from "@/domain/iSysUser.ts";
|
||||
|
||||
/** 获取部门列表 */
|
||||
export async function queryDept() {
|
||||
return createAxios<ISysDept[]>({
|
||||
url: '/system/dept',
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
/** 新增部门 */
|
||||
export async function createDept(data: ISysDept) {
|
||||
return createAxios<ISysDept[]>({
|
||||
url: '/system/dept',
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
/** 编辑部门信息 */
|
||||
export async function updateDept(id: number, data: ISysDept) {
|
||||
return createAxios<ISysDept[]>({
|
||||
url: '/system/dept/' + id,
|
||||
method: 'put',
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 批量删除部门 */
|
||||
export async function deleteDept(ids: React.Key[]) {
|
||||
return createAxios({
|
||||
url: '/system/dept',
|
||||
method: 'delete',
|
||||
data: { ids },
|
||||
});
|
||||
}
|
||||
|
||||
/** 批量删除部门 */
|
||||
export async function deptUsers(id: number, params: {
|
||||
page: number;
|
||||
pageSize: number;
|
||||
} = { page: 1, pageSize: 10 }) {
|
||||
return createAxios<API.ListResponse<ISysUser>>({
|
||||
url: '/system/dept/users/' + id,
|
||||
method: 'get',
|
||||
params: params
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
import createAxios from '@/utils/request';
|
||||
import type ISysUser from "@/domain/iSysUser.ts";
|
||||
|
||||
export interface RuleFieldsList {
|
||||
key: string;
|
||||
title: string;
|
||||
local: string;
|
||||
children: RuleFieldsList[];
|
||||
}
|
||||
|
||||
/** 获取角色用户列表 */
|
||||
export async function users(id: number, params: {
|
||||
page: number;
|
||||
pageSize: number;
|
||||
} = { page: 1, pageSize: 10 }) {
|
||||
return createAxios<API.ListResponse<ISysUser>>({
|
||||
url: '/system/role/users/' + id,
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
/** 设置启用状态 */
|
||||
export async function statusRole(id: number) {
|
||||
return createAxios({
|
||||
url: '/system/role/status/' + id,
|
||||
method: 'put',
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取权限选项 */
|
||||
export async function rulesList() {
|
||||
return createAxios<RuleFieldsList[]>({
|
||||
url: '/system/role/ruleList',
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
|
||||
/** 保存角色权限 */
|
||||
export async function setRule(role_id: number, rule_ids: number[]) {
|
||||
return createAxios({
|
||||
url: '/system/role/setRule',
|
||||
method: 'post',
|
||||
data: {
|
||||
role_id,
|
||||
rule_ids
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import createAxios from '@/utils/request';
|
||||
import type {ISysRule} from "@/domain/iSysRule.ts";
|
||||
|
||||
/** 获取权限列表 */
|
||||
export async function listRule() {
|
||||
return createAxios<ISysRule[]>({
|
||||
url: '/system/rule',
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
/** 设置显示状态 */
|
||||
export async function ruleParent() {
|
||||
return createAxios<ISysRule[]>({
|
||||
url: '/system/rule/parent',
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
/** 设置显示状态 */
|
||||
export async function showRule(id: number) {
|
||||
return createAxios({
|
||||
url: '/system/rule/show/' + id,
|
||||
method: 'put',
|
||||
});
|
||||
}
|
||||
|
||||
/** 设置启用状态 */
|
||||
export async function statusRule(id: number) {
|
||||
return createAxios({
|
||||
url: '/system/rule/status/' + id,
|
||||
method: 'put',
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
import createAxios from '@/utils/request';
|
||||
import type ISysUser from '@/domain/iSysUser.ts';
|
||||
import type {IMenus} from "@/domain/iSysRule.ts";
|
||||
import type ISysLoginRecord from "@/domain/iSysLoginRecord.ts";
|
||||
|
||||
export interface LoginParams {
|
||||
/** 用户名 */
|
||||
username?: string;
|
||||
/** 密码 */
|
||||
password?: string;
|
||||
/** 是否记住我 */
|
||||
remember?: boolean;
|
||||
}
|
||||
|
||||
export interface LoginResponse {
|
||||
/** token */
|
||||
token: string;
|
||||
}
|
||||
|
||||
export interface InfoResponse {
|
||||
/** 管理员信息 */
|
||||
info: ISysUser;
|
||||
/** 管理员权限 */
|
||||
access: string[];
|
||||
}
|
||||
|
||||
export interface MenuResponse {
|
||||
/** 管理员菜单 */
|
||||
menus: IMenus[];
|
||||
}
|
||||
|
||||
export interface InfoParams {
|
||||
/** 个人简介 */
|
||||
bio: string;
|
||||
/** 邮箱 */
|
||||
email: string;
|
||||
/** 手机号 */
|
||||
mobile: string;
|
||||
/** 昵称 */
|
||||
nickname: string;
|
||||
/** 性别 */
|
||||
sex: number;
|
||||
}
|
||||
|
||||
export interface PasswordParams {
|
||||
/** 新密码 */
|
||||
newPassword: string;
|
||||
/** 旧密码 */
|
||||
oldPassword: string;
|
||||
/** 重复新密码 */
|
||||
rePassword: string;
|
||||
}
|
||||
|
||||
export interface RoleFieldType {
|
||||
/** 角色ID */
|
||||
role_id: number;
|
||||
/** 角色名称 */
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface DeptFieldType {
|
||||
/** 部门ID */
|
||||
dept_id: number;
|
||||
/** 部门名称 */
|
||||
name: string;
|
||||
/** 下级部门 */
|
||||
children: DeptFieldType[];
|
||||
}
|
||||
|
||||
export interface ResetPasswordType {
|
||||
/** 用户ID */
|
||||
id: number;
|
||||
/** 密码 */
|
||||
password: string;
|
||||
/** 验证密码 */
|
||||
rePassword: string;
|
||||
}
|
||||
|
||||
/** 获取管理员角色选项栏数据 */
|
||||
export async function roleField() {
|
||||
return createAxios<RoleFieldType[]>({
|
||||
url: '/system/user/role',
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取管理员角色选项栏数据 */
|
||||
export async function deptField() {
|
||||
return createAxios<DeptFieldType[]>({
|
||||
url: '/system/user/dept',
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
/** 重置密码 */
|
||||
export async function resetPassword(data: ResetPasswordType) {
|
||||
return createAxios({
|
||||
url: '/system/resetPassword',
|
||||
method: 'put',
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/** 后台用户登录 */
|
||||
export async function login(data: LoginParams) {
|
||||
return createAxios<LoginResponse>({
|
||||
url: '/system/login',
|
||||
method: 'post',
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 后台用户退出登录 */
|
||||
export async function logout() {
|
||||
return createAxios({
|
||||
url: '/system/logout',
|
||||
method: 'post',
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取管理员用户信息 */
|
||||
export async function info() {
|
||||
return createAxios<InfoResponse>({
|
||||
url: '/system/info',
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取管理员用户信息 */
|
||||
export async function menu() {
|
||||
return createAxios<MenuResponse>({
|
||||
url: '/system/menu',
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
/** 更改管理员信息 */
|
||||
export async function updateInfo(info: InfoParams) {
|
||||
return createAxios({
|
||||
url: '/system/updateInfo',
|
||||
method: 'put',
|
||||
data: info,
|
||||
})
|
||||
}
|
||||
|
||||
/** 修改管理员密码 */
|
||||
export async function updatePassword(data: PasswordParams) {
|
||||
return createAxios({
|
||||
url: '/system/updatePassword',
|
||||
method: 'put',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
/** 修改管理员头像 */
|
||||
export async function updateAvatar() {
|
||||
return createAxios({
|
||||
url: '/system/uploadAvatar',
|
||||
method: 'post',
|
||||
})
|
||||
}
|
||||
|
||||
/** 获取管理员登录日志 */
|
||||
export async function loginRecord() {
|
||||
return createAxios<ISysLoginRecord[]>({
|
||||
url: '/system/loginRecord',
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user