diff --git a/src/api/system/dict/index.ts b/src/api/system/dict/index.ts index 481fce53..9e8a7cfc 100644 --- a/src/api/system/dict/index.ts +++ b/src/api/system/dict/index.ts @@ -8,7 +8,6 @@ import type { DictItemForm, DictItemOption, } from "./types"; -import type { OptionItem } from "@/api/common"; const DICT_BASE_URL = "/api/v1/dicts"; diff --git a/src/api/system/dict/types.ts b/src/api/system/dict/types.ts index ae0465fc..6f400164 100644 --- a/src/api/system/dict/types.ts +++ b/src/api/system/dict/types.ts @@ -61,6 +61,8 @@ export interface DictItem { status: number; /** 排序 */ sort?: number; + /** 标签类型(后端返回的原始码) */ + tagType?: unknown; } /** 字典项表单对象 */ diff --git a/src/types/api/index.ts b/src/types/api/index.ts new file mode 100644 index 00000000..139e9247 --- /dev/null +++ b/src/types/api/index.ts @@ -0,0 +1,41 @@ +export interface PageQueryParams { + pageNum: number; + pageSize: number; + [key: string]: any; +} + +export interface OptionItem { + label: string; + value: string | number; + meta?: any; + children?: OptionItem[]; +} + +export interface ExcelResult { + /** 状态码 */ + code: number; + /** 无效数据条数 */ + invalidCount: number; + /** 有效数据条数 */ + validCount: number; + /** 错误信息 */ + messageList: Array; +} + +export interface PageResult { + total: number; + list: T[]; + params: PageQueryParams; +} + +export interface ApiResponse { + code: number | string; + msg: string; + data: T; +} + +export interface BaseEntity { + id: number; + createTime: string; + updateTime: string; +} diff --git a/src/utils/request.ts b/src/utils/request.ts index 7a37eb09..46ab484d 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -34,7 +34,7 @@ http.interceptors.request.use( // 响应拦截器 http.interceptors.response.use( - (response: AxiosResponse) => { + (response: AxiosResponse): any => { const { responseType } = response.config; // 二进制数据直接返回 @@ -64,8 +64,8 @@ http.interceptors.response.use( // Token 过期:尝试刷新 token 后自动重试一次 if (code === ApiCodeEnum.ACCESS_TOKEN_INVALID) { - // 已重试过,直接跳登录 - if (retriedConfigs.has(config)) { + // config 不存在时无法重试,直接跳登录 + if (!config || retriedConfigs.has(config)) { await redirectToLogin("登录已过期,请重新登录"); return Promise.reject(new Error("Token Invalid")); } diff --git a/src/views/system/config/index.vue b/src/views/system/config/index.vue index e9141a95..e945660c 100644 --- a/src/views/system/config/index.vue +++ b/src/views/system/config/index.vue @@ -1,10 +1,10 @@