From b95de96257d2779e65c0523aac33c2b82e57ae4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=82=A0=E9=9D=99=E8=90=9D=E8=8E=89?= Date: Wed, 22 Jun 2022 19:29:19 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E8=BF=81=E7=A7=BB=E5=8E=9F=E6=9C=89?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=B9=B6=E4=BF=AE=E6=94=B9=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E6=8C=87=E5=90=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/components/Header.vue | 2 +- src/layouts/components/MenuContent.tsx | 2 +- src/layouts/components/Notice.vue | 2 +- src/layouts/index.tsx | 2 +- src/pages/detail/advanced/index.vue | 2 +- src/pages/detail/deploy/index.vue | 2 +- src/pages/detail/secondary/index.vue | 2 +- src/pages/list/base/index.vue | 2 +- src/pages/list/card/index.vue | 2 +- src/pages/list/components/CommonTable.vue | 2 +- src/store/modules/notification.ts | 2 +- src/store/modules/tabs-router.ts | 2 +- src/utils/charts.ts | 2 +- src/utils/color.ts | 6 +++--- globals.d.ts => types/globals.d.ts | 10 +++++++++- src/interface.ts => types/interface.d.ts | 0 16 files changed, 25 insertions(+), 17 deletions(-) rename globals.d.ts => types/globals.d.ts (66%) rename src/interface.ts => types/interface.d.ts (100%) diff --git a/src/layouts/components/Header.vue b/src/layouts/components/Header.vue index 2fcd338..274ff6b 100644 --- a/src/layouts/components/Header.vue +++ b/src/layouts/components/Header.vue @@ -70,7 +70,7 @@ import { useSettingStore } from '@/store'; import { getActive } from '@/router'; import { prefix } from '@/config/global'; import LogoFull from '@/assets/assets-logo-full.svg?component'; -import { MenuRoute } from '@/interface'; +import { MenuRoute } from '#/interface'; import Notice from './Notice.vue'; import Search from './Search.vue'; diff --git a/src/layouts/components/MenuContent.tsx b/src/layouts/components/MenuContent.tsx index f2eeb76..f721182 100755 --- a/src/layouts/components/MenuContent.tsx +++ b/src/layouts/components/MenuContent.tsx @@ -1,6 +1,6 @@ import { defineComponent, PropType, computed, h } from 'vue'; import { prefix } from '@/config/global'; -import { MenuRoute } from '@/interface'; +import { MenuRoute } from '#/interface'; import { getActive } from '@/router'; const getMenuList = (list: MenuRoute[], basePath?: string): MenuRoute[] => { diff --git a/src/layouts/components/Notice.vue b/src/layouts/components/Notice.vue index 4007a0a..51376c6 100644 --- a/src/layouts/components/Notice.vue +++ b/src/layouts/components/Notice.vue @@ -49,7 +49,7 @@ import { useRouter } from 'vue-router'; import { storeToRefs } from 'pinia'; import { useNotificationStore } from '@/store'; -import { NotificationItem } from '@/interface'; +import { NotificationItem } from '#/interface'; const router = useRouter(); const store = useNotificationStore(); diff --git a/src/layouts/index.tsx b/src/layouts/index.tsx index 74a798e..019f663 100644 --- a/src/layouts/index.tsx +++ b/src/layouts/index.tsx @@ -11,7 +11,7 @@ import LayoutContent from './components/Content.vue'; import Setting from './setting.vue'; import { prefix } from '@/config/global'; -import { TRouterInfo } from '@/interface'; +import { TRouterInfo } from '#/interface'; import '@/style/layout.less'; diff --git a/src/pages/detail/advanced/index.vue b/src/pages/detail/advanced/index.vue index 6b41596..bb73989 100644 --- a/src/pages/detail/advanced/index.vue +++ b/src/pages/detail/advanced/index.vue @@ -121,7 +121,7 @@ import { ref, onMounted } from 'vue'; import { prefix } from '@/config/global'; import { BASE_INFO_DATA, TABLE_COLUMNS_DATA as columns, PRODUCT_LIST } from './constants'; import request from '@/utils/request'; -import { ResDataType } from '@/interface'; +import { ResDataType } from '#/interface'; import Product from './components/Product.vue'; diff --git a/src/pages/detail/deploy/index.vue b/src/pages/detail/deploy/index.vue index db98147..510a848 100644 --- a/src/pages/detail/deploy/index.vue +++ b/src/pages/detail/deploy/index.vue @@ -89,7 +89,7 @@ import { BASE_INFO_DATA, TABLE_COLUMNS as columns } from './constants'; import { changeChartsTheme } from '@/utils/color'; import { prefix } from '@/config/global'; -import { ResDataType } from '@/interface'; +import { ResDataType } from '#/interface'; import request from '@/utils/request'; echarts.use([ diff --git a/src/pages/detail/secondary/index.vue b/src/pages/detail/secondary/index.vue index 517eb2e..e5bc9dc 100644 --- a/src/pages/detail/secondary/index.vue +++ b/src/pages/detail/secondary/index.vue @@ -60,7 +60,7 @@ export default { import { ref, computed } from 'vue'; import { storeToRefs } from 'pinia'; import { NOTIFICATION_TYPES } from '@/constants'; -import { NotificationItem } from '@/interface'; +import { NotificationItem } from '#/interface'; import EmptyIcon from '@/assets/assets-empty.svg?component'; import { useNotificationStore } from '@/store'; diff --git a/src/pages/list/base/index.vue b/src/pages/list/base/index.vue index 07fd182..8da8cb0 100644 --- a/src/pages/list/base/index.vue +++ b/src/pages/list/base/index.vue @@ -82,7 +82,7 @@ import { MessagePlugin } from 'tdesign-vue-next'; import { CONTRACT_STATUS, CONTRACT_TYPES, CONTRACT_PAYMENT_TYPES } from '@/constants'; import Trend from '@/components/trend/index.vue'; -import { ResDataType } from '@/interface'; +import { ResDataType } from '#/interface'; import request from '@/utils/request'; import { useSettingStore } from '@/store'; diff --git a/src/pages/list/card/index.vue b/src/pages/list/card/index.vue index a748a90..63255eb 100644 --- a/src/pages/list/card/index.vue +++ b/src/pages/list/card/index.vue @@ -74,7 +74,7 @@ import { MessagePlugin } from 'tdesign-vue-next'; import ProductCard from '@/components/product-card/index.vue'; import DialogForm from './components/DialogForm.vue'; import request from '@/utils/request'; -import { ResDataType } from '@/interface'; +import { ResDataType } from '#/interface'; const INITIAL_DATA = { name: '', diff --git a/src/pages/list/components/CommonTable.vue b/src/pages/list/components/CommonTable.vue index 7bd93ca..3bc1825 100644 --- a/src/pages/list/components/CommonTable.vue +++ b/src/pages/list/components/CommonTable.vue @@ -118,7 +118,7 @@ import { ref, computed, onMounted } from 'vue'; import { MessagePlugin } from 'tdesign-vue-next'; import Trend from '@/components/trend/index.vue'; import request from '@/utils/request'; -import { ResDataType } from '@/interface'; +import { ResDataType } from '#/interface'; import { useSettingStore } from '@/store'; import { diff --git a/src/store/modules/notification.ts b/src/store/modules/notification.ts index 7574d34..c7c530c 100644 --- a/src/store/modules/notification.ts +++ b/src/store/modules/notification.ts @@ -1,5 +1,5 @@ import { defineStore } from 'pinia'; -import { NotificationItem } from '@/interface'; +import { NotificationItem } from '#/interface'; const msgData = [ { diff --git a/src/store/modules/tabs-router.ts b/src/store/modules/tabs-router.ts index 5e8a393..f237654 100644 --- a/src/store/modules/tabs-router.ts +++ b/src/store/modules/tabs-router.ts @@ -1,5 +1,5 @@ import { defineStore } from 'pinia'; -import { TRouterInfo, TTabRouterType } from '@/interface'; +import { TRouterInfo, TTabRouterType } from '#/interface'; import { store } from '@/store'; const homeRoute: Array = [ diff --git a/src/utils/charts.ts b/src/utils/charts.ts index b28162d..93afaa8 100644 --- a/src/utils/charts.ts +++ b/src/utils/charts.ts @@ -29,7 +29,7 @@ export function getDateArray(dateTime: string[] = [], divideNum = 10): string[] * * @memberOf DashboardBase */ -export function getRandomArray(num = 100) { +export function getRandomArray(num = 100): number { let resultNum = Number((Math.random() * num).toFixed(0)); if (resultNum <= 1) { diff --git a/src/utils/color.ts b/src/utils/color.ts index f5c7632..602b37e 100644 --- a/src/utils/color.ts +++ b/src/utils/color.ts @@ -10,11 +10,11 @@ import { getSettingStore } from '@/store'; * @param {string} theme * @returns {} */ -export function getColorFromTheme(theme: string) { +export function getColorFromTheme(theme: string): Array { const settingStore = getSettingStore(); const { colorList, mode } = settingStore; const isDarkMode = mode === 'dark'; - let themeColorList = []; + let themeColorList; const themeColor = getBrandColor(theme, colorList); if (!/^#[A-F\d]{6}$/i.test(theme)) { @@ -52,7 +52,7 @@ export function getChartListColor(): Array { * @param {Array} chartsList * @param {string} theme */ -export function changeChartsTheme(chartsList: echarts.EChartsType[]) { +export function changeChartsTheme(chartsList: echarts.EChartsType[]): void { if (chartsList && chartsList.length) { const chartChangeColor = getChartListColor(); diff --git a/globals.d.ts b/types/globals.d.ts similarity index 66% rename from globals.d.ts rename to types/globals.d.ts index 743a703..048a228 100644 --- a/globals.d.ts +++ b/types/globals.d.ts @@ -1,11 +1,19 @@ // 通用声明 + +// Vue +declare module '*.vue' { + import { DefineComponent } from 'vue'; + + const component: DefineComponent<{}, {}, any>; + export default component; +} + declare type ClassName = { [className: string]: any } | ClassName[] | string; declare interface ImportMeta { env: { MODE: 'mock' | 'development' | 'test' | 'release'; }; - // eslint-disable-next-line no-unused-vars glob: (url: string) => { url }; } diff --git a/src/interface.ts b/types/interface.d.ts similarity index 100% rename from src/interface.ts rename to types/interface.d.ts