init
This commit is contained in:
Vendored
+98
@@ -0,0 +1,98 @@
|
||||
import type { AxiosRequestConfig } from 'axios';
|
||||
|
||||
/**
|
||||
* Axios请求配置
|
||||
*/
|
||||
export interface RequestOptions {
|
||||
/**
|
||||
* 接口地址
|
||||
*
|
||||
* 例: http://www.baidu.com/api
|
||||
*/
|
||||
apiUrl?: string;
|
||||
/**
|
||||
* 是否自动添加接口前缀
|
||||
*
|
||||
* 例: http://www.baidu.com/api
|
||||
* urlPrefix: 'api'
|
||||
*/
|
||||
isJoinPrefix?: boolean;
|
||||
/**
|
||||
* 接口前缀
|
||||
*/
|
||||
urlPrefix?: string;
|
||||
/**
|
||||
* POST请求的时候添加参数到Url中
|
||||
*/
|
||||
joinParamsToUrl?: boolean;
|
||||
/**
|
||||
* 格式化提交参数时间
|
||||
*/
|
||||
formatDate?: boolean;
|
||||
/**
|
||||
* 是否需要对响应数据进行处理
|
||||
*/
|
||||
isTransformResponse?: boolean;
|
||||
/**
|
||||
* 是否返回原生响应头
|
||||
*
|
||||
* 例: 需要获取响应头时使用该属性
|
||||
*/
|
||||
isReturnNativeResponse?: boolean;
|
||||
/**
|
||||
* 是否忽略请求取消令牌
|
||||
*
|
||||
* 如果启用,则重复请求时不进行处理
|
||||
*
|
||||
* 如果禁用,则重复请求时会取消当前请求
|
||||
*/
|
||||
ignoreCancelToken?: boolean;
|
||||
/**
|
||||
* 自动对请求添加时间戳参数
|
||||
*/
|
||||
joinTime?: boolean;
|
||||
/**
|
||||
* 是否携带Token
|
||||
*/
|
||||
withToken?: boolean;
|
||||
/**
|
||||
* 重试配置
|
||||
*/
|
||||
retry?: {
|
||||
/**
|
||||
* 重试次数
|
||||
*/
|
||||
count: number;
|
||||
/**
|
||||
* 隔多久重试
|
||||
*
|
||||
* 单位: 毫秒
|
||||
*/
|
||||
delay: number;
|
||||
};
|
||||
/**
|
||||
* 接口级节流
|
||||
*
|
||||
* 单位: 毫秒
|
||||
*/
|
||||
throttle?: {
|
||||
delay: number;
|
||||
};
|
||||
/**
|
||||
* 接口级防抖
|
||||
*
|
||||
* 单位: 毫秒
|
||||
*/
|
||||
debounce?: {
|
||||
delay: number;
|
||||
};
|
||||
}
|
||||
|
||||
export interface Result<T = any> {
|
||||
code: number;
|
||||
data: T;
|
||||
}
|
||||
|
||||
export interface AxiosRequestConfigRetry extends AxiosRequestConfig {
|
||||
retryCount?: number;
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
interface ImportMetaEnv {
|
||||
readonly VITE_IS_REQUEST_PROXY: string;
|
||||
readonly VITE_API_URL: string;
|
||||
readonly VITE_API_URL_PREFIX: string;
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
readonly env: ImportMetaEnv;
|
||||
}
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// 通用声明
|
||||
|
||||
// Vue
|
||||
declare module '*.vue' {
|
||||
import type { DefineComponent } from 'vue';
|
||||
|
||||
const component: DefineComponent<object, object, any>;
|
||||
export default component;
|
||||
}
|
||||
|
||||
declare type ClassName = { [className: string]: any } | ClassName[] | string;
|
||||
|
||||
declare module '*.svg' {
|
||||
const CONTENT: string;
|
||||
export default CONTENT;
|
||||
}
|
||||
|
||||
declare type Recordable<T = any> = Record<string, T>;
|
||||
Vendored
+57
@@ -0,0 +1,57 @@
|
||||
import type { TabValue } from 'tdesign-vue-next';
|
||||
import type { Component, DefineComponent, FunctionalComponent } from 'vue';
|
||||
import type { LocationQueryRaw, RouteMeta, RouteRecordName } from 'vue-router';
|
||||
|
||||
import type { LocalizedTitle } from '@/locales';
|
||||
|
||||
export interface MenuRoute {
|
||||
// TODO: menuitem 组件实际支持 string 类型但是类型错误,暂时使用 any 类型避免打包错误待组件类型修复
|
||||
path: any;
|
||||
/** 多语言标题对象,如 { zh_CN: '仪表盘', en_US: 'Dashboard' } */
|
||||
title?: LocalizedTitle;
|
||||
name?: string;
|
||||
icon?: string | Component | FunctionalComponent | DefineComponent;
|
||||
redirect?: string;
|
||||
children: MenuRoute[];
|
||||
meta: RouteMeta;
|
||||
}
|
||||
|
||||
export type ModeType = 'dark' | 'light';
|
||||
|
||||
export interface UserInfo {
|
||||
name: string;
|
||||
roles: string[];
|
||||
}
|
||||
|
||||
export interface NotificationItem {
|
||||
id: string;
|
||||
content: string;
|
||||
type: string;
|
||||
status: boolean;
|
||||
collected: boolean;
|
||||
date: string;
|
||||
quality: string;
|
||||
}
|
||||
|
||||
export interface TRouterInfo {
|
||||
path: string;
|
||||
query?: LocationQueryRaw;
|
||||
routeIdx?: number;
|
||||
/** 多语言标题对象,如 { zh_CN: '仪表盘', en_US: 'Dashboard' } */
|
||||
title?: LocalizedTitle;
|
||||
name?: RouteRecordName;
|
||||
isAlive?: boolean;
|
||||
isHome?: boolean;
|
||||
meta?: any;
|
||||
}
|
||||
|
||||
export interface TTabRouterType {
|
||||
isRefreshing: boolean;
|
||||
tabRouterList: Array<TRouterInfo>;
|
||||
}
|
||||
|
||||
export interface TTabRemoveOptions {
|
||||
value: TabValue;
|
||||
index: number;
|
||||
e: MouseEvent;
|
||||
}
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
import 'vue-router';
|
||||
|
||||
import type { Component, DefineComponent, FunctionalComponent } from 'vue';
|
||||
|
||||
import type { LocalizedTitle } from '@/locales';
|
||||
|
||||
export {};
|
||||
declare module 'vue-router' {
|
||||
interface RouteMeta {
|
||||
title?: LocalizedTitle;
|
||||
icon?: string | Component | FunctionalComponent | DefineComponent;
|
||||
expanded?: boolean;
|
||||
orderNo?: number;
|
||||
hidden?: boolean;
|
||||
hiddenBreadcrumb?: boolean;
|
||||
single?: boolean;
|
||||
keepAlive?: boolean;
|
||||
frameSrc?: string;
|
||||
frameBlank?: boolean;
|
||||
// roleCode?: string; // 前端 roles 控制菜单权限
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user