Commit f7aa93f5b0e40394ba813675f97f730c99999e32
1 parent
814f9a7a
chore: miscellaneous modifications
Showing
18 changed files
with
33 additions
and
37 deletions
package.json
@@ -84,7 +84,7 @@ | @@ -84,7 +84,7 @@ | ||
84 | "lint-staged": "^10.5.1", | 84 | "lint-staged": "^10.5.1", |
85 | "portfinder": "^1.0.28", | 85 | "portfinder": "^1.0.28", |
86 | "postcss-import": "^12.0.1", | 86 | "postcss-import": "^12.0.1", |
87 | - "prettier": "^2.1.2", | 87 | + "prettier": "^2.2.0", |
88 | "rimraf": "^3.0.2", | 88 | "rimraf": "^3.0.2", |
89 | "rollup-plugin-visualizer": "^4.1.2", | 89 | "rollup-plugin-visualizer": "^4.1.2", |
90 | "stylelint": "^13.8.0", | 90 | "stylelint": "^13.8.0", |
src/hooks/core/useSetting.ts
@@ -20,7 +20,9 @@ const { | @@ -20,7 +20,9 @@ const { | ||
20 | } = ENV; | 20 | } = ENV; |
21 | 21 | ||
22 | if (!reg.test(VITE_GLOB_APP_SHORT_NAME)) { | 22 | if (!reg.test(VITE_GLOB_APP_SHORT_NAME)) { |
23 | - warn(`VITE_GLOB_APP_SHORT_NAME 变量只能是字符/下划线,请在环境变量中修改并重新运行。`); | 23 | + warn( |
24 | + `VITE_GLOB_APP_SHORT_NAME Variables can only be characters/underscores, please modify in the environment variables and re-running.` | ||
25 | + ); | ||
24 | } | 26 | } |
25 | 27 | ||
26 | export const useSetting = (): SettingWrap => { | 28 | export const useSetting = (): SettingWrap => { |
src/router/index.ts
@@ -18,11 +18,7 @@ const router = createRouter({ | @@ -18,11 +18,7 @@ const router = createRouter({ | ||
18 | 18 | ||
19 | // reset router | 19 | // reset router |
20 | export function resetRouter() { | 20 | export function resetRouter() { |
21 | - const resetWhiteNameList = [ | ||
22 | - 'Login', | ||
23 | - 'Root', | ||
24 | - // 'FullErrorPage' | ||
25 | - ]; | 21 | + const resetWhiteNameList = ['Login', 'Root']; |
26 | router.getRoutes().forEach((route) => { | 22 | router.getRoutes().forEach((route) => { |
27 | const { name } = route; | 23 | const { name } = route; |
28 | if (name && !resetWhiteNameList.includes(name as string)) { | 24 | if (name && !resetWhiteNameList.includes(name as string)) { |
src/router/types.d.ts
src/store/modules/app.ts
@@ -81,7 +81,7 @@ class App extends VuexModule { | @@ -81,7 +81,7 @@ class App extends VuexModule { | ||
81 | public async setPageLoadingAction(loading: boolean): Promise<void> { | 81 | public async setPageLoadingAction(loading: boolean): Promise<void> { |
82 | if (loading) { | 82 | if (loading) { |
83 | clearTimeout(timeId); | 83 | clearTimeout(timeId); |
84 | - // 防止闪动 | 84 | + // Prevent flicker |
85 | timeId = setTimeout(() => { | 85 | timeId = setTimeout(() => { |
86 | this.commitPageLoadingState(loading); | 86 | this.commitPageLoadingState(loading); |
87 | }, 100); | 87 | }, 100); |
@@ -91,9 +91,9 @@ class App extends VuexModule { | @@ -91,9 +91,9 @@ class App extends VuexModule { | ||
91 | } | 91 | } |
92 | } | 92 | } |
93 | 93 | ||
94 | - // /** | ||
95 | - // * @description: unlock page | ||
96 | - // */ | 94 | + /** |
95 | + * @description: unlock page | ||
96 | + */ | ||
97 | @Action | 97 | @Action |
98 | public async unLockAction({ password, valid = true }: { password: string; valid?: boolean }) { | 98 | public async unLockAction({ password, valid = true }: { password: string; valid?: boolean }) { |
99 | if (!valid) { | 99 | if (!valid) { |
@@ -125,5 +125,4 @@ class App extends VuexModule { | @@ -125,5 +125,4 @@ class App extends VuexModule { | ||
125 | return res; | 125 | return res; |
126 | } | 126 | } |
127 | } | 127 | } |
128 | -export { App }; | ||
129 | export const appStore = getModule<App>(App); | 128 | export const appStore = getModule<App>(App); |
src/store/modules/error.ts
@@ -78,5 +78,4 @@ class Error extends VuexModule implements ErrorState { | @@ -78,5 +78,4 @@ class Error extends VuexModule implements ErrorState { | ||
78 | this.commitErrorInfoState(errInfo as ErrorInfo); | 78 | this.commitErrorInfoState(errInfo as ErrorInfo); |
79 | } | 79 | } |
80 | } | 80 | } |
81 | -export { Error }; | ||
82 | export const errorStore = getModule<Error>(Error); | 81 | export const errorStore = getModule<Error>(Error); |
src/store/modules/menu.ts
src/store/modules/permission.ts
@@ -128,5 +128,4 @@ class Permission extends VuexModule { | @@ -128,5 +128,4 @@ class Permission extends VuexModule { | ||
128 | return routes; | 128 | return routes; |
129 | } | 129 | } |
130 | } | 130 | } |
131 | -export { Permission }; | ||
132 | export const permissionStore = getModule<Permission>(Permission); | 131 | export const permissionStore = getModule<Permission>(Permission); |
src/store/modules/tab.ts
@@ -15,6 +15,7 @@ import { PAGE_NOT_FOUND_ROUTE, REDIRECT_ROUTE } from '/@/router/constant'; | @@ -15,6 +15,7 @@ import { PAGE_NOT_FOUND_ROUTE, REDIRECT_ROUTE } from '/@/router/constant'; | ||
15 | import { getCurrentTo } from '/@/utils/helper/routeHelper'; | 15 | import { getCurrentTo } from '/@/utils/helper/routeHelper'; |
16 | 16 | ||
17 | type CacheName = string | symbol | null | undefined; | 17 | type CacheName = string | symbol | null | undefined; |
18 | + | ||
18 | /** | 19 | /** |
19 | * @description: vuex Tab模块 | 20 | * @description: vuex Tab模块 |
20 | */ | 21 | */ |
@@ -29,6 +30,7 @@ export interface TabItem { | @@ -29,6 +30,7 @@ export interface TabItem { | ||
29 | } | 30 | } |
30 | 31 | ||
31 | const NAME = 'tab'; | 32 | const NAME = 'tab'; |
33 | + | ||
32 | hotModuleUnregisterModule(NAME); | 34 | hotModuleUnregisterModule(NAME); |
33 | 35 | ||
34 | const getOpenKeepAliveRef = computed(() => appStore.getProjectConfig.openKeepAlive); | 36 | const getOpenKeepAliveRef = computed(() => appStore.getProjectConfig.openKeepAlive); |
@@ -252,5 +254,4 @@ class Tab extends VuexModule { | @@ -252,5 +254,4 @@ class Tab extends VuexModule { | ||
252 | this.closeMultipleTab({ pathList, nameList }); | 254 | this.closeMultipleTab({ pathList, nameList }); |
253 | } | 255 | } |
254 | } | 256 | } |
255 | -export { Tab }; | ||
256 | export const tabStore = getModule<Tab>(Tab); | 257 | export const tabStore = getModule<Tab>(Tab); |
src/store/modules/user.ts
src/types/config.d.ts
@@ -138,9 +138,11 @@ export type SetProjectSettingFn = <T extends keyof ProjectConfig>( | @@ -138,9 +138,11 @@ export type SetProjectSettingFn = <T extends keyof ProjectConfig>( | ||
138 | key: T, | 138 | key: T, |
139 | value: ProjectConfig[T] | 139 | value: ProjectConfig[T] |
140 | ) => void; | 140 | ) => void; |
141 | + | ||
141 | interface GlobWrap { | 142 | interface GlobWrap { |
142 | globSetting: Readonly<GlobConfig>; | 143 | globSetting: Readonly<GlobConfig>; |
143 | } | 144 | } |
145 | + | ||
144 | interface ProjectSettingWrap { | 146 | interface ProjectSettingWrap { |
145 | projectSetting: Readonly<ProjectConfig>; | 147 | projectSetting: Readonly<ProjectConfig>; |
146 | } | 148 | } |
src/types/global.d.ts
@@ -37,6 +37,12 @@ declare type DeepPartial<T> = { | @@ -37,6 +37,12 @@ declare type DeepPartial<T> = { | ||
37 | [P in keyof T]?: DeepPartial<T[P]>; | 37 | [P in keyof T]?: DeepPartial<T[P]>; |
38 | }; | 38 | }; |
39 | 39 | ||
40 | +// type DeepPartial<T> = T extends Function | ||
41 | +// ? T | ||
42 | +// : T extends object | ||
43 | +// ? { [K in keyof T]?: DeepPartial<T[K]> } | ||
44 | +// : T; | ||
45 | + | ||
40 | declare type LabelValueOptions = { | 46 | declare type LabelValueOptions = { |
41 | label: string; | 47 | label: string; |
42 | value: any; | 48 | value: any; |
src/types/shim-tsx.d.ts
@@ -13,21 +13,13 @@ declare global { | @@ -13,21 +13,13 @@ declare global { | ||
13 | // tslint:disable no-empty-interface | 13 | // tslint:disable no-empty-interface |
14 | type ElementClass = ComponentRenderProxy; | 14 | type ElementClass = ComponentRenderProxy; |
15 | interface ElementAttributesProperty { | 15 | interface ElementAttributesProperty { |
16 | - $props: any; // 定义要使用的属性名称 | 16 | + $props: any; |
17 | } | 17 | } |
18 | interface IntrinsicElements { | 18 | interface IntrinsicElements { |
19 | [elem: string]: any; | 19 | [elem: string]: any; |
20 | } | 20 | } |
21 | interface IntrinsicAttributes { | 21 | interface IntrinsicAttributes { |
22 | - // ['v-if']?: unknown; | ||
23 | - // ['v-else-if']?: unknown; | ||
24 | - // ['v-else']?: unknown; | ||
25 | - // need | ||
26 | - // ['v-show']?: unknown; | ||
27 | [elem: string]: any; | 22 | [elem: string]: any; |
28 | - // ['v-html']?: unknown; | ||
29 | - // ['v-text']?: unknown; | ||
30 | - // ['v-model']?: unknown; | ||
31 | } | 23 | } |
32 | } | 24 | } |
33 | } | 25 | } |
src/utils/file/stream.ts renamed to src/utils/file/base64.ts
src/utils/file/download.ts
src/utils/helper/persistent.ts
@@ -7,8 +7,8 @@ const ls = createStorage(localStorage); | @@ -7,8 +7,8 @@ const ls = createStorage(localStorage); | ||
7 | const ss = createStorage(); | 7 | const ss = createStorage(); |
8 | 8 | ||
9 | interface CacheStore { | 9 | interface CacheStore { |
10 | - local?: any; | ||
11 | - session?: any; | 10 | + local: Record<string, any>; |
11 | + session: Record<string, any>; | ||
12 | } | 12 | } |
13 | 13 | ||
14 | /** | 14 | /** |
@@ -25,14 +25,14 @@ function initCache() { | @@ -25,14 +25,14 @@ function initCache() { | ||
25 | cacheStore.local = ls.get(BASE_LOCAL_CACHE_KEY) || {}; | 25 | cacheStore.local = ls.get(BASE_LOCAL_CACHE_KEY) || {}; |
26 | cacheStore.session = ss.get(BASE_SESSION_CACHE_KEY) || {}; | 26 | cacheStore.session = ss.get(BASE_SESSION_CACHE_KEY) || {}; |
27 | } | 27 | } |
28 | + | ||
28 | initCache(); | 29 | initCache(); |
29 | 30 | ||
30 | export function setLocal(key: string, value: any, immediate = false) { | 31 | export function setLocal(key: string, value: any, immediate = false) { |
31 | cacheStore.local[BASE_LOCAL_CACHE_KEY] = cacheStore.local[BASE_LOCAL_CACHE_KEY] || {}; | 32 | cacheStore.local[BASE_LOCAL_CACHE_KEY] = cacheStore.local[BASE_LOCAL_CACHE_KEY] || {}; |
32 | cacheStore.local[BASE_LOCAL_CACHE_KEY][key] = value; | 33 | cacheStore.local[BASE_LOCAL_CACHE_KEY][key] = value; |
33 | if (immediate) { | 34 | if (immediate) { |
34 | - const localCache = cacheStore.local; | ||
35 | - ls.set(BASE_LOCAL_CACHE_KEY, localCache); | 35 | + ls.set(BASE_LOCAL_CACHE_KEY, cacheStore.local); |
36 | } | 36 | } |
37 | } | 37 | } |
38 | 38 | ||
@@ -43,6 +43,7 @@ export function getLocal<T>(key: string): T | null { | @@ -43,6 +43,7 @@ export function getLocal<T>(key: string): T | null { | ||
43 | return null; | 43 | return null; |
44 | } | 44 | } |
45 | } | 45 | } |
46 | + | ||
46 | export function removeLocal(key: string) { | 47 | export function removeLocal(key: string) { |
47 | if (cacheStore.local[BASE_LOCAL_CACHE_KEY]) { | 48 | if (cacheStore.local[BASE_LOCAL_CACHE_KEY]) { |
48 | Reflect.deleteProperty(cacheStore.local[BASE_LOCAL_CACHE_KEY], key); | 49 | Reflect.deleteProperty(cacheStore.local[BASE_LOCAL_CACHE_KEY], key); |
@@ -91,8 +92,6 @@ export function clearAll() { | @@ -91,8 +92,6 @@ export function clearAll() { | ||
91 | const localCache = cacheStore.local; | 92 | const localCache = cacheStore.local; |
92 | const sessionCache = cacheStore.session; | 93 | const sessionCache = cacheStore.session; |
93 | 94 | ||
94 | - // const ss = createStorage(); | ||
95 | - | ||
96 | ls.set(BASE_LOCAL_CACHE_KEY, localCache); | 95 | ls.set(BASE_LOCAL_CACHE_KEY, localCache); |
97 | ss.set(BASE_SESSION_CACHE_KEY, sessionCache); | 96 | ss.set(BASE_SESSION_CACHE_KEY, sessionCache); |
98 | }); | 97 | }); |
@@ -114,6 +113,7 @@ export function clearAll() { | @@ -114,6 +113,7 @@ export function clearAll() { | ||
114 | } | 113 | } |
115 | } | 114 | } |
116 | } | 115 | } |
116 | + | ||
117 | if (isIeFn() && (document as any).attachEvent) { | 117 | if (isIeFn() && (document as any).attachEvent) { |
118 | (document as any).attachEvent('onstorage', storageChange); | 118 | (document as any).attachEvent('onstorage', storageChange); |
119 | } else { | 119 | } else { |
src/utils/helper/treeHelper.ts
@@ -158,6 +158,7 @@ export function forEach<T = any>( | @@ -158,6 +158,7 @@ export function forEach<T = any>( | ||
158 | export function treeMap(treeData: any[], opt: { children?: string; conversion: Fn }) { | 158 | export function treeMap(treeData: any[], opt: { children?: string; conversion: Fn }) { |
159 | return treeData.map((item) => treeMapEach(item, opt)); | 159 | return treeData.map((item) => treeMapEach(item, opt)); |
160 | } | 160 | } |
161 | + | ||
161 | /** | 162 | /** |
162 | * @description: 提取tree指定结构 | 163 | * @description: 提取tree指定结构 |
163 | */ | 164 | */ |
yarn.lock
@@ -6343,10 +6343,10 @@ prettier-linter-helpers@^1.0.0: | @@ -6343,10 +6343,10 @@ prettier-linter-helpers@^1.0.0: | ||
6343 | dependencies: | 6343 | dependencies: |
6344 | fast-diff "^1.1.2" | 6344 | fast-diff "^1.1.2" |
6345 | 6345 | ||
6346 | -prettier@^2.1.2: | ||
6347 | - version "2.1.2" | ||
6348 | - resolved "https://registry.npmjs.org/prettier/-/prettier-2.1.2.tgz#3050700dae2e4c8b67c4c3f666cdb8af405e1ce5" | ||
6349 | - integrity sha512-16c7K+x4qVlJg9rEbXl7HEGmQyZlG4R9AgP+oHKRMsMsuk8s+ATStlf1NpDqyBI1HpVyfjLOeMhH2LvuNvV5Vg== | 6346 | +prettier@^2.2.0: |
6347 | + version "2.2.0" | ||
6348 | + resolved "https://registry.npmjs.org/prettier/-/prettier-2.2.0.tgz#8a03c7777883b29b37fb2c4348c66a78e980418b" | ||
6349 | + integrity sha512-yYerpkvseM4iKD/BXLYUkQV5aKt4tQPqaGW6EsZjzyu0r7sVZZNPJW4Y8MyKmicp6t42XUPcBVA+H6sB3gqndw== | ||
6350 | 6350 | ||
6351 | pretty-bytes@^5.3.0: | 6351 | pretty-bytes@^5.3.0: |
6352 | version "5.4.1" | 6352 | version "5.4.1" |