Commit f7aa93f5b0e40394ba813675f97f730c99999e32
1 parent
814f9a7a
chore: miscellaneous modifications
Showing
18 changed files
with
33 additions
and
37 deletions
package.json
src/hooks/core/useSetting.ts
... | ... | @@ -20,7 +20,9 @@ const { |
20 | 20 | } = ENV; |
21 | 21 | |
22 | 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 | 28 | export const useSetting = (): SettingWrap => { | ... | ... |
src/router/index.ts
... | ... | @@ -18,11 +18,7 @@ const router = createRouter({ |
18 | 18 | |
19 | 19 | // reset router |
20 | 20 | export function resetRouter() { |
21 | - const resetWhiteNameList = [ | |
22 | - 'Login', | |
23 | - 'Root', | |
24 | - // 'FullErrorPage' | |
25 | - ]; | |
21 | + const resetWhiteNameList = ['Login', 'Root']; | |
26 | 22 | router.getRoutes().forEach((route) => { |
27 | 23 | const { name } = route; |
28 | 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 | 81 | public async setPageLoadingAction(loading: boolean): Promise<void> { |
82 | 82 | if (loading) { |
83 | 83 | clearTimeout(timeId); |
84 | - // 防止闪动 | |
84 | + // Prevent flicker | |
85 | 85 | timeId = setTimeout(() => { |
86 | 86 | this.commitPageLoadingState(loading); |
87 | 87 | }, 100); |
... | ... | @@ -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 | 97 | @Action |
98 | 98 | public async unLockAction({ password, valid = true }: { password: string; valid?: boolean }) { |
99 | 99 | if (!valid) { |
... | ... | @@ -125,5 +125,4 @@ class App extends VuexModule { |
125 | 125 | return res; |
126 | 126 | } |
127 | 127 | } |
128 | -export { App }; | |
129 | 128 | export const appStore = getModule<App>(App); | ... | ... |
src/store/modules/error.ts
src/store/modules/menu.ts
src/store/modules/permission.ts
src/store/modules/tab.ts
... | ... | @@ -15,6 +15,7 @@ import { PAGE_NOT_FOUND_ROUTE, REDIRECT_ROUTE } from '/@/router/constant'; |
15 | 15 | import { getCurrentTo } from '/@/utils/helper/routeHelper'; |
16 | 16 | |
17 | 17 | type CacheName = string | symbol | null | undefined; |
18 | + | |
18 | 19 | /** |
19 | 20 | * @description: vuex Tab模块 |
20 | 21 | */ |
... | ... | @@ -29,6 +30,7 @@ export interface TabItem { |
29 | 30 | } |
30 | 31 | |
31 | 32 | const NAME = 'tab'; |
33 | + | |
32 | 34 | hotModuleUnregisterModule(NAME); |
33 | 35 | |
34 | 36 | const getOpenKeepAliveRef = computed(() => appStore.getProjectConfig.openKeepAlive); |
... | ... | @@ -252,5 +254,4 @@ class Tab extends VuexModule { |
252 | 254 | this.closeMultipleTab({ pathList, nameList }); |
253 | 255 | } |
254 | 256 | } |
255 | -export { Tab }; | |
256 | 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 | 138 | key: T, |
139 | 139 | value: ProjectConfig[T] |
140 | 140 | ) => void; |
141 | + | |
141 | 142 | interface GlobWrap { |
142 | 143 | globSetting: Readonly<GlobConfig>; |
143 | 144 | } |
145 | + | |
144 | 146 | interface ProjectSettingWrap { |
145 | 147 | projectSetting: Readonly<ProjectConfig>; |
146 | 148 | } | ... | ... |
src/types/global.d.ts
... | ... | @@ -37,6 +37,12 @@ declare type DeepPartial<T> = { |
37 | 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 | 46 | declare type LabelValueOptions = { |
41 | 47 | label: string; |
42 | 48 | value: any; | ... | ... |
src/types/shim-tsx.d.ts
... | ... | @@ -13,21 +13,13 @@ declare global { |
13 | 13 | // tslint:disable no-empty-interface |
14 | 14 | type ElementClass = ComponentRenderProxy; |
15 | 15 | interface ElementAttributesProperty { |
16 | - $props: any; // 定义要使用的属性名称 | |
16 | + $props: any; | |
17 | 17 | } |
18 | 18 | interface IntrinsicElements { |
19 | 19 | [elem: string]: any; |
20 | 20 | } |
21 | 21 | interface IntrinsicAttributes { |
22 | - // ['v-if']?: unknown; | |
23 | - // ['v-else-if']?: unknown; | |
24 | - // ['v-else']?: unknown; | |
25 | - // need | |
26 | - // ['v-show']?: unknown; | |
27 | 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 | 7 | const ss = createStorage(); |
8 | 8 | |
9 | 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 | 25 | cacheStore.local = ls.get(BASE_LOCAL_CACHE_KEY) || {}; |
26 | 26 | cacheStore.session = ss.get(BASE_SESSION_CACHE_KEY) || {}; |
27 | 27 | } |
28 | + | |
28 | 29 | initCache(); |
29 | 30 | |
30 | 31 | export function setLocal(key: string, value: any, immediate = false) { |
31 | 32 | cacheStore.local[BASE_LOCAL_CACHE_KEY] = cacheStore.local[BASE_LOCAL_CACHE_KEY] || {}; |
32 | 33 | cacheStore.local[BASE_LOCAL_CACHE_KEY][key] = value; |
33 | 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 | 43 | return null; |
44 | 44 | } |
45 | 45 | } |
46 | + | |
46 | 47 | export function removeLocal(key: string) { |
47 | 48 | if (cacheStore.local[BASE_LOCAL_CACHE_KEY]) { |
48 | 49 | Reflect.deleteProperty(cacheStore.local[BASE_LOCAL_CACHE_KEY], key); |
... | ... | @@ -91,8 +92,6 @@ export function clearAll() { |
91 | 92 | const localCache = cacheStore.local; |
92 | 93 | const sessionCache = cacheStore.session; |
93 | 94 | |
94 | - // const ss = createStorage(); | |
95 | - | |
96 | 95 | ls.set(BASE_LOCAL_CACHE_KEY, localCache); |
97 | 96 | ss.set(BASE_SESSION_CACHE_KEY, sessionCache); |
98 | 97 | }); |
... | ... | @@ -114,6 +113,7 @@ export function clearAll() { |
114 | 113 | } |
115 | 114 | } |
116 | 115 | } |
116 | + | |
117 | 117 | if (isIeFn() && (document as any).attachEvent) { |
118 | 118 | (document as any).attachEvent('onstorage', storageChange); |
119 | 119 | } else { | ... | ... |
src/utils/helper/treeHelper.ts
... | ... | @@ -158,6 +158,7 @@ export function forEach<T = any>( |
158 | 158 | export function treeMap(treeData: any[], opt: { children?: string; conversion: Fn }) { |
159 | 159 | return treeData.map((item) => treeMapEach(item, opt)); |
160 | 160 | } |
161 | + | |
161 | 162 | /** |
162 | 163 | * @description: 提取tree指定结构 |
163 | 164 | */ | ... | ... |
yarn.lock
... | ... | @@ -6343,10 +6343,10 @@ prettier-linter-helpers@^1.0.0: |
6343 | 6343 | dependencies: |
6344 | 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 | 6351 | pretty-bytes@^5.3.0: |
6352 | 6352 | version "5.4.1" | ... | ... |