From e61ee32a88798923a3a444748fbee6e427c07ca7 Mon Sep 17 00:00:00 2001 From: Soybean Date: Sun, 7 Nov 2021 01:23:01 +0800 Subject: [PATCH] =?UTF-8?q?refactor(projects):=20=E6=B7=BB=E5=8A=A0exportD?= =?UTF-8?q?efaults=E6=9B=BF=E6=8D=A2defineProps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/BannerSvg/components/Banner1.vue | 94 ++-- .../common/BannerSvg/components/Banner2.vue | 147 +++---- .../common/BannerSvg/components/Banner3.vue | 400 +++++++++--------- .../common/BannerSvg/components/Banner4.vue | 13 - .../common/BannerSvg/components/index.ts | 3 +- src/components/common/BannerSvg/index.vue | 31 +- .../components/SvgNoPermission.vue | 63 ++- .../ExceptionSvg/components/SvgNotFound.vue | 55 ++- .../components/SvgServiceError.vue | 249 ++++++----- src/components/common/ExceptionSvg/index.vue | 28 +- .../common/HoverContainer/index.vue | 26 +- .../LoginBg/components/CornerBottom.vue | 19 +- .../common/LoginBg/components/CornerTop.vue | 19 +- src/components/common/LoginBg/index.vue | 22 +- .../SystemLogo/components/SvgFillLogo.vue | 25 +- .../common/SystemLogo/components/SvgLogo.vue | 23 +- src/components/common/SystemLogo/index.vue | 25 +- src/components/custom/BetterScroll/index.vue | 18 +- src/components/custom/ButtonTab/index.vue | 43 +- .../ChromeTab/components/SvgRadiusBg.vue | 51 +-- src/components/custom/ChromeTab/index.vue | 39 +- src/components/custom/CountTo/index.vue | 142 +++---- src/components/custom/IconClose/index.vue | 26 +- .../components/GlobalBreadcrumb.vue | 30 +- .../components/GlobalHeader/index.vue | 12 +- .../components/DefaultSider/index.vue | 12 +- .../VerticalMixSider/components/MixMenu.vue | 38 +- .../components/MixMenuDrawer.vue | 20 +- .../components/GlobalSider/index.vue | 12 +- .../components/common/ContextMenu.vue | 42 +- .../components/GlobalTab/index.vue | 12 +- .../components/NavMode/components/NavType.vue | 27 +- .../components/common/ColorBlock.vue | 16 +- .../components/common/SettingMenuItem.vue | 12 +- src/utils/auth/index.ts | 2 +- src/utils/common/color.ts | 10 + src/utils/common/index.ts | 18 +- src/utils/router/cache.ts | 2 +- src/utils/router/index.ts | 6 +- src/utils/router/menus.ts | 2 +- .../DataCard/components/GradientBg.vue | 4 +- src/views/system/login/index.vue | 18 +- 42 files changed, 886 insertions(+), 970 deletions(-) delete mode 100644 src/components/common/BannerSvg/components/Banner4.vue diff --git a/src/components/common/BannerSvg/components/Banner1.vue b/src/components/common/BannerSvg/components/Banner1.vue index 072c892e..5af91ef8 100644 --- a/src/components/common/BannerSvg/components/Banner1.vue +++ b/src/components/common/BannerSvg/components/Banner1.vue @@ -307,7 +307,7 @@ - + + - @@ -550,35 +553,35 @@ > - + diff --git a/src/components/common/BannerSvg/components/Banner2.vue b/src/components/common/BannerSvg/components/Banner2.vue index e03e7e64..4d7e701c 100644 --- a/src/components/common/BannerSvg/components/Banner2.vue +++ b/src/components/common/BannerSvg/components/Banner2.vue @@ -39,7 +39,7 @@ - + - + - + diff --git a/src/components/common/BannerSvg/components/Banner3.vue b/src/components/common/BannerSvg/components/Banner3.vue index 9b185e94..1404f046 100644 --- a/src/components/common/BannerSvg/components/Banner3.vue +++ b/src/components/common/BannerSvg/components/Banner3.vue @@ -31,7 +31,7 @@ - + - + - + @@ -2420,7 +2420,7 @@ > @@ -2450,15 +2450,15 @@ > - + - + diff --git a/src/components/common/BannerSvg/components/Banner4.vue b/src/components/common/BannerSvg/components/Banner4.vue deleted file mode 100644 index bc7610db..00000000 --- a/src/components/common/BannerSvg/components/Banner4.vue +++ /dev/null @@ -1,13 +0,0 @@ - - - - diff --git a/src/components/common/BannerSvg/components/index.ts b/src/components/common/BannerSvg/components/index.ts index 507b24b3..18a6c3f4 100644 --- a/src/components/common/BannerSvg/components/index.ts +++ b/src/components/common/BannerSvg/components/index.ts @@ -1,6 +1,5 @@ import Banner1 from './Banner1.vue'; import Banner2 from './Banner2.vue'; import Banner3 from './Banner3.vue'; -import Banner4 from './Banner4.vue'; -export { Banner1, Banner2, Banner3, Banner4 }; +export { Banner1, Banner2, Banner3 }; diff --git a/src/components/common/BannerSvg/index.vue b/src/components/common/BannerSvg/index.vue index de7919da..27bf6758 100644 --- a/src/components/common/BannerSvg/index.vue +++ b/src/components/common/BannerSvg/index.vue @@ -1,25 +1,24 @@ diff --git a/src/components/common/ExceptionSvg/components/SvgNoPermission.vue b/src/components/common/ExceptionSvg/components/SvgNoPermission.vue index 93613130..854b7760 100644 --- a/src/components/common/ExceptionSvg/components/SvgNoPermission.vue +++ b/src/components/common/ExceptionSvg/components/SvgNoPermission.vue @@ -144,7 +144,7 @@ > @@ -573,7 +573,7 @@ - + - + @@ -714,7 +714,7 @@ > - + - + diff --git a/src/components/common/ExceptionSvg/components/SvgNotFound.vue b/src/components/common/ExceptionSvg/components/SvgNotFound.vue index 1ed48c97..53f921c3 100644 --- a/src/components/common/ExceptionSvg/components/SvgNotFound.vue +++ b/src/components/common/ExceptionSvg/components/SvgNotFound.vue @@ -65,7 +65,7 @@ > - + diff --git a/src/components/common/ExceptionSvg/components/SvgServiceError.vue b/src/components/common/ExceptionSvg/components/SvgServiceError.vue index 5dcdc5c6..f9eee881 100644 --- a/src/components/common/ExceptionSvg/components/SvgServiceError.vue +++ b/src/components/common/ExceptionSvg/components/SvgServiceError.vue @@ -54,11 +54,11 @@ - + @@ -452,7 +452,7 @@ > - + @@ -839,7 +839,7 @@ - + @@ -992,11 +992,11 @@ - + @@ -1237,15 +1237,15 @@ - + diff --git a/src/components/common/ExceptionSvg/index.vue b/src/components/common/ExceptionSvg/index.vue index 18f18b97..c6b790fa 100644 --- a/src/components/common/ExceptionSvg/index.vue +++ b/src/components/common/ExceptionSvg/index.vue @@ -1,24 +1,24 @@ diff --git a/src/components/common/HoverContainer/index.vue b/src/components/common/HoverContainer/index.vue index 980f5db2..3a8b5e41 100644 --- a/src/components/common/HoverContainer/index.vue +++ b/src/components/common/HoverContainer/index.vue @@ -15,23 +15,21 @@ diff --git a/src/components/common/LoginBg/components/CornerBottom.vue b/src/components/common/LoginBg/components/CornerBottom.vue index 8a93286c..b62deb4c 100644 --- a/src/components/common/LoginBg/components/CornerBottom.vue +++ b/src/components/common/LoginBg/components/CornerBottom.vue @@ -25,15 +25,16 @@ diff --git a/src/components/common/LoginBg/components/CornerTop.vue b/src/components/common/LoginBg/components/CornerTop.vue index 35ba2f4a..6b1d6e20 100644 --- a/src/components/common/LoginBg/components/CornerTop.vue +++ b/src/components/common/LoginBg/components/CornerTop.vue @@ -19,15 +19,16 @@ diff --git a/src/components/common/LoginBg/index.vue b/src/components/common/LoginBg/index.vue index f33f2f0c..cd9e8e94 100644 --- a/src/components/common/LoginBg/index.vue +++ b/src/components/common/LoginBg/index.vue @@ -1,27 +1,29 @@ diff --git a/src/components/common/SystemLogo/components/SvgFillLogo.vue b/src/components/common/SystemLogo/components/SvgFillLogo.vue index 21ea0f30..446c8b3a 100644 --- a/src/components/common/SystemLogo/components/SvgFillLogo.vue +++ b/src/components/common/SystemLogo/components/SvgFillLogo.vue @@ -2,41 +2,30 @@ - + diff --git a/src/components/common/SystemLogo/components/SvgLogo.vue b/src/components/common/SystemLogo/components/SvgLogo.vue index e0cc9a51..91b04fa9 100644 --- a/src/components/common/SystemLogo/components/SvgLogo.vue +++ b/src/components/common/SystemLogo/components/SvgLogo.vue @@ -3,41 +3,30 @@ - + diff --git a/src/components/common/SystemLogo/index.vue b/src/components/common/SystemLogo/index.vue index 194c7796..fe137402 100644 --- a/src/components/common/SystemLogo/index.vue +++ b/src/components/common/SystemLogo/index.vue @@ -1,22 +1,23 @@ diff --git a/src/components/custom/BetterScroll/index.vue b/src/components/custom/BetterScroll/index.vue index ef2702b4..cf306e58 100644 --- a/src/components/custom/BetterScroll/index.vue +++ b/src/components/custom/BetterScroll/index.vue @@ -1,28 +1,30 @@ diff --git a/src/components/custom/IconClose/index.vue b/src/components/custom/IconClose/index.vue index dd58a2de..0e24cf1c 100644 --- a/src/components/custom/IconClose/index.vue +++ b/src/components/custom/IconClose/index.vue @@ -15,19 +15,19 @@ diff --git a/src/utils/auth/index.ts b/src/utils/auth/index.ts index 60bc1e91..e5abc856 100644 --- a/src/utils/auth/index.ts +++ b/src/utils/auth/index.ts @@ -1 +1 @@ -export { getToken, setToken, removeToken, getUserInfo, resetAuthStorage } from './user'; +export * from './user'; diff --git a/src/utils/common/color.ts b/src/utils/common/color.ts index 7db6cff2..a4968d15 100644 --- a/src/utils/common/color.ts +++ b/src/utils/common/color.ts @@ -26,3 +26,13 @@ export function darkenColor(color: string, deep: number = 0.5) { export function addColorAlpha(color: string, alpha: number) { return chroma(color).alpha(alpha).hex(); } + +/** + * 颜色混合 + * @param firstColor - 第一个颜色 + * @param secondColor - 第二个颜色 + * @param ratio - 第二个颜色占比 + */ +export function mixColor(firstColor: string, secondColor: string, ratio: number) { + return chroma.mix(firstColor, secondColor, ratio).hex(); +} diff --git a/src/utils/common/index.ts b/src/utils/common/index.ts index fd61f2d5..495ad77b 100644 --- a/src/utils/common/index.ts +++ b/src/utils/common/index.ts @@ -1,17 +1,5 @@ -export { - isNumber, - isString, - isBoolean, - isNull, - isUndefined, - isObject, - isArray, - isDate, - isRegExp, - isSet, - isMap -} from './typeof'; +export * from './typeof'; -export { brightenColor, darkenColor, addColorAlpha } from './color'; +export * from './color'; -export { dynamicIconRender } from './icon'; +export * from './icon'; diff --git a/src/utils/router/cache.ts b/src/utils/router/cache.ts index 359a49e9..462b064c 100644 --- a/src/utils/router/cache.ts +++ b/src/utils/router/cache.ts @@ -25,7 +25,7 @@ function hasChildren(route: RouteRecordRaw) { } /** 获取被缓存的路由 */ -export default function getCacheRoutes(routes: RouteRecordRaw[]) { +export function getCacheRoutes(routes: RouteRecordRaw[]) { const cacheNames: string[] = []; routes.forEach(route => { const isCache = isKeepAlive(route); diff --git a/src/utils/router/index.ts b/src/utils/router/index.ts index 2891391d..b633603a 100644 --- a/src/utils/router/index.ts +++ b/src/utils/router/index.ts @@ -1,3 +1,3 @@ -export { ROUTE_NAME_MAP, setRouterCacheName, getLoginRedirectUrl, setSingleRoute } from './helpers'; -export { default as getCacheRoutes } from './cache'; -export { default as transformRouteToMenu } from './menus'; +export * from './helpers'; +export * from './cache'; +export * from './menus'; diff --git a/src/utils/router/menus.ts b/src/utils/router/menus.ts index 6f134b1e..1371b24c 100644 --- a/src/utils/router/menus.ts +++ b/src/utils/router/menus.ts @@ -19,7 +19,7 @@ function addPartialProps(menuItem: GlobalMenuOption, icon?: Component, children? return item; } -export default function transformRouteToMenu(routes: CustomRoute[]) { +export function transformRouteToMenu(routes: CustomRoute[]) { const globalMenu: GlobalMenuOption[] = []; routes.forEach(route => { const { name, path, meta } = route; diff --git a/src/views/dashboard/analysis/components/DataCard/components/GradientBg.vue b/src/views/dashboard/analysis/components/DataCard/components/GradientBg.vue index f3bc0dd4..82972956 100644 --- a/src/views/dashboard/analysis/components/DataCard/components/GradientBg.vue +++ b/src/views/dashboard/analysis/components/DataCard/components/GradientBg.vue @@ -9,9 +9,9 @@ import { computed } from 'vue'; interface Props { /** 渐变开始的颜色 */ - startColor: string; + startColor?: string; /** 渐变结束的颜色 */ - endColor: string; + endColor?: string; } const props = withDefaults(defineProps(), { diff --git a/src/views/system/login/index.vue b/src/views/system/login/index.vue index 98c2da3d..e7697dd6 100644 --- a/src/views/system/login/index.vue +++ b/src/views/system/login/index.vue @@ -22,27 +22,29 @@