From 18dbf4c9b61a2b14af13a0be1741dbd25895be93 Mon Sep 17 00:00:00 2001 From: fonghehe <331002675@qq.com> Date: Sat, 11 Mar 2023 15:32:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 4 +- .env.production | 6 +- .env.test | 4 +- .vscode/settings.json | 1 + build/vite/plugins/index.ts | 8 +- types/axios.d.ts | 53 ------------ types/config.d.ts | 162 ------------------------------------ types/global.d.ts | 5 +- types/store.d.ts | 48 ----------- types/vue-router.d.ts | 45 ---------- 10 files changed, 16 insertions(+), 320 deletions(-) delete mode 100644 types/axios.d.ts delete mode 100644 types/config.d.ts delete mode 100644 types/store.d.ts delete mode 100644 types/vue-router.d.ts diff --git a/.env.development b/.env.development index 2fc12b5..f52f12e 100644 --- a/.env.development +++ b/.env.development @@ -1,3 +1,5 @@ VITE_USE_MOCK=true -VITE_USE_ERUDA=true \ No newline at end of file +VITE_USE_ERUDA=false + +VITE_USE_COMPRESS=false \ No newline at end of file diff --git a/.env.production b/.env.production index 86d6c1c..6298253 100644 --- a/.env.production +++ b/.env.production @@ -1,3 +1,5 @@ -VITE_USE_MOCK=false +VITE_USE_MOCK=true -VITE_USE_ERUDA=false \ No newline at end of file +VITE_USE_ERUDA=false + +VITE_USE_COMPRESS=true \ No newline at end of file diff --git a/.env.test b/.env.test index 2fc12b5..ecf2301 100644 --- a/.env.test +++ b/.env.test @@ -1,3 +1,5 @@ VITE_USE_MOCK=true -VITE_USE_ERUDA=true \ No newline at end of file +VITE_USE_ERUDA=true + +VITE_USE_COMPRESS=true \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 853d75a..a4955be 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -8,6 +8,7 @@ "nutui", "pinia", "stylelint", + "Tabbar", "unplugin", "vant", "vite", diff --git a/build/vite/plugins/index.ts b/build/vite/plugins/index.ts index f3e7d2f..0e8d327 100644 --- a/build/vite/plugins/index.ts +++ b/build/vite/plugins/index.ts @@ -20,7 +20,7 @@ import { ConfigImageminPlugin } from './imagemin'; import { ConfigVisualizerConfig } from './visualizer'; export function createVitePlugins(env: ViteEnv, isBuild: boolean) { - const { VITE_USE_MOCK, VITE_USE_ERUDA } = env; + const { VITE_USE_MOCK, VITE_USE_ERUDA, VITE_USE_COMPRESS } = env; const vitePlugins: (PluginOption | PluginOption[])[] = [ // vue支持 @@ -40,9 +40,6 @@ export function createVitePlugins(env: ViteEnv, isBuild: boolean) { // 自动生成路由 vitePlugins.push(ConfigPagesPlugin()); - // 开启.gz压缩 rollup-plugin-gzip - vitePlugins.push(ConfigCompressPlugin()); - // 监听配置文件改动重启 vitePlugins.push(ConfigRestartPlugin()); @@ -64,6 +61,9 @@ export function createVitePlugins(env: ViteEnv, isBuild: boolean) { if (isBuild) { // vite-plugin-imagemin vitePlugins.push(ConfigImageminPlugin()); + + // 开启.gz压缩 rollup-plugin-gzip + VITE_USE_COMPRESS && vitePlugins.push(ConfigCompressPlugin()); } return vitePlugins; diff --git a/types/axios.d.ts b/types/axios.d.ts deleted file mode 100644 index 7d160d7..0000000 --- a/types/axios.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -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 deleted file mode 100644 index 70ec4da..0000000 --- a/types/config.d.ts +++ /dev/null @@ -1,162 +0,0 @@ -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 f0676e9..db7560a 100644 --- a/types/global.d.ts +++ b/types/global.d.ts @@ -10,10 +10,6 @@ declare global { }; lastBuildTime: string; }; - // declare interface Window { - // // Global vue app instance - // __APP__: App; - // } // vue declare type PropType = VuePropType; @@ -52,6 +48,7 @@ declare global { declare interface ViteEnv { VITE_USE_MOCK: Boolean; VITE_USE_ERUDA: Boolean; + VITE_USE_COMPRESS: Boolean; } declare function parseInt(s: string | number, radix?: number): number; diff --git a/types/store.d.ts b/types/store.d.ts deleted file mode 100644 index 2f1e2f7..0000000 --- a/types/store.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -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/vue-router.d.ts b/types/vue-router.d.ts deleted file mode 100644 index 958655c..0000000 --- a/types/vue-router.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -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; - } -}