mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-23 05:10:57 +00:00
feat: 新增隐私政策页面并优化设置模块
refactor: 重构用户信息存储和主题管理逻辑 fix: 修正登录类型字段缺失问题 style: 统一页面导航栏样式和布局 docs: 更新README和文档内容 chore: 清理无用代码和资源文件 perf: 优化网络请求和错误处理逻辑 test: 更新API测试用例 build: 更新依赖版本和构建配置 ci: 调整CI/CD脚本配置
This commit is contained in:
@@ -46,4 +46,5 @@ export interface OnlineUserTable {
|
||||
os: string;
|
||||
browser: string;
|
||||
login_time: string;
|
||||
login_type: string;
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ export interface LoginFormData {
|
||||
captcha_key: string;
|
||||
captcha: string;
|
||||
remember: boolean;
|
||||
login_type: string;
|
||||
}
|
||||
|
||||
// 刷新令牌
|
||||
|
||||
@@ -16,8 +16,13 @@ export const enum ResultEnum {
|
||||
EXCEPTION = -1,
|
||||
|
||||
/**
|
||||
* 访问令牌无效或过期
|
||||
* 未授权访问
|
||||
*/
|
||||
ACCESS_TOKEN_INVALID = 401,
|
||||
UNAUTHORIZED = 10403,
|
||||
|
||||
/**
|
||||
* 令牌已过期
|
||||
*/
|
||||
TOKEN_EXPIRED = 10401,
|
||||
|
||||
}
|
||||
|
||||
@@ -85,12 +85,15 @@ httpRequest.interceptors.response.use((response: AxiosResponse<ApiResponse>) =>
|
||||
}
|
||||
}
|
||||
|
||||
if (data?.status_code === ResultEnum.ACCESS_TOKEN_INVALID) {
|
||||
if (data?.status_code === ResultEnum.TOKEN_EXPIRED) {
|
||||
await redirectToLogin("登录已过期,请重新登录");
|
||||
return Promise.reject(new Error(data.msg));
|
||||
} else if (data?.code === ResultEnum.ERROR) {
|
||||
ElMessage.error(data.msg || "请求错误");
|
||||
return Promise.reject(new Error(data.msg || "请求错误"));
|
||||
} else if (data?.code === ResultEnum.UNAUTHORIZED) {
|
||||
ElMessage.error(data.msg || "暂无权限");
|
||||
return Promise.reject(new Error(data.msg || "请求错误"));
|
||||
} else if (data?.code === ResultEnum.EXCEPTION) {
|
||||
ElMessage.error(data.msg || "服务异常");
|
||||
return Promise.reject(new Error(data.msg || "服务异常"));
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'selection')?.show" type="selection" min-width="55" align="center" />
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'index')?.show" type="index" fixed label="序号" min-width="60" />
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'session_id')?.show" key="session_id" label="会话编号" prop="session_id" min-width="250" show-overflow-tooltip/>
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'login_type')?.show" key="login_type" label="登录类型" prop="login_type" min-width="100" />
|
||||
<el-table-column v-if="tableColumns.find(col => col.prop === 'ipaddr')?.show" key="ipaddr" label="IP地址" prop="ipaddr" min-width="150" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<el-text>{{ scope.row.ipaddr }}</el-text>
|
||||
@@ -103,7 +104,7 @@ defineOptions({
|
||||
});
|
||||
|
||||
import OnlineAPI, { type OnlineUserPageQuery, type OnlineUserTable } from "@/api/monitor/online";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { ElMessageBox } from "element-plus";
|
||||
|
||||
const queryFormRef = ref();
|
||||
const total = ref(0);
|
||||
@@ -119,6 +120,7 @@ const tableColumns = ref([
|
||||
{ label: '选择框', prop: 'selection', show: true },
|
||||
{ label: '序号', prop: 'index', show: true },
|
||||
{ label: '会话编号', prop: 'session_id', show: true },
|
||||
{ label: '登录类型', prop: 'login_type', show: true },
|
||||
{ label: '登录名称', prop: 'name', show: true },
|
||||
{ label: '用户账号', prop: 'user_name', show: true },
|
||||
{ label: '主机', prop: 'ipaddr', show: true },
|
||||
|
||||
@@ -145,7 +145,8 @@ const loginForm = reactive<LoginFormData>({
|
||||
password: "",
|
||||
captcha: "",
|
||||
captcha_key: "",
|
||||
remember: true
|
||||
remember: true,
|
||||
login_type: "PC端",
|
||||
});
|
||||
|
||||
const captchaState = reactive<CaptchaInfo>({
|
||||
|
||||
Reference in New Issue
Block a user