fix: 适配上游 PageQuery 与登录跳转签名并修复弹窗配置类型报错
This commit is contained in:
1 parent
0293f804a9
commit
8c1e02e6d0
8 files changed
+17
-17
No files matched your search
@@ -1,7 +1,7 @@
|
|||||||
import type { BaseQueryParams } from "@/api/common";
|
import type { PageQuery } from "@/api/common";
|
||||||
|
|
||||||
/** 应用图标分页查询参数 */
|
/** 应用图标分页查询参数 */
|
||||||
export interface AppIconQuery extends BaseQueryParams {
|
export interface AppIconQuery extends PageQuery {
|
||||||
/** 应用包名(可选,不传则返回全部) */
|
/** 应用包名(可选,不传则返回全部) */
|
||||||
packageName?: string;
|
packageName?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
* Developer 设备开发者选项类型定义
|
* Developer 设备开发者选项类型定义
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { BaseQueryParams } from "@/api/common";
|
import type { PageQuery } from "@/api/common";
|
||||||
|
|
||||||
/** 开发者选项分页查询参数 */
|
/** 开发者选项分页查询参数 */
|
||||||
export interface DeveloperQueryParams extends BaseQueryParams {
|
export interface DeveloperQueryParams extends PageQuery {
|
||||||
/** 搜索关键字(设备序列号) */
|
/** 搜索关键字(设备序列号) */
|
||||||
keywords?: string;
|
keywords?: string;
|
||||||
/** 开发者选项开关(0关闭,1开启) */
|
/** 开发者选项开关(0关闭,1开启) */
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* Device 用户类型定义
|
* Device 用户类型定义
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { BaseQueryParams } from "@/api/common";
|
import type { PageQuery } from "@/api/common";
|
||||||
|
|
||||||
/** 登录用户信息 */
|
/** 登录用户信息 */
|
||||||
export interface DeviceInfo {
|
export interface DeviceInfo {
|
||||||
@@ -23,7 +23,7 @@ export interface DeviceInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 用户分页查询参数 */
|
/** 用户分页查询参数 */
|
||||||
export interface DeviceQueryParams extends BaseQueryParams {
|
export interface DeviceQueryParams extends PageQuery {
|
||||||
/** 搜索关键字 */
|
/** 搜索关键字 */
|
||||||
keywords?: string;
|
keywords?: string;
|
||||||
/** 用户状态 */
|
/** 用户状态 */
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ function usePage() {
|
|||||||
// 编辑
|
// 编辑
|
||||||
async function handleEditClick(
|
async function handleEditClick(
|
||||||
row: IObject,
|
row: IObject,
|
||||||
callback?: (result?: IObject) => IObject,
|
callback?: (result?: IObject) => IObject | Promise<IObject>,
|
||||||
RefImpl?: Ref<PageModalInstance>
|
RefImpl?: Ref<PageModalInstance>,
|
||||||
) {
|
) {
|
||||||
if (RefImpl) {
|
if (RefImpl) {
|
||||||
RefImpl.value?.setModalVisible();
|
RefImpl.value?.setModalVisible();
|
||||||
@@ -48,8 +48,8 @@ function usePage() {
|
|||||||
// 查看
|
// 查看
|
||||||
async function handleViewClick(
|
async function handleViewClick(
|
||||||
row: IObject,
|
row: IObject,
|
||||||
callback?: (result?: IObject) => IObject,
|
callback?: (result?: IObject) => IObject | Promise<IObject>,
|
||||||
RefImpl?: Ref<PageModalInstance>
|
RefImpl?: Ref<PageModalInstance>,
|
||||||
) {
|
) {
|
||||||
if (RefImpl) {
|
if (RefImpl) {
|
||||||
RefImpl.value?.setModalVisible();
|
RefImpl.value?.setModalVisible();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import axios, { type AxiosResponse } from "axios";
|
import axios, { type AxiosResponse, type InternalAxiosRequestConfig } from "axios";
|
||||||
import qs from "qs";
|
import qs from "qs";
|
||||||
|
|
||||||
import { ApiCodeEnum } from "@/enums/api";
|
import { ApiCodeEnum } from "@/enums/api";
|
||||||
@@ -91,7 +91,7 @@ function setupInterceptors(instance: typeof http) {
|
|||||||
// Token 过期
|
// Token 过期
|
||||||
if (code === ApiCodeEnum.ACCESS_TOKEN_INVALID) {
|
if (code === ApiCodeEnum.ACCESS_TOKEN_INVALID) {
|
||||||
if (!config || retriedRequests.has(config)) {
|
if (!config || retriedRequests.has(config)) {
|
||||||
await useUserStoreHook().redirectToLogin("expired");
|
await useUserStoreHook().redirectToLogin();
|
||||||
return Promise.reject(new Error("Token Invalid"));
|
return Promise.reject(new Error("Token Invalid"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,14 +108,14 @@ function setupInterceptors(instance: typeof http) {
|
|||||||
|
|
||||||
return instance(config);
|
return instance(config);
|
||||||
} catch {
|
} catch {
|
||||||
await useUserStoreHook().redirectToLogin("expired");
|
await useUserStoreHook().redirectToLogin();
|
||||||
return Promise.reject(new Error("Token Invalid"));
|
return Promise.reject(new Error("Token Invalid"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Refresh token 失效
|
// Refresh token 失效
|
||||||
if (code === ApiCodeEnum.REFRESH_TOKEN_INVALID) {
|
if (code === ApiCodeEnum.REFRESH_TOKEN_INVALID) {
|
||||||
await useUserStoreHook().redirectToLogin("expired");
|
await useUserStoreHook().redirectToLogin();
|
||||||
return Promise.reject(new Error("Token Invalid"));
|
return Promise.reject(new Error("Token Invalid"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -264,7 +264,7 @@ function createSseConnection(options: UseSseOptions = {}) {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
logError("SSE 令牌刷新失败:", err);
|
logError("SSE 令牌刷新失败:", err);
|
||||||
// 续期失败即会话失效,走统一出口弹窗提示后跳登录页
|
// 续期失败即会话失效,走统一出口弹窗提示后跳登录页
|
||||||
await userStore.redirectToLogin("expired");
|
await userStore.redirectToLogin();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
isManualDisconnect = true;
|
isManualDisconnect = true;
|
||||||
|
|||||||
@@ -126,4 +126,4 @@ const modalConfig: IModalConfig<DeviceForm> = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 如果有异步数据会修改配置的,推荐用reactive包裹,而纯静态配置的可以直接导出
|
// 如果有异步数据会修改配置的,推荐用reactive包裹,而纯静态配置的可以直接导出
|
||||||
export default reactive(modalConfig);
|
export default reactive(modalConfig) as IModalConfig<DeviceForm>;
|
||||||
@@ -60,4 +60,4 @@ const modalConfig: IModalConfig<DeviceForm> = {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
export default reactive(modalConfig);
|
export default reactive(modalConfig) as IModalConfig<DeviceForm>;
|
||||||
Reference in new issue
Block a user