init
This commit is contained in:
13
src/types/axios.d.ts
vendored
Normal file
13
src/types/axios.d.ts
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
/* eslint-disable */
|
||||
import * as axios from 'axios';
|
||||
|
||||
// 扩展 axios 数据返回类型,可自行扩展
|
||||
declare module 'axios' {
|
||||
export interface AxiosResponse<T = any> {
|
||||
code: number;
|
||||
data: T;
|
||||
message: string;
|
||||
type?: string;
|
||||
[key: string]: T;
|
||||
}
|
||||
}
|
||||
13
src/types/func.d.ts
vendored
Normal file
13
src/types/func.d.ts
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
// 定义全局属性的类型
|
||||
import { ComponentCustomProperties } from 'vue';
|
||||
|
||||
declare module '@vue/runtime-core' {
|
||||
interface ComponentCustomProperties {
|
||||
parseTime: Function;
|
||||
parseDate: Function;
|
||||
dateTimeStr: string;
|
||||
dateStr: string;
|
||||
timeStr: string;
|
||||
baseURL: string;
|
||||
}
|
||||
}
|
||||
109
src/types/global.d.ts
vendored
Normal file
109
src/types/global.d.ts
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
// 申明外部 npm 插件模块
|
||||
declare module 'splitpanes';
|
||||
declare module 'js-cookie';
|
||||
declare module '@wangeditor/editor-for-vue';
|
||||
declare module 'qs';
|
||||
declare module 'vue-json-viewer';
|
||||
|
||||
// 声明一个模块,防止引入文件时报错
|
||||
declare module '*.json';
|
||||
declare module '*.png';
|
||||
declare module '*.jpg';
|
||||
declare module '*.scss';
|
||||
declare module '*.ts';
|
||||
declare module '*.js';
|
||||
|
||||
// 声明文件,*.vue 后缀的文件交给 vue 模块来处理
|
||||
declare module '*.vue' {
|
||||
import type { DefineComponent } from 'vue';
|
||||
const component: DefineComponent<{}, {}, any>;
|
||||
export default component;
|
||||
}
|
||||
|
||||
// 声明文件,定义全局变量
|
||||
/* eslint-disable */
|
||||
declare interface Window {
|
||||
nextLoading: boolean;
|
||||
}
|
||||
|
||||
// 声明路由当前项类型
|
||||
declare type RouteItem<T = any> = {
|
||||
path: string;
|
||||
name?: string | symbol | undefined | null;
|
||||
redirect?: string;
|
||||
k?: T;
|
||||
meta?: {
|
||||
title?: string;
|
||||
isLink?: string;
|
||||
isHide?: boolean;
|
||||
isKeepAlive?: boolean;
|
||||
isAffix?: boolean;
|
||||
isIframe?: boolean;
|
||||
roles?: string[];
|
||||
icon?: string;
|
||||
isDynamic?: boolean;
|
||||
isDynamicPath?: string;
|
||||
isIframeOpen?: string;
|
||||
loading?: boolean;
|
||||
};
|
||||
children: T[];
|
||||
query?: { [key: string]: T };
|
||||
params?: { [key: string]: T };
|
||||
contextMenuClickId?: string | number;
|
||||
commonUrl?: string;
|
||||
isFnClick?: boolean;
|
||||
url?: string;
|
||||
transUrl?: string;
|
||||
title?: string;
|
||||
id?: string | number;
|
||||
};
|
||||
|
||||
// 声明路由 to from
|
||||
declare interface RouteToFrom<T = any> extends RouteItem {
|
||||
path?: string;
|
||||
children?: T[];
|
||||
}
|
||||
|
||||
// 声明路由当前项类型集合
|
||||
declare type RouteItems<T extends RouteItem = any> = T[];
|
||||
|
||||
// 声明 ref
|
||||
declare type RefType<T = any> = T | null;
|
||||
|
||||
// 声明 HTMLElement
|
||||
declare type HtmlType = HTMLElement | string | undefined | null;
|
||||
|
||||
// 申明 children 可选
|
||||
declare type ChilType<T = any> = {
|
||||
children?: T[];
|
||||
};
|
||||
|
||||
// 申明 数组
|
||||
declare type EmptyArrayType<T = any> = T[];
|
||||
|
||||
// 申明 对象
|
||||
declare type EmptyObjectType<T = any> = {
|
||||
[key: string]: T;
|
||||
};
|
||||
|
||||
// 申明 select option
|
||||
declare type SelectOptionType = {
|
||||
value: string | number;
|
||||
label: string | number;
|
||||
};
|
||||
|
||||
// 鼠标滚轮滚动类型
|
||||
declare interface WheelEventType extends WheelEvent {
|
||||
wheelDelta: number;
|
||||
}
|
||||
|
||||
// table 数据格式公共类型
|
||||
declare interface TableType<T = any> {
|
||||
total: number;
|
||||
loading: boolean;
|
||||
param: {
|
||||
pageNum: number;
|
||||
pageSize: number;
|
||||
[key: string]: T;
|
||||
};
|
||||
}
|
||||
59
src/types/layout.d.ts
vendored
Normal file
59
src/types/layout.d.ts
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
// aside
|
||||
declare type AsideState = {
|
||||
menuList: RouteRecordRaw[];
|
||||
clientWidth: number;
|
||||
};
|
||||
|
||||
// columnsAside
|
||||
declare type ColumnsAsideState<T = any> = {
|
||||
columnsAsideList: T[];
|
||||
liIndex: number;
|
||||
liOldIndex: null | number;
|
||||
liHoverIndex: null | number;
|
||||
liOldPath: null | string;
|
||||
difference: number;
|
||||
routeSplit: string[];
|
||||
};
|
||||
|
||||
// navBars breadcrumb
|
||||
declare type BreadcrumbState<T = any> = {
|
||||
breadcrumbList: T[];
|
||||
routeSplit: string[];
|
||||
routeSplitFirst: string;
|
||||
routeSplitIndex: number;
|
||||
};
|
||||
|
||||
// navBars search
|
||||
declare type SearchState<T = any> = {
|
||||
isShowSearch: boolean;
|
||||
menuQuery: string;
|
||||
tagsViewList: T[];
|
||||
};
|
||||
|
||||
// navBars tagsView
|
||||
declare type TagsViewState<T = any> = {
|
||||
routeActive: string | T;
|
||||
routePath: string | unknown;
|
||||
dropdown: {
|
||||
x: string | number;
|
||||
y: string | number;
|
||||
};
|
||||
sortable: T;
|
||||
tagsRefsIndex: number;
|
||||
tagsViewList: T[];
|
||||
tagsViewRoutesList: T[];
|
||||
};
|
||||
|
||||
// navBars parent
|
||||
declare type ParentViewState<T = any> = {
|
||||
refreshRouterViewKey: string;
|
||||
iframeRefreshKey: string;
|
||||
keepAliveNameList: string[];
|
||||
iframeList: T[];
|
||||
};
|
||||
|
||||
// navBars link
|
||||
declare type LinkViewState = {
|
||||
title: string;
|
||||
isLink: string;
|
||||
};
|
||||
38
src/types/mitt.d.ts
vendored
Normal file
38
src/types/mitt.d.ts
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* mitt 事件类型定义
|
||||
*
|
||||
* @method openSettingsDrawer 打开布局设置弹窗
|
||||
* @method restoreDefault 分栏布局,鼠标移入、移出数据显示
|
||||
* @method setSendColumnsChildren 分栏布局,鼠标移入、移出菜单数据传入到 navMenu 下的菜单中
|
||||
* @method setSendClassicChildren 经典布局,开启切割菜单时,菜单数据传入到 navMenu 下的菜单中
|
||||
* @method getBreadcrumbIndexSetFilterRoutes 布局设置弹窗,开启切割菜单时,菜单数据传入到 navMenu 下的菜单中
|
||||
* @method layoutMobileResize 浏览器窗口改变时,用于适配移动端界面显示
|
||||
* @method openOrCloseSortable 布局设置弹窗,开启 TagsView 拖拽
|
||||
* @method openShareTagsView 布局设置弹窗,开启 TagsView 共用
|
||||
* @method onTagsViewRefreshRouterView tagsview 刷新界面
|
||||
* @method onCurrentContextmenuClick tagsview 右键菜单每项点击时
|
||||
*/
|
||||
declare type MittType<T = any> = {
|
||||
openSettingsDrawer?: string;
|
||||
restoreDefault?: string;
|
||||
setSendColumnsChildren: T;
|
||||
setSendClassicChildren: T;
|
||||
getBreadcrumbIndexSetFilterRoutes?: string;
|
||||
layoutMobileResize: T;
|
||||
openOrCloseSortable?: string;
|
||||
openShareTagsView?: string;
|
||||
onTagsViewRefreshRouterView?: T;
|
||||
onCurrentContextmenuClick?: T;
|
||||
};
|
||||
|
||||
// mitt 参数类型定义
|
||||
declare type LayoutMobileResize = {
|
||||
layout: string;
|
||||
clientWidth: number;
|
||||
};
|
||||
|
||||
// mitt 参数菜单类型
|
||||
declare type MittMenu = {
|
||||
children: RouteRecordRaw[];
|
||||
item?: RouteItem;
|
||||
};
|
||||
95
src/types/pinia.d.ts
vendored
Normal file
95
src/types/pinia.d.ts
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
/**
|
||||
* pinia 类型定义
|
||||
*/
|
||||
|
||||
// 用户信息
|
||||
declare interface UserInfosState<T = any> {
|
||||
userInfos: {
|
||||
authBtnList: string[];
|
||||
photo: string;
|
||||
roles: string[];
|
||||
time: number;
|
||||
userName: string;
|
||||
[key: string]: T;
|
||||
};
|
||||
}
|
||||
|
||||
// 路由缓存列表
|
||||
declare interface KeepAliveNamesState {
|
||||
keepAliveNames: string[];
|
||||
cachedViews: string[];
|
||||
}
|
||||
|
||||
// 后端返回原始路由(未处理时)
|
||||
declare interface RequestOldRoutesState {
|
||||
requestOldRoutes: string[];
|
||||
}
|
||||
|
||||
// TagsView 路由列表
|
||||
declare interface TagsViewRoutesState<T = any> {
|
||||
tagsViewRoutes: T[];
|
||||
isTagsViewCurrenFull: Boolean;
|
||||
favoriteRoutes: T[];
|
||||
}
|
||||
|
||||
// 路由列表
|
||||
declare interface RoutesListState<T = any> {
|
||||
routesList: T[];
|
||||
isColumnsMenuHover: Boolean;
|
||||
isColumnsNavHover: Boolean;
|
||||
}
|
||||
|
||||
// 布局配置
|
||||
declare interface ThemeConfigState {
|
||||
themeConfig: {
|
||||
isDrawer: boolean;
|
||||
primary: string;
|
||||
topBar: string;
|
||||
topBarColor: string;
|
||||
isTopBarColorGradual: boolean;
|
||||
menuBar: string;
|
||||
menuBarColor: string;
|
||||
menuBarActiveColor: string;
|
||||
isMenuBarColorGradual: boolean;
|
||||
columnsMenuBar: string;
|
||||
columnsMenuBarColor: string;
|
||||
isColumnsMenuBarColorGradual: boolean;
|
||||
isColumnsMenuHoverPreload: boolean;
|
||||
isCollapse: boolean;
|
||||
isUniqueOpened: boolean;
|
||||
isFixedHeader: boolean;
|
||||
isFixedHeaderChange: boolean;
|
||||
isClassicSplitMenu: boolean;
|
||||
isLockScreen: boolean;
|
||||
lockScreenTime: number;
|
||||
isShowLogo: boolean;
|
||||
isShowLogoChange: boolean;
|
||||
isBreadcrumb: boolean;
|
||||
isTagsview: boolean;
|
||||
isBreadcrumbIcon: boolean;
|
||||
isTagsviewIcon: boolean;
|
||||
isCacheTagsView: boolean;
|
||||
isSortableTagsView: boolean;
|
||||
isShareTagsView: boolean;
|
||||
isFooter: boolean;
|
||||
isGrayscale: boolean;
|
||||
isInvert: boolean;
|
||||
isDark: boolean;
|
||||
isWartermark: boolean;
|
||||
isChat: boolean;
|
||||
wartermarkText: string;
|
||||
quickLinkNum: number;
|
||||
tagsStyle: string;
|
||||
animation: string;
|
||||
columnsAsideStyle: string;
|
||||
columnsAsideLayout: string;
|
||||
layout: string;
|
||||
isRequestRoutes: boolean;
|
||||
globalTitle: string;
|
||||
globalI18n: string;
|
||||
globalComponentSize: string;
|
||||
footerAuthor: string;
|
||||
background: string;
|
||||
miniQr: string;
|
||||
};
|
||||
}
|
||||
27
src/types/views.d.ts
vendored
Normal file
27
src/types/views.d.ts
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* views personal
|
||||
*/
|
||||
type NewInfo = {
|
||||
title: string;
|
||||
date: string;
|
||||
link: string;
|
||||
};
|
||||
type Recommend = {
|
||||
title: string;
|
||||
msg: string;
|
||||
icon: string;
|
||||
bg: string;
|
||||
iconColor: string;
|
||||
};
|
||||
declare type PersonalState = {
|
||||
newsInfoList: NewInfo[];
|
||||
recommendList: Recommend[];
|
||||
personalForm: {
|
||||
name: string;
|
||||
email: string;
|
||||
autograph: string;
|
||||
occupation: string;
|
||||
phone: string;
|
||||
sex: string;
|
||||
};
|
||||
};
|
||||
16
src/types/vue-shim.d.ts
vendored
Normal file
16
src/types/vue-shim.d.ts
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { parseTime, parseDate, dateTimeStr, dateStr, timeStr } from '@/utils/formatTime';
|
||||
|
||||
declare module 'vue' {
|
||||
interface ComponentCustomProperties {
|
||||
parseTime: typeof parseTime;
|
||||
parseDate: typeof parseDate;
|
||||
dateTimeStr: typeof dateTimeStr;
|
||||
dateStr: typeof dateStr;
|
||||
timeStr: typeof timeStr;
|
||||
baseURL: string;
|
||||
}
|
||||
}
|
||||
|
||||
// It's important to export something, even if it's an empty object,
|
||||
// to make this file a module and ensure the augmentations are applied.
|
||||
export {};
|
||||
Reference in New Issue
Block a user