From 34da551feee8ed9eb865186af1fb9b9c8cc23b36 Mon Sep 17 00:00:00 2001 From: fonghehe <331002675@qq.com> Date: Thu, 21 Jul 2022 12:20:49 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.js | 2 +- config/constant.ts | 8 + package.json | 2 +- src/i18n/index.ts | 3 +- src/store/modules/user.ts | 3 +- src/utils/index.ts | 4 +- tsconfig.json | 4 +- types/axios.d.ts | 106 ++++++------- types/config.d.ts | 323 +++++++++++++++++++------------------- types/global.d.ts | 188 +++++++++++----------- types/index.d.ts | 54 +++---- types/module.d.ts | 32 ++-- types/store.d.ts | 96 +++++------ types/utils.d.ts | 10 +- types/vue-router.d.ts | 90 +++++------ yarn.lock | 54 +++---- 16 files changed, 490 insertions(+), 489 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 419fded..f7b53bf 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -15,7 +15,7 @@ module.exports = { jsx: true, }, }, - extends: ['plugin:vue/vue3-recommended', 'plugin:@typescript-eslint/recommended', 'prettier', 'plugin:prettier/recommended'], + extends: ['plugin:vue/vue3-recommended', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'], rules: { 'vue/script-setup-uses-vars': 'error', '@typescript-eslint/ban-ts-ignore': 'off', diff --git a/config/constant.ts b/config/constant.ts index f47e28e..aa16103 100644 --- a/config/constant.ts +++ b/config/constant.ts @@ -1 +1,9 @@ export const IsReport = process.env.REPORT; + +export const API_BASE_URL = ''; + +export const MOCK_API_BASE_URL = ''; + +export const API_TARGET_URL = ''; + +export const MOCK_API_TARGET_URL = ''; diff --git a/package.json b/package.json index cd6e2da..25f4e4e 100644 --- a/package.json +++ b/package.json @@ -74,7 +74,7 @@ "vite-plugin-svg-icons": "^2.0.1", "vite-plugin-vue-setup-extend": "^0.4.0", "vue-eslint-parser": "^9.0.3", - "vue-tsc": "^0.38.8" + "vue-tsc": "^0.38.9" }, "husky": { "hooks": { diff --git a/src/i18n/index.ts b/src/i18n/index.ts index 64ea8ff..27b5e90 100644 --- a/src/i18n/index.ts +++ b/src/i18n/index.ts @@ -1,9 +1,8 @@ -import { AnyObject } from '/#/global'; import { createI18n } from 'vue-i18n'; export function loadLang() { const modules: Record = import.meta.glob('./lang/*.ts', { eager: true }); - const langs: AnyObject = {}; + const langs: Record = {}; for (const path in modules) { const name = path.replace(/(\.\/lang\/|\.ts)/g, ''); diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index 6b91422..f2464cb 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -2,14 +2,13 @@ import { loginPassword } from '/@/api'; import { useCookies } from '@vueuse/integrations/useCookies'; import { defineStore } from 'pinia'; import { watch } from 'vue'; -import { AnyObject } from '/#/global'; const { VITE_TOKEN_KEY } = import.meta.env; const token = useCookies().get(VITE_TOKEN_KEY as string); interface StoreUser { token: string; - info: AnyObject; + info: Record; } export const useUserStore = defineStore({ diff --git a/src/utils/index.ts b/src/utils/index.ts index 0a0b330..037ac4b 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,5 +1,3 @@ -import { AnyObject } from '/#/global'; - export function typeCheck(param: any) { return Object.prototype.toString.call(param); } @@ -7,7 +5,7 @@ export function typeCheck(param: any) { /** * 批量修改stage */ -export function mutateState(state: AnyObject, payload: AnyObject) { +export function mutateState(state: Record, payload: Record) { if (typeCheck(state) === '[object Object]' && typeCheck(payload) === '[object Object]') { for (const key in payload) { state[key] = payload[key]; diff --git a/tsconfig.json b/tsconfig.json index 76e91f2..2cfec8b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -35,8 +35,8 @@ "src/**/*.vue", "types/**/*.d.ts", "types/**/*.ts", - "build/**/*.ts", - "build/**/*.d.ts", + "config/**/*.ts", + "config/**/*.d.ts", "mock/**/*.ts", "vite.config.ts" ], diff --git a/types/axios.d.ts b/types/axios.d.ts index b18af05..7d160d7 100644 --- a/types/axios.d.ts +++ b/types/axios.d.ts @@ -1,53 +1,53 @@ -export type ErrorMessageMode = 'none' | 'modal' | 'message' | undefined; - -export interface RequestOptions { - // Splicing request parameters to url - joinParamsToUrl?: boolean; - // Format request parameter time - formatDate?: boolean; - // Whether to process the request result - isTransformResponse?: boolean; - // Whether to return native response headers - // For example: use this attribute when you need to get the response headers - isReturnNativeResponse?: boolean; - // Whether to join url - joinPrefix?: boolean; - // Interface address, use the default apiUrl if you leave it blank - apiUrl?: string; - // 请求拼接路径 - urlPrefix?: string; - // Error message prompt type - errorMessageMode?: ErrorMessageMode; - // Whether to add a timestamp - joinTime?: boolean; - ignoreCancelToken?: boolean; - // Whether to send token in header - withToken?: boolean; - // 请求重试机制 - retryRequest?: RetryRequest; -} - -export interface RetryRequest { - isOpenRetry: boolean; - count: number; - waitTime: number; -} -export interface Result { - code: number; - type: 'success' | 'error' | 'warning'; - message: string; - result: T; -} - -// multipart/form-data: upload file -export interface UploadFileParams { - // Other parameters - data?: Recordable; - // File parameter interface field name - name?: string; - // file name - file: File | Blob; - // file name - filename?: string; - [key: string]: any; -} +export type ErrorMessageMode = 'none' | 'modal' | 'message' | undefined; + +export interface RequestOptions { + // Splicing request parameters to url + joinParamsToUrl?: boolean; + // Format request parameter time + formatDate?: boolean; + // Whether to process the request result + isTransformResponse?: boolean; + // Whether to return native response headers + // For example: use this attribute when you need to get the response headers + isReturnNativeResponse?: boolean; + // Whether to join url + joinPrefix?: boolean; + // Interface address, use the default apiUrl if you leave it blank + apiUrl?: string; + // 请求拼接路径 + urlPrefix?: string; + // Error message prompt type + errorMessageMode?: ErrorMessageMode; + // Whether to add a timestamp + joinTime?: boolean; + ignoreCancelToken?: boolean; + // Whether to send token in header + withToken?: boolean; + // 请求重试机制 + retryRequest?: RetryRequest; +} + +export interface RetryRequest { + isOpenRetry: boolean; + count: number; + waitTime: number; +} +export interface Result { + code: number; + type: 'success' | 'error' | 'warning'; + message: string; + result: T; +} + +// multipart/form-data: upload file +export interface UploadFileParams { + // Other parameters + data?: Recordable; + // File parameter interface field name + name?: string; + // file name + file: File | Blob; + // file name + filename?: string; + [key: string]: any; +} diff --git a/types/config.d.ts b/types/config.d.ts index cb5a5a9..70ec4da 100644 --- a/types/config.d.ts +++ b/types/config.d.ts @@ -1,161 +1,162 @@ -import { MenuTypeEnum, MenuModeEnum, TriggerEnum, MixSidebarTriggerEnum } from '/@/enums/menuEnum'; -import { - ContentEnum, - PermissionModeEnum, - ThemeEnum, - RouterTransitionEnum, - SettingButtonPositionEnum, - SessionTimeoutProcessingEnum, -} from '/@/enums/appEnum'; - -import { CacheTypeEnum } from '/@/enums/cacheEnum'; - -export type LocaleType = 'zh_CN' | 'en' | 'ru' | 'ja' | 'ko'; - -export interface MenuSetting { - bgColor: string; - fixed: boolean; - collapsed: boolean; - canDrag: boolean; - show: boolean; - hidden: boolean; - split: boolean; - menuWidth: number; - mode: MenuModeEnum; - type: MenuTypeEnum; - theme: ThemeEnum; - topMenuAlign: 'start' | 'center' | 'end'; - trigger: TriggerEnum; - accordion: boolean; - closeMixSidebarOnChange: boolean; - collapsedShowTitle: boolean; - mixSideTrigger: MixSidebarTriggerEnum; - mixSideFixed: boolean; -} - -export interface MultiTabsSetting { - cache: boolean; - show: boolean; - showQuick: boolean; - canDrag: boolean; - showRedo: boolean; - showFold: boolean; -} - -export interface HeaderSetting { - bgColor: string; - fixed: boolean; - show: boolean; - theme: ThemeEnum; - // Turn on full screen - showFullScreen: boolean; - // Whether to show the lock screen - useLockPage: boolean; - // Show document button - showDoc: boolean; - // Show message center button - showNotice: boolean; - showSearch: boolean; -} - -export interface LocaleSetting { - showPicker: boolean; - // Current language - locale: LocaleType; - // default language - fallback: LocaleType; - // available Locales - availableLocales: LocaleType[]; -} - -export interface TransitionSetting { - // Whether to open the page switching animation - enable: boolean; - // Route basic switching animation - basicTransition: RouterTransitionEnum; - // Whether to open page switching loading - openPageLoading: boolean; - // Whether to open the top progress bar - openNProgress: boolean; -} - -export interface ProjectConfig { - // Storage location of permission related information - permissionCacheType: CacheTypeEnum; - // Whether to show the configuration button - showSettingButton: boolean; - // Whether to show the theme switch button - showDarkModeToggle: boolean; - // Configure where the button is displayed - settingButtonPosition: SettingButtonPositionEnum; - // Permission mode - permissionMode: PermissionModeEnum; - // Session timeout processing - sessionTimeoutProcessing: SessionTimeoutProcessingEnum; - // Website gray mode, open for possible mourning dates - grayMode: boolean; - // Whether to turn on the color weak mode - colorWeak: boolean; - // Theme color - themeColor: string; - - // The main interface is displayed in full screen, the menu is not displayed, and the top - fullContent: boolean; - // content width - contentMode: ContentEnum; - // Whether to display the logo - showLogo: boolean; - // Whether to show the global footer - showFooter: boolean; - // menuType: MenuTypeEnum; - headerSetting: HeaderSetting; - // menuSetting - menuSetting: MenuSetting; - // Multi-tab settings - multiTabsSetting: MultiTabsSetting; - // Animation configuration - transitionSetting: TransitionSetting; - // pageLayout whether to enable keep-alive - openKeepAlive: boolean; - // Lock screen time - lockTime: number; - // Show breadcrumbs - showBreadCrumb: boolean; - // Show breadcrumb icon - showBreadCrumbIcon: boolean; - // Use error-handler-plugin - useErrorHandle: boolean; - // Whether to open back to top - useOpenBackTop: boolean; - // Is it possible to embed iframe pages - canEmbedIFramePage: boolean; - // Whether to delete unclosed messages and notify when switching the interface - closeMessageOnSwitch: boolean; - // Whether to cancel the http request that has been sent but not responded when switching the interface. - removeAllHttpPending: boolean; -} - -export interface GlobConfig { - // Site title - title: string; - // Service interface url - apiUrl: string; - // Upload url - uploadUrl?: string; - // Service interface url prefix - urlPrefix?: string; - // Project abbreviation - shortName: string; -} -export interface GlobEnvConfig { - // Site title - VITE_GLOB_APP_TITLE: string; - // Service interface url - VITE_GLOB_API_URL: string; - // Service interface url prefix - VITE_GLOB_API_URL_PREFIX?: string; - // Project abbreviation - VITE_GLOB_APP_SHORT_NAME: string; - // Upload url - VITE_GLOB_UPLOAD_URL?: string; -} +import { MenuTypeEnum, MenuModeEnum, TriggerEnum, MixSidebarTriggerEnum } from '/@/enums/menuEnum'; +import { + ContentEnum, + PermissionModeEnum, + ThemeEnum, + RouterTransitionEnum, + SettingButtonPositionEnum, + SessionTimeoutProcessingEnum, +} from '/@/enums/appEnum'; + +import { CacheTypeEnum } from '/@/enums/cacheEnum'; + +export type LocaleType = 'zh_CN' | 'en' | 'ru' | 'ja' | 'ko'; + +export interface MenuSetting { + bgColor: string; + fixed: boolean; + collapsed: boolean; + siderHidden: boolean; + canDrag: boolean; + show: boolean; + hidden: boolean; + split: boolean; + menuWidth: number; + mode: MenuModeEnum; + type: MenuTypeEnum; + theme: ThemeEnum; + topMenuAlign: 'start' | 'center' | 'end'; + trigger: TriggerEnum; + accordion: boolean; + closeMixSidebarOnChange: boolean; + collapsedShowTitle: boolean; + mixSideTrigger: MixSidebarTriggerEnum; + mixSideFixed: boolean; +} + +export interface MultiTabsSetting { + cache: boolean; + show: boolean; + showQuick: boolean; + canDrag: boolean; + showRedo: boolean; + showFold: boolean; +} + +export interface HeaderSetting { + bgColor: string; + fixed: boolean; + show: boolean; + theme: ThemeEnum; + // Turn on full screen + showFullScreen: boolean; + // Whether to show the lock screen + useLockPage: boolean; + // Show document button + showDoc: boolean; + // Show message center button + showNotice: boolean; + showSearch: boolean; +} + +export interface LocaleSetting { + showPicker: boolean; + // Current language + locale: LocaleType; + // default language + fallback: LocaleType; + // available Locales + availableLocales: LocaleType[]; +} + +export interface TransitionSetting { + // Whether to open the page switching animation + enable: boolean; + // Route basic switching animation + basicTransition: RouterTransitionEnum; + // Whether to open page switching loading + openPageLoading: boolean; + // Whether to open the top progress bar + openNProgress: boolean; +} + +export interface ProjectConfig { + // Storage location of permission related information + permissionCacheType: CacheTypeEnum; + // Whether to show the configuration button + showSettingButton: boolean; + // Whether to show the theme switch button + showDarkModeToggle: boolean; + // Configure where the button is displayed + settingButtonPosition: SettingButtonPositionEnum; + // Permission mode + permissionMode: PermissionModeEnum; + // Session timeout processing + sessionTimeoutProcessing: SessionTimeoutProcessingEnum; + // Website gray mode, open for possible mourning dates + grayMode: boolean; + // Whether to turn on the color weak mode + colorWeak: boolean; + // Theme color + themeColor: string; + + // The main interface is displayed in full screen, the menu is not displayed, and the top + fullContent: boolean; + // content width + contentMode: ContentEnum; + // Whether to display the logo + showLogo: boolean; + // Whether to show the global footer + showFooter: boolean; + // menuType: MenuTypeEnum; + headerSetting: HeaderSetting; + // menuSetting + menuSetting: MenuSetting; + // Multi-tab settings + multiTabsSetting: MultiTabsSetting; + // Animation configuration + transitionSetting: TransitionSetting; + // pageLayout whether to enable keep-alive + openKeepAlive: boolean; + // Lock screen time + lockTime: number; + // Show breadcrumbs + showBreadCrumb: boolean; + // Show breadcrumb icon + showBreadCrumbIcon: boolean; + // Use error-handler-plugin + useErrorHandle: boolean; + // Whether to open back to top + useOpenBackTop: boolean; + // Is it possible to embed iframe pages + canEmbedIFramePage: boolean; + // Whether to delete unclosed messages and notify when switching the interface + closeMessageOnSwitch: boolean; + // Whether to cancel the http request that has been sent but not responded when switching the interface. + removeAllHttpPending: boolean; +} + +export interface GlobConfig { + // Site title + title: string; + // Service interface url + apiUrl: string; + // Upload url + uploadUrl?: string; + // Service interface url prefix + urlPrefix?: string; + // Project abbreviation + shortName: string; +} +export interface GlobEnvConfig { + // Site title + VITE_GLOB_APP_TITLE: string; + // Service interface url + VITE_GLOB_API_URL: string; + // Service interface url prefix + VITE_GLOB_API_URL_PREFIX?: string; + // Project abbreviation + VITE_GLOB_APP_SHORT_NAME: string; + // Upload url + VITE_GLOB_UPLOAD_URL?: string; +} diff --git a/types/global.d.ts b/types/global.d.ts index 6a37ab2..5e9c580 100644 --- a/types/global.d.ts +++ b/types/global.d.ts @@ -1,96 +1,92 @@ -import type { ComponentRenderProxy, VNode, VNodeChild, ComponentPublicInstance, FunctionalComponent, PropType as VuePropType } from 'vue'; - -declare global { - const __APP_INFO__: { - pkg: { - name: string; - version: string; - dependencies: Recordable; - devDependencies: Recordable; - }; - lastBuildTime: string; - }; - // declare interface Window { - // // Global vue app instance - // __APP__: App; - // } - - // vue - declare type PropType = VuePropType; - declare type VueNode = VNodeChild | JSX.Element; - - export type Writable = { - -readonly [P in keyof T]: T[P]; - }; - - declare type Nullable = T | null; - declare type NonNullable = T extends null | undefined ? never : T; - declare type Recordable = Record; - declare type ReadonlyRecordable = { - readonly [key: string]: T; - }; - declare type Indexable = { - [key: string]: T; - }; - declare type DeepPartial = { - [P in keyof T]?: DeepPartial; - }; - declare type TimeoutHandle = ReturnType; - declare type IntervalHandle = ReturnType; - - declare interface ChangeEvent extends Event { - target: HTMLInputElement; - } - - declare interface WheelEvent { - path?: EventTarget[]; - } - interface ImportMetaEnv extends ViteEnv { - __: unknown; - } - - declare interface ViteEnv { - VITE_PORT: number; - VITE_USE_MOCK: boolean; - VITE_USE_PWA: boolean; - VITE_PUBLIC_PATH: string; - VITE_PROXY: [string, string][]; - VITE_GLOB_APP_TITLE: string; - VITE_GLOB_APP_SHORT_NAME: string; - VITE_USE_CDN: boolean; - VITE_DROP_CONSOLE: boolean; - VITE_BUILD_COMPRESS: 'gzip' | 'brotli' | 'none'; - VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE: boolean; - VITE_LEGACY: boolean; - VITE_USE_IMAGEMIN: boolean; - VITE_GENERATE_UI: string; - } - - declare function parseInt(s: string | number, radix?: number): number; - - declare function parseFloat(string: string | number): number; - - namespace JSX { - // tslint:disable no-empty-interface - type Element = VNode; - // tslint:disable no-empty-interface - type ElementClass = ComponentRenderProxy; - interface ElementAttributesProperty { - $props: any; - } - interface IntrinsicElements { - [elem: string]: any; - } - interface IntrinsicAttributes { - [elem: string]: any; - } - } -} - -export interface AnyObject { - [key: string]: any; -} - -declare module 'vue' { - export type JSXComponent = { new (): ComponentPublicInstance } | FunctionalComponent; -} +import type { ComponentRenderProxy, VNode, VNodeChild, ComponentPublicInstance, FunctionalComponent, PropType as VuePropType } from 'vue'; + +declare global { + const __APP_INFO__: { + pkg: { + name: string; + version: string; + dependencies: Recordable; + devDependencies: Recordable; + }; + lastBuildTime: string; + }; + // declare interface Window { + // // Global vue app instance + // __APP__: App; + // } + + // vue + declare type PropType = VuePropType; + declare type VueNode = VNodeChild | JSX.Element; + + export type Writable = { + -readonly [P in keyof T]: T[P]; + }; + + declare type Nullable = T | null; + declare type NonNullable = T extends null | undefined ? never : T; + declare type Recordable = Record; + declare type ReadonlyRecordable = { + readonly [key: string]: T; + }; + declare type Indexable = { + [key: string]: T; + }; + declare type DeepPartial = { + [P in keyof T]?: DeepPartial; + }; + declare type TimeoutHandle = ReturnType; + declare type IntervalHandle = ReturnType; + + declare interface ChangeEvent extends Event { + target: HTMLInputElement; + } + + declare interface WheelEvent { + path?: EventTarget[]; + } + interface ImportMetaEnv extends ViteEnv { + __: unknown; + } + + declare interface ViteEnv { + VITE_PORT: number; + VITE_USE_MOCK: boolean; + VITE_USE_PWA: boolean; + VITE_PUBLIC_PATH: string; + VITE_PROXY: [string, string][]; + VITE_GLOB_APP_TITLE: string; + VITE_GLOB_APP_SHORT_NAME: string; + VITE_USE_CDN: boolean; + VITE_DROP_CONSOLE: boolean; + VITE_BUILD_COMPRESS: 'gzip' | 'brotli' | 'none'; + VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE: boolean; + VITE_LEGACY: boolean; + VITE_USE_IMAGEMIN: boolean; + VITE_GENERATE_UI: string; + } + + declare function parseInt(s: string | number, radix?: number): number; + + declare function parseFloat(string: string | number): number; + + namespace JSX { + // tslint:disable no-empty-interface + type Element = VNode; + // tslint:disable no-empty-interface + type ElementClass = ComponentRenderProxy; + interface ElementAttributesProperty { + $props: any; + } + interface IntrinsicElements { + [elem: string]: any; + } + interface IntrinsicAttributes { + [elem: string]: any; + } + } +} + +declare module 'vue' { + export type JSXComponent = { new (): ComponentPublicInstance } | FunctionalComponent; +} diff --git a/types/index.d.ts b/types/index.d.ts index b279c0a..a424425 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,27 +1,27 @@ -declare interface Fn { - (...arg: T[]): R; -} - -declare interface PromiseFn { - (...arg: T[]): Promise; -} - -declare type RefType = T | null; - -declare type LabelValueOptions = { - label: string; - value: any; - [key: string]: string | number | boolean; -}[]; - -declare type EmitType = (event: string, ...args: any[]) => void; - -declare type TargetContext = '_self' | '_blank'; - -declare interface ComponentElRef { - $el: T; -} - -declare type ComponentRef = ComponentElRef | null; - -declare type ElRef = Nullable; +declare interface Fn { + (...arg: T[]): R; +} + +declare interface PromiseFn { + (...arg: T[]): Promise; +} + +declare type RefType = T | null; + +declare type LabelValueOptions = { + label: string; + value: any; + [key: string]: string | number | boolean; +}[]; + +declare type EmitType = (event: string, ...args: any[]) => void; + +declare type TargetContext = '_self' | '_blank'; + +declare interface ComponentElRef { + $el: T; +} + +declare type ComponentRef = ComponentElRef | null; + +declare type ElRef = Nullable; diff --git a/types/module.d.ts b/types/module.d.ts index 9615206..6f1ac04 100644 --- a/types/module.d.ts +++ b/types/module.d.ts @@ -1,16 +1,16 @@ -declare module '*.vue' { - import { DefineComponent } from 'vue'; - const Component: DefineComponent<{}, {}, any>; - export default Component; -} - -declare module 'ant-design-vue/es/locale/*' { - import { Locale } from 'ant-design-vue/types/locale-provider'; - const locale: Locale & ReadonlyRecordable; - export default locale as Locale & ReadonlyRecordable; -} - -declare module 'virtual:*' { - const result: any; - export default result; -} +declare module '*.vue' { + import { DefineComponent } from 'vue'; + const Component: DefineComponent<{}, {}, any>; + export default Component; +} + +declare module 'ant-design-vue/es/locale/*' { + import { Locale } from 'ant-design-vue/types/locale-provider'; + const locale: Locale & ReadonlyRecordable; + export default locale as Locale & ReadonlyRecordable; +} + +declare module 'virtual:*' { + const result: any; + export default result; +} diff --git a/types/store.d.ts b/types/store.d.ts index 36a6025..2f1e2f7 100644 --- a/types/store.d.ts +++ b/types/store.d.ts @@ -1,48 +1,48 @@ -import { ErrorTypeEnum } from '/@/enums/exceptionEnum'; -import { MenuModeEnum, MenuTypeEnum } from '/@/enums/menuEnum'; -import { RoleInfo } from '/@/api/sys/model/userModel'; - -// Lock screen information -export interface LockInfo { - // Password required - pwd?: string | undefined; - // Is it locked? - isLock?: boolean; -} - -// Error-log information -export interface ErrorLogInfo { - // Type of error - type: ErrorTypeEnum; - // Error file - file: string; - // Error name - name?: string; - // Error message - message: string; - // Error stack - stack?: string; - // Error detail - detail: string; - // Error url - url: string; - // Error time - time?: string; -} - -export interface UserInfo { - userId: string | number; - username: string; - realName: string; - avatar: string; - desc?: string; - homePath?: string; - roles: RoleInfo[]; -} - -export interface BeforeMiniState { - menuCollapsed?: boolean; - menuSplit?: boolean; - menuMode?: MenuModeEnum; - menuType?: MenuTypeEnum; -} +import { ErrorTypeEnum } from '/@/enums/exceptionEnum'; +import { MenuModeEnum, MenuTypeEnum } from '/@/enums/menuEnum'; +import { RoleInfo } from '/@/api/sys/model/userModel'; + +// Lock screen information +export interface LockInfo { + // Password required + pwd?: string | undefined; + // Is it locked? + isLock?: boolean; +} + +// Error-log information +export interface ErrorLogInfo { + // Type of error + type: ErrorTypeEnum; + // Error file + file: string; + // Error name + name?: string; + // Error message + message: string; + // Error stack + stack?: string; + // Error detail + detail: string; + // Error url + url: string; + // Error time + time?: string; +} + +export interface UserInfo { + userId: string | number; + username: string; + realName: string; + avatar: string; + desc?: string; + homePath?: string; + roles: RoleInfo[]; +} + +export interface BeforeMiniState { + menuCollapsed?: boolean; + menuSplit?: boolean; + menuMode?: MenuModeEnum; + menuType?: MenuTypeEnum; +} diff --git a/types/utils.d.ts b/types/utils.d.ts index 6500d44..29b2a64 100644 --- a/types/utils.d.ts +++ b/types/utils.d.ts @@ -1,5 +1,5 @@ -import type { ComputedRef, Ref } from 'vue'; - -export type DynamicProps = { - [P in keyof T]: Ref | T[P] | ComputedRef; -}; +import type { ComputedRef, Ref } from 'vue'; + +export type DynamicProps = { + [P in keyof T]: Ref | T[P] | ComputedRef; +}; diff --git a/types/vue-router.d.ts b/types/vue-router.d.ts index 93fd788..958655c 100644 --- a/types/vue-router.d.ts +++ b/types/vue-router.d.ts @@ -1,45 +1,45 @@ -export {}; - -declare module 'vue-router' { - interface RouteMeta extends Record { - orderNo?: number; - // title - title: string; - // dynamic router level. - dynamicLevel?: number; - // dynamic router real route path (For performance). - realPath?: string; - // Whether to ignore permissions - ignoreAuth?: boolean; - // role info - roles?: RoleEnum[]; - // Whether not to cache - ignoreKeepAlive?: boolean; - // Is it fixed on tab - affix?: boolean; - // icon on tab - icon?: string; - frameSrc?: string; - // current page transition - transitionName?: string; - // Whether the route has been dynamically added - hideBreadcrumb?: boolean; - // Hide submenu - hideChildrenInMenu?: boolean; - // Carrying parameters - carryParam?: boolean; - // Used internally to mark single-level menus - single?: boolean; - // Currently active menu - currentActiveMenu?: string; - // Never show in tab - hideTab?: boolean; - // Never show in menu - hideMenu?: boolean; - isLink?: boolean; - // only build for Menu - ignoreRoute?: boolean; - // Hide path for children - hidePathForChildren?: boolean; - } -} +export {}; + +declare module 'vue-router' { + interface RouteMeta extends Record { + orderNo?: number; + // title + title: string; + // dynamic router level. + dynamicLevel?: number; + // dynamic router real route path (For performance). + realPath?: string; + // Whether to ignore permissions + ignoreAuth?: boolean; + // role info + roles?: RoleEnum[]; + // Whether not to cache + ignoreKeepAlive?: boolean; + // Is it fixed on tab + affix?: boolean; + // icon on tab + icon?: string; + frameSrc?: string; + // current page transition + transitionName?: string; + // Whether the route has been dynamically added + hideBreadcrumb?: boolean; + // Hide submenu + hideChildrenInMenu?: boolean; + // Carrying parameters + carryParam?: boolean; + // Used internally to mark single-level menus + single?: boolean; + // Currently active menu + currentActiveMenu?: string; + // Never show in tab + hideTab?: boolean; + // Never show in menu + hideMenu?: boolean; + isLink?: boolean; + // only build for Menu + ignoreRoute?: boolean; + // Hide path for children + hidePathForChildren?: boolean; + } +} diff --git a/yarn.lock b/yarn.lock index 60c7322..4e5b65f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -919,37 +919,37 @@ resolved "https://registry.yarnpkg.com/@vitejs/plugin-vue/-/plugin-vue-3.0.1.tgz#b6af8f782485374bbb5fe09edf067a845bf4caae" integrity sha512-Ll9JgxG7ONIz/XZv3dssfoMUDu9qAnlJ+km+pBA0teYSXzwPCIzS/e1bmwNYl5dcQGs677D21amgfYAnzMl17A== -"@volar/code-gen@0.38.8": - version "0.38.8" - resolved "https://registry.yarnpkg.com/@volar/code-gen/-/code-gen-0.38.8.tgz#ea50a742983f9fd8c3fc23d61497387c520776c9" - integrity sha512-e37jd+JwNjBpWiBblsdmYMbJ9bELiuj2yZrsXv1IVKpYNSfvS92ZiYjJqVXHUwpzNeZjFG0RCd5nTpbiebwANw== +"@volar/code-gen@0.38.9": + version "0.38.9" + resolved "https://registry.yarnpkg.com/@volar/code-gen/-/code-gen-0.38.9.tgz#8fed2c6a472c8f11ce695b08789bcc22b08e7fa6" + integrity sha512-n6LClucfA+37rQeskvh9vDoZV1VvCVNy++MAPKj2dT4FT+Fbmty/SDQqnsEBtdEe6E3OQctFvA/IcKsx3Mns0A== dependencies: - "@volar/source-map" "0.38.8" + "@volar/source-map" "0.38.9" -"@volar/source-map@0.38.8": - version "0.38.8" - resolved "https://registry.yarnpkg.com/@volar/source-map/-/source-map-0.38.8.tgz#13b2fc9234f78fada3c78fd235f446cfaaa7d0b8" - integrity sha512-JZvpjW/z2U3wq5wvwcTounPrRAZuSl4hlVKr3y7y72bKr++6W05OnX7fl/ddw39G/wLHdI2ag5+4JWsSd/EYhg== +"@volar/source-map@0.38.9": + version "0.38.9" + resolved "https://registry.yarnpkg.com/@volar/source-map/-/source-map-0.38.9.tgz#935d6def4b4342e8e2d63cd8e6bf9bf1155c58d8" + integrity sha512-ba0UFoHDYry+vwKdgkWJ6xlQT+8TFtZg1zj9tSjj4PykW1JZDuM0xplMotLun4h3YOoYfY9K1huY5gvxmrNLIw== -"@volar/vue-code-gen@0.38.8": - version "0.38.8" - resolved "https://registry.yarnpkg.com/@volar/vue-code-gen/-/vue-code-gen-0.38.8.tgz#e7b719194ef40d76093191cf4bb83c96134fed32" - integrity sha512-iQVNmIu1TqnqTko+l9yeylmZipZ8zNH20XZAK9+48hkv2fEQnnJn5AI2W9Zb2M5DkGMpbYiJk9Fq1vm51YY1+g== +"@volar/vue-code-gen@0.38.9": + version "0.38.9" + resolved "https://registry.yarnpkg.com/@volar/vue-code-gen/-/vue-code-gen-0.38.9.tgz#878f00fec82a2fc300396d70e26b0ea29952f740" + integrity sha512-tzj7AoarFBKl7e41MR006ncrEmNPHALuk8aG4WdDIaG387X5//5KhWC5Ff3ZfB2InGSeNT+CVUd74M0gS20rjA== dependencies: - "@volar/code-gen" "0.38.8" - "@volar/source-map" "0.38.8" + "@volar/code-gen" "0.38.9" + "@volar/source-map" "0.38.9" "@vue/compiler-core" "^3.2.37" "@vue/compiler-dom" "^3.2.37" "@vue/shared" "^3.2.37" -"@volar/vue-typescript@0.38.8": - version "0.38.8" - resolved "https://registry.yarnpkg.com/@volar/vue-typescript/-/vue-typescript-0.38.8.tgz#5412a8b38d404a72aa37902ad87ccd3dc0c7f1f1" - integrity sha512-7WeFt5piz9I6FKw2cQQCWm+75MxS6xCOGm300iu+hJORlroN2dwWbwj97pQnDGbjQbftCRplUYf0GqmhcOsanQ== +"@volar/vue-typescript@0.38.9": + version "0.38.9" + resolved "https://registry.yarnpkg.com/@volar/vue-typescript/-/vue-typescript-0.38.9.tgz#e5dfdc6f0d6dbea683647cd477fafbd483983b35" + integrity sha512-iJMQGU91ADi98u8V1vXd2UBmELDAaeSP0ZJaFjwosClQdKlJQYc6MlxxKfXBZisHqfbhdtrGRyaryulnYtliZw== dependencies: - "@volar/code-gen" "0.38.8" - "@volar/source-map" "0.38.8" - "@volar/vue-code-gen" "0.38.8" + "@volar/code-gen" "0.38.9" + "@volar/source-map" "0.38.9" + "@volar/vue-code-gen" "0.38.9" "@vue/compiler-sfc" "^3.2.37" "@vue/reactivity" "^3.2.37" @@ -7822,12 +7822,12 @@ vue-router@^4.1.2: dependencies: "@vue/devtools-api" "^6.1.4" -vue-tsc@^0.38.8: - version "0.38.8" - resolved "https://registry.yarnpkg.com/vue-tsc/-/vue-tsc-0.38.8.tgz#becf3dddd3c57784c79206aa1d5be750e8bca319" - integrity sha512-hhyc5SODiekcYNXG08aNg17LogR19o3i14avVejo+Fm45Dqk9Ke6rb0M19HoTKdQGfZBgqg2VUboYxmtAukWeg== +vue-tsc@^0.38.9: + version "0.38.9" + resolved "https://registry.yarnpkg.com/vue-tsc/-/vue-tsc-0.38.9.tgz#9e945937667f704325328db8af1cc6bc7314b85e" + integrity sha512-Yoy5phgvGqyF98Fb4mYqboR4Q149jrdcGv5kSmufXJUq++RZJ2iMVG0g6zl+v3t4ORVWkQmRpsV4x2szufZ0LQ== dependencies: - "@volar/vue-typescript" "0.38.8" + "@volar/vue-typescript" "0.38.9" vue@^3.2.36: version "3.2.37"