提交 f7aa93f5 编写于 作者: V vben

chore: miscellaneous modifications

上级 814f9a7a
...@@ -20,7 +20,9 @@ const { ...@@ -20,7 +20,9 @@ const {
} = ENV; } = ENV;
if (!reg.test(VITE_GLOB_APP_SHORT_NAME)) { if (!reg.test(VITE_GLOB_APP_SHORT_NAME)) {
warn(`VITE_GLOB_APP_SHORT_NAME 变量只能是字符/下划线,请在环境变量中修改并重新运行。`); warn(
`VITE_GLOB_APP_SHORT_NAME Variables can only be characters/underscores, please modify in the environment variables and re-running.`
);
} }
export const useSetting = (): SettingWrap => { export const useSetting = (): SettingWrap => {
......
...@@ -18,11 +18,7 @@ const router = createRouter({ ...@@ -18,11 +18,7 @@ const router = createRouter({
// reset router // reset router
export function resetRouter() { export function resetRouter() {
const resetWhiteNameList = [ const resetWhiteNameList = ['Login', 'Root'];
'Login',
'Root',
// 'FullErrorPage'
];
router.getRoutes().forEach((route) => { router.getRoutes().forEach((route) => {
const { name } = route; const { name } = route;
if (name && !resetWhiteNameList.includes(name as string)) { if (name && !resetWhiteNameList.includes(name as string)) {
......
...@@ -69,6 +69,7 @@ export interface Menu { ...@@ -69,6 +69,7 @@ export interface Menu {
tag?: MenuTag; tag?: MenuTag;
} }
export interface MenuModule { export interface MenuModule {
orderNo?: number; orderNo?: number;
menu: Menu; menu: Menu;
......
...@@ -81,7 +81,7 @@ class App extends VuexModule { ...@@ -81,7 +81,7 @@ class App extends VuexModule {
public async setPageLoadingAction(loading: boolean): Promise<void> { public async setPageLoadingAction(loading: boolean): Promise<void> {
if (loading) { if (loading) {
clearTimeout(timeId); clearTimeout(timeId);
// 防止闪动 // Prevent flicker
timeId = setTimeout(() => { timeId = setTimeout(() => {
this.commitPageLoadingState(loading); this.commitPageLoadingState(loading);
}, 100); }, 100);
...@@ -91,9 +91,9 @@ class App extends VuexModule { ...@@ -91,9 +91,9 @@ class App extends VuexModule {
} }
} }
// /** /**
// * @description: unlock page * @description: unlock page
// */ */
@Action @Action
public async unLockAction({ password, valid = true }: { password: string; valid?: boolean }) { public async unLockAction({ password, valid = true }: { password: string; valid?: boolean }) {
if (!valid) { if (!valid) {
...@@ -125,5 +125,4 @@ class App extends VuexModule { ...@@ -125,5 +125,4 @@ class App extends VuexModule {
return res; return res;
} }
} }
export { App };
export const appStore = getModule<App>(App); export const appStore = getModule<App>(App);
...@@ -78,5 +78,4 @@ class Error extends VuexModule implements ErrorState { ...@@ -78,5 +78,4 @@ class Error extends VuexModule implements ErrorState {
this.commitErrorInfoState(errInfo as ErrorInfo); this.commitErrorInfoState(errInfo as ErrorInfo);
} }
} }
export { Error };
export const errorStore = getModule<Error>(Error); export const errorStore = getModule<Error>(Error);
...@@ -64,5 +64,4 @@ class Menu extends VuexModule { ...@@ -64,5 +64,4 @@ class Menu extends VuexModule {
} }
} }
export { Menu };
export const menuStore = getModule<Menu>(Menu); export const menuStore = getModule<Menu>(Menu);
...@@ -128,5 +128,4 @@ class Permission extends VuexModule { ...@@ -128,5 +128,4 @@ class Permission extends VuexModule {
return routes; return routes;
} }
} }
export { Permission };
export const permissionStore = getModule<Permission>(Permission); export const permissionStore = getModule<Permission>(Permission);
...@@ -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';
import { getCurrentTo } from '/@/utils/helper/routeHelper'; import { getCurrentTo } from '/@/utils/helper/routeHelper';
type CacheName = string | symbol | null | undefined; type CacheName = string | symbol | null | undefined;
/** /**
* @description: vuex Tab模块 * @description: vuex Tab模块
*/ */
...@@ -29,6 +30,7 @@ export interface TabItem { ...@@ -29,6 +30,7 @@ export interface TabItem {
} }
const NAME = 'tab'; const NAME = 'tab';
hotModuleUnregisterModule(NAME); hotModuleUnregisterModule(NAME);
const getOpenKeepAliveRef = computed(() => appStore.getProjectConfig.openKeepAlive); const getOpenKeepAliveRef = computed(() => appStore.getProjectConfig.openKeepAlive);
...@@ -252,5 +254,4 @@ class Tab extends VuexModule { ...@@ -252,5 +254,4 @@ class Tab extends VuexModule {
this.closeMultipleTab({ pathList, nameList }); this.closeMultipleTab({ pathList, nameList });
} }
} }
export { Tab };
export const tabStore = getModule<Tab>(Tab); export const tabStore = getModule<Tab>(Tab);
...@@ -154,5 +154,4 @@ class User extends VuexModule { ...@@ -154,5 +154,4 @@ class User extends VuexModule {
}); });
} }
} }
export { User };
export const userStore = getModule<User>(User); export const userStore = getModule<User>(User);
...@@ -138,9 +138,11 @@ export type SetProjectSettingFn = <T extends keyof ProjectConfig>( ...@@ -138,9 +138,11 @@ export type SetProjectSettingFn = <T extends keyof ProjectConfig>(
key: T, key: T,
value: ProjectConfig[T] value: ProjectConfig[T]
) => void; ) => void;
interface GlobWrap { interface GlobWrap {
globSetting: Readonly<GlobConfig>; globSetting: Readonly<GlobConfig>;
} }
interface ProjectSettingWrap { interface ProjectSettingWrap {
projectSetting: Readonly<ProjectConfig>; projectSetting: Readonly<ProjectConfig>;
} }
......
...@@ -37,6 +37,12 @@ declare type DeepPartial<T> = { ...@@ -37,6 +37,12 @@ declare type DeepPartial<T> = {
[P in keyof T]?: DeepPartial<T[P]>; [P in keyof T]?: DeepPartial<T[P]>;
}; };
// type DeepPartial<T> = T extends Function
// ? T
// : T extends object
// ? { [K in keyof T]?: DeepPartial<T[K]> }
// : T;
declare type LabelValueOptions = { declare type LabelValueOptions = {
label: string; label: string;
value: any; value: any;
......
...@@ -13,21 +13,13 @@ declare global { ...@@ -13,21 +13,13 @@ declare global {
// tslint:disable no-empty-interface // tslint:disable no-empty-interface
type ElementClass = ComponentRenderProxy; type ElementClass = ComponentRenderProxy;
interface ElementAttributesProperty { interface ElementAttributesProperty {
$props: any; // 定义要使用的属性名称 $props: any;
} }
interface IntrinsicElements { interface IntrinsicElements {
[elem: string]: any; [elem: string]: any;
} }
interface IntrinsicAttributes { interface IntrinsicAttributes {
// ['v-if']?: unknown;
// ['v-else-if']?: unknown;
// ['v-else']?: unknown;
// need
// ['v-show']?: unknown;
[elem: string]: any; [elem: string]: any;
// ['v-html']?: unknown;
// ['v-text']?: unknown;
// ['v-model']?: unknown;
} }
} }
} }
import { dataURLtoBlob, urlToBase64 } from './stream'; import { dataURLtoBlob, urlToBase64 } from './base64';
/** /**
* Download online pictures * Download online pictures
......
...@@ -7,8 +7,8 @@ const ls = createStorage(localStorage); ...@@ -7,8 +7,8 @@ const ls = createStorage(localStorage);
const ss = createStorage(); const ss = createStorage();
interface CacheStore { interface CacheStore {
local?: any; local: Record<string, any>;
session?: any; session: Record<string, any>;
} }
/** /**
...@@ -25,14 +25,14 @@ function initCache() { ...@@ -25,14 +25,14 @@ function initCache() {
cacheStore.local = ls.get(BASE_LOCAL_CACHE_KEY) || {}; cacheStore.local = ls.get(BASE_LOCAL_CACHE_KEY) || {};
cacheStore.session = ss.get(BASE_SESSION_CACHE_KEY) || {}; cacheStore.session = ss.get(BASE_SESSION_CACHE_KEY) || {};
} }
initCache(); initCache();
export function setLocal(key: string, value: any, immediate = false) { export function setLocal(key: string, value: any, immediate = false) {
cacheStore.local[BASE_LOCAL_CACHE_KEY] = cacheStore.local[BASE_LOCAL_CACHE_KEY] || {}; cacheStore.local[BASE_LOCAL_CACHE_KEY] = cacheStore.local[BASE_LOCAL_CACHE_KEY] || {};
cacheStore.local[BASE_LOCAL_CACHE_KEY][key] = value; cacheStore.local[BASE_LOCAL_CACHE_KEY][key] = value;
if (immediate) { if (immediate) {
const localCache = cacheStore.local; ls.set(BASE_LOCAL_CACHE_KEY, cacheStore.local);
ls.set(BASE_LOCAL_CACHE_KEY, localCache);
} }
} }
...@@ -43,6 +43,7 @@ export function getLocal<T>(key: string): T | null { ...@@ -43,6 +43,7 @@ export function getLocal<T>(key: string): T | null {
return null; return null;
} }
} }
export function removeLocal(key: string) { export function removeLocal(key: string) {
if (cacheStore.local[BASE_LOCAL_CACHE_KEY]) { if (cacheStore.local[BASE_LOCAL_CACHE_KEY]) {
Reflect.deleteProperty(cacheStore.local[BASE_LOCAL_CACHE_KEY], key); Reflect.deleteProperty(cacheStore.local[BASE_LOCAL_CACHE_KEY], key);
...@@ -91,8 +92,6 @@ export function clearAll() { ...@@ -91,8 +92,6 @@ export function clearAll() {
const localCache = cacheStore.local; const localCache = cacheStore.local;
const sessionCache = cacheStore.session; const sessionCache = cacheStore.session;
// const ss = createStorage();
ls.set(BASE_LOCAL_CACHE_KEY, localCache); ls.set(BASE_LOCAL_CACHE_KEY, localCache);
ss.set(BASE_SESSION_CACHE_KEY, sessionCache); ss.set(BASE_SESSION_CACHE_KEY, sessionCache);
}); });
...@@ -114,6 +113,7 @@ export function clearAll() { ...@@ -114,6 +113,7 @@ export function clearAll() {
} }
} }
} }
if (isIeFn() && (document as any).attachEvent) { if (isIeFn() && (document as any).attachEvent) {
(document as any).attachEvent('onstorage', storageChange); (document as any).attachEvent('onstorage', storageChange);
} else { } else {
......
...@@ -158,6 +158,7 @@ export function forEach<T = any>( ...@@ -158,6 +158,7 @@ export function forEach<T = any>(
export function treeMap(treeData: any[], opt: { children?: string; conversion: Fn }) { export function treeMap(treeData: any[], opt: { children?: string; conversion: Fn }) {
return treeData.map((item) => treeMapEach(item, opt)); return treeData.map((item) => treeMapEach(item, opt));
} }
/** /**
* @description: 提取tree指定结构 * @description: 提取tree指定结构
*/ */
......
...@@ -6343,10 +6343,10 @@ prettier-linter-helpers@^1.0.0: ...@@ -6343,10 +6343,10 @@ prettier-linter-helpers@^1.0.0:
dependencies: dependencies:
fast-diff "^1.1.2" fast-diff "^1.1.2"
prettier@^2.1.2: prettier@^2.2.0:
version "2.1.2" version "2.2.0"
resolved "https://registry.npmjs.org/prettier/-/prettier-2.1.2.tgz#3050700dae2e4c8b67c4c3f666cdb8af405e1ce5" resolved "https://registry.npmjs.org/prettier/-/prettier-2.2.0.tgz#8a03c7777883b29b37fb2c4348c66a78e980418b"
integrity sha512-16c7K+x4qVlJg9rEbXl7HEGmQyZlG4R9AgP+oHKRMsMsuk8s+ATStlf1NpDqyBI1HpVyfjLOeMhH2LvuNvV5Vg== integrity sha512-yYerpkvseM4iKD/BXLYUkQV5aKt4tQPqaGW6EsZjzyu0r7sVZZNPJW4Y8MyKmicp6t42XUPcBVA+H6sB3gqndw==
pretty-bytes@^5.3.0: pretty-bytes@^5.3.0:
version "5.4.1" version "5.4.1"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册