feat: 重构前端项目结构并优化代码

refactor: 迁移前端资源文件至web目录
feat: 新增多种图标资源
style: 统一代码风格和格式化配置
docs: 更新README和文档说明
chore: 更新依赖和配置文件
fix: 修复部分类型定义和枚举
perf: 优化路由和组件加载逻辑
This commit is contained in:
zhangtao
2026-05-01 01:01:17 +08:00
parent 1355a09441
commit 80263e98e1
887 changed files with 116349 additions and 33825 deletions
@@ -0,0 +1,126 @@
import request from '@/utils/http';
const API_PATH = '/monitor/cache';
const CacheAPI = {
/**
* 获取缓存信息
* @returns 缓存信息
*/
getCacheInfo() {
return request({
url: `${API_PATH}/info`,
method: 'get',
});
},
/**
* 获取所有缓存名称
* @returns 所有缓存名称
*/
getCacheNames() {
return request({
url: `${API_PATH}/get/names`,
method: 'get',
});
},
/**
* 获取指定缓存名称下的所有键
* @param cacheName 缓存名称
* @returns 所有键
*/
getCacheKeys(cacheName: string) {
return request({
url: `${API_PATH}/get/keys/${cacheName}`,
method: 'get',
});
},
/**
* 获取指定缓存名称下的指定键的值
* @param cacheName 缓存名称
* @param cacheKey 键
* @returns 值
*/
getCacheValue(cacheName: string, cacheKey: string) {
return request({
url: `${API_PATH}/get/value/${cacheName}/${cacheKey}`,
method: 'get',
});
},
/**
* 删除指定缓存名称
* @param cacheName 缓存名称
*/
deleteCacheName(cacheName: string) {
return request({
url: `${API_PATH}/delete/name/${cacheName}`,
method: 'delete',
});
},
/**
* 删除指定缓存名称下的指定键
* @param cacheName 缓存名称
* @param cacheKey 键
*/
deleteCacheKey(cacheKey: string) {
return request({
url: `${API_PATH}/delete/key/${cacheKey}`,
method: 'delete',
});
},
/**
* 删除所有缓存
*/
deleteCacheAll() {
return request({
url: `${API_PATH}/delete/all`,
method: 'delete',
});
},
};
export default CacheAPI;
export interface CacheForm {
cache_name: string;
cache_key: string;
cache_value: string;
}
export interface CacheInfo {
cache_key: string;
cache_name: string;
cache_value: string;
remark: string;
}
export interface CommandStats {
name: string;
value: string;
}
export interface RedisInfo {
redis_version: string;
redis_mode: string;
tcp_port: number;
connected_clients: number;
uptime_in_days: number;
used_memory_human: string;
used_cpu_user_children: string;
maxmemory_human: string;
aof_enabled: string;
rdb_last_bgsave_status: string;
instantaneous_input_kbps: number;
instantaneous_output_kbps: number;
}
export interface CacheMonitor {
command_stats: CommandStats[];
db_size: number;
info: RedisInfo;
}
@@ -0,0 +1,60 @@
import request from '@/utils/http';
const API_PATH = '/monitor/online';
const OnlineAPI = {
/**
* 查询所有在线用户列表
* @returns 所有在线用户列表
*/
listOnline(query: OnlineUserPageQuery) {
return request<PageResult<OnlineUserTable[]>>({
url: `${API_PATH}/list`,
method: 'get',
params: query,
});
},
/**
* 强退用户
* @param body 用户会话ID列表
*/
deleteOnline(body: string) {
return request({
url: `${API_PATH}/delete`,
method: 'delete',
data: body,
});
},
/**
* 强退所有在线用户
*/
clearOnline() {
return request({
url: `${API_PATH}/clear`,
method: 'delete',
});
},
};
export default OnlineAPI;
export interface OnlineUserPageQuery extends PageQuery {
ipaddr?: string;
name?: string;
login_location?: string;
}
export interface OnlineUserTable {
session_id: string;
user_id: number;
name: string;
user_name: string;
ipaddr: string;
login_location: string;
os: string;
browser: string;
login_time: string;
login_type: string;
}
@@ -0,0 +1,248 @@
import request from '@/utils/http';
const API_PATH = '/monitor/resource';
export const ResourceAPI = {
/**
* 获取目录列表
* @param query 查询参数
*/
listResource(query: ResourcePageQuery) {
return request<PageResult<ResourceItem[]>>({
url: `${API_PATH}/list`,
method: 'get',
params: query,
});
},
/**
* 上传文件
* @param formData 文件数据
*/
uploadFile(formData: FormData) {
return request<ApiResponse<ResourceUploadSchema>>({
url: `${API_PATH}/upload`,
method: 'post',
data: formData,
headers: { 'Content-Type': 'multipart/form-data' },
});
},
/**
* 下载文件
* @param path 文件路径
*/
downloadFile(path: string) {
return request<ApiResponse<Blob>>({
url: `${API_PATH}/download`,
method: 'get',
params: { path },
responseType: 'blob',
});
},
/**
* 删除文件或目录
* @param body 文件路径数组
*/
deleteResource(body: string[]) {
return request({
url: `${API_PATH}/delete`,
method: 'delete',
data: body,
});
},
/**
* 移动文件或目录
* @param body 移动参数
*/
moveResource(body: ResourceMoveQuery) {
return request({
url: `${API_PATH}/move`,
method: 'post',
data: body,
});
},
/**
* 复制文件或目录
* @param body 复制参数
*/
copyResource(body: ResourceCopyQuery) {
return request({
url: `${API_PATH}/copy`,
method: 'post',
data: body,
});
},
/**
* 重命名文件或目录
* @param body 重命名参数
*/
renameResource(body: ResourceRenameQuery) {
return request({
url: `${API_PATH}/rename`,
method: 'post',
data: body,
});
},
/**
* 创建目录
* @param body 创建目录参数
*/
createDirectory(body: ResourceCreateDirQuery) {
return request({
url: `${API_PATH}/create-dir`,
method: 'post',
data: body,
});
},
/**
* 导出资源列表
* @param body 导出条件
*/
exportResource(body: ResourcePageQuery) {
return request<ApiResponse<Blob>>({
url: `${API_PATH}/export`,
method: 'post',
data: body,
responseType: 'blob',
});
},
};
export default ResourceAPI;
/**
* 资源列表查询参数
*/
export interface ResourceListQuery {
/** 目录路径 */
path?: string;
/** 包含隐藏文件 */
include_hidden?: boolean;
}
/**
* 资源目录模型
*/
export interface ResourceDirectorySchema {
/** 目录路径 */
path: string;
/** 目录名称 */
name: string;
/** 目录项 */
items: ResourceItem[];
/** 文件总数 */
total_files: number;
/** 目录总数 */
total_dirs: number;
/** 总大小 */
total_size: number;
}
/**
* 资源搜索查询参数
*/
export interface ResourceSearchQuery {
/** 关键词 */
name?: string;
}
/**
* 资源分页查询参数
*/
export interface ResourcePageQuery extends PageQuery {
/** 关键词 */
name?: string;
/** 目录路径 */
path?: string;
/** 包含隐藏文件 */
include_hidden?: boolean;
}
/**
* 资源上传响应模型
*/
export interface ResourceUploadSchema {
/** 文件名 */
filename: string;
/** 访问URL */
file_url: string;
/** 文件大小 */
file_size: number;
/** 上传时间 */
upload_time: string;
}
/**
* 资源项信息
*/
export interface ResourceItem {
/** 文件/目录名称 */
name: string;
/** 文件URL路径 */
file_url: string;
/** 相对路径 */
relative_path?: string;
/** 是否为文件 */
is_file?: boolean;
/** 是否为目录 */
is_dir?: boolean;
/** 文件大小(字节) */
size?: number | null;
/** 创建时间 */
created_time: string;
/** 修改时间 */
modified_time: string;
/** 是否为隐藏文件 */
is_hidden?: boolean;
}
/**
* 资源移动参数
*/
export interface ResourceMoveQuery {
/** 源路径 */
source_path: string;
/** 目标路径 */
target_path: string;
/** 是否覆盖 */
overwrite?: boolean;
}
/**
* 资源复制参数
*/
export interface ResourceCopyQuery {
/** 源路径 */
source_path: string;
/** 目标路径 */
target_path: string;
/** 是否覆盖 */
overwrite?: boolean;
}
/**
* 资源重命名参数
*/
export interface ResourceRenameQuery {
/** 原路径 */
old_path: string;
/** 新名称 */
new_name: string;
}
/**
* 创建目录参数
*/
export interface ResourceCreateDirQuery {
/** 父目录路径 */
parent_path: string;
/** 目录名称 */
dir_name: string;
}
@@ -0,0 +1,70 @@
import request from '@/utils/http';
const API_PATH = '/monitor/server';
const ServerAPI = {
/**
* 获取当前服务信息
* @returns 服务信息
*/
getServer() {
return request({
url: `${API_PATH}/info`,
method: 'get',
});
},
};
export default ServerAPI;
export interface Cpu {
cpu_num: number;
used: number;
sys: number;
free: number;
}
export interface Memory {
total: string;
used: string;
free: string;
usage: number;
}
export interface System {
computer_name: string;
os_name: string;
computer_ip: string;
os_arch: string;
user_dir: string;
}
export interface Python {
name: string;
version: string;
start_time: string;
run_time: string;
home: string;
memory_total: string;
memory_used: string;
memory_free: string;
memory_usage: number;
}
export interface SysFile {
dirName: string;
sysTypeName: string;
typeName: string;
total: string;
free: string;
used: string;
usage: number;
}
export interface ServerInfo {
cpu: Cpu;
mem: Memory;
sys: System;
py: Python;
disks: SysFile[];
}