Commit e2333642c43f05055a199e0355044e11e3756782
1 parent
bdce8453
style: some format adjustments
Showing
21 changed files
with
71 additions
and
162 deletions
src/layouts/Logo.vue
@@ -23,12 +23,14 @@ | @@ -23,12 +23,14 @@ | ||
23 | }, | 23 | }, |
24 | }, | 24 | }, |
25 | setup(props) { | 25 | setup(props) { |
26 | + const showRef = ref<boolean>(!!props.showTitle); | ||
26 | const { globSetting } = useSetting(); | 27 | const { globSetting } = useSetting(); |
27 | const go = useGo(); | 28 | const go = useGo(); |
29 | + | ||
28 | function handleGoHome() { | 30 | function handleGoHome() { |
29 | go(PageEnum.BASE_HOME); | 31 | go(PageEnum.BASE_HOME); |
30 | } | 32 | } |
31 | - const showRef = ref<boolean>(!!props.showTitle); | 33 | + |
32 | watch( | 34 | watch( |
33 | () => props.showTitle, | 35 | () => props.showTitle, |
34 | (show: boolean) => { | 36 | (show: boolean) => { |
@@ -41,6 +43,7 @@ | @@ -41,6 +43,7 @@ | ||
41 | } | 43 | } |
42 | } | 44 | } |
43 | ); | 45 | ); |
46 | + | ||
44 | return { | 47 | return { |
45 | handleGoHome, | 48 | handleGoHome, |
46 | globSetting, | 49 | globSetting, |
@@ -55,7 +58,6 @@ | @@ -55,7 +58,6 @@ | ||
55 | 58 | ||
56 | .app-logo { | 59 | .app-logo { |
57 | display: flex; | 60 | display: flex; |
58 | - // justify-content: center; | ||
59 | align-items: center; | 61 | align-items: center; |
60 | cursor: pointer; | 62 | cursor: pointer; |
61 | 63 |
src/layouts/iframe/useFrameKeepAlive.ts
1 | +import type { AppRouteRecordRaw } from '/@/router/types'; | ||
2 | + | ||
1 | import { computed, toRaw, unref } from 'vue'; | 3 | import { computed, toRaw, unref } from 'vue'; |
4 | +import { useRouter } from 'vue-router'; | ||
5 | +import router from '/@/router'; | ||
2 | 6 | ||
3 | import { tabStore } from '/@/store/modules/tab'; | 7 | import { tabStore } from '/@/store/modules/tab'; |
4 | import { appStore } from '/@/store/modules/app'; | 8 | import { appStore } from '/@/store/modules/app'; |
5 | 9 | ||
6 | -import { AppRouteRecordRaw } from '/@/router/types'; | ||
7 | -import { useRouter } from 'vue-router'; | ||
8 | -import router from '/@/router'; | ||
9 | import { unique } from '/@/utils'; | 10 | import { unique } from '/@/utils'; |
10 | 11 | ||
11 | export function useFrameKeepAlive() { | 12 | export function useFrameKeepAlive() { |
src/layouts/page/index.tsx
1 | import { computed, defineComponent, unref, Transition, KeepAlive, toRaw } from 'vue'; | 1 | import { computed, defineComponent, unref, Transition, KeepAlive, toRaw } from 'vue'; |
2 | +import { RouterView, RouteLocation } from 'vue-router'; | ||
2 | 3 | ||
3 | -import { appStore } from '/@/store/modules/app'; | 4 | +import FrameLayout from '/@/layouts/iframe/index.vue'; |
4 | 5 | ||
5 | import { useTransition } from './useTransition'; | 6 | import { useTransition } from './useTransition'; |
7 | +import { useSetting } from '/@/hooks/core/useSetting'; | ||
6 | 8 | ||
7 | -import { RouterView, RouteLocation } from 'vue-router'; | ||
8 | import { tabStore } from '/@/store/modules/tab'; | 9 | import { tabStore } from '/@/store/modules/tab'; |
9 | -import FrameLayout from '/@/layouts/iframe/index.vue'; | 10 | +import { appStore } from '/@/store/modules/app'; |
10 | 11 | ||
11 | -import { useSetting } from '/@/hooks/core/useSetting'; | ||
12 | -// import { useRouter } from 'vue-router'; | ||
13 | export default defineComponent({ | 12 | export default defineComponent({ |
14 | name: 'PageLayout', | 13 | name: 'PageLayout', |
15 | setup() { | 14 | setup() { |
16 | - // const { currentRoute } = useRouter(); | ||
17 | const getProjectConfigRef = computed(() => { | 15 | const getProjectConfigRef = computed(() => { |
18 | return appStore.getProjectConfig; | 16 | return appStore.getProjectConfig; |
19 | }); | 17 | }); |
src/router/constant.ts
@@ -22,6 +22,7 @@ export const PAGE_NOT_FOUND_ROUTE: AppRouteRecordRaw = { | @@ -22,6 +22,7 @@ export const PAGE_NOT_FOUND_ROUTE: AppRouteRecordRaw = { | ||
22 | hideBreadcrumb: true, | 22 | hideBreadcrumb: true, |
23 | }, | 23 | }, |
24 | }; | 24 | }; |
25 | + | ||
25 | export const REDIRECT_ROUTE: AppRouteRecordRaw = { | 26 | export const REDIRECT_ROUTE: AppRouteRecordRaw = { |
26 | path: '/redirect/:path(.*)*', | 27 | path: '/redirect/:path(.*)*', |
27 | name: 'Redirect', | 28 | name: 'Redirect', |
@@ -31,16 +32,3 @@ export const REDIRECT_ROUTE: AppRouteRecordRaw = { | @@ -31,16 +32,3 @@ export const REDIRECT_ROUTE: AppRouteRecordRaw = { | ||
31 | hideBreadcrumb: true, | 32 | hideBreadcrumb: true, |
32 | }, | 33 | }, |
33 | }; | 34 | }; |
34 | - | ||
35 | -// Whole site 404 | ||
36 | -// export const FULL_PAGE_NOT_FOUND_ROUTE: AppRouteRecordRaw = { | ||
37 | -// path: '/:path(.*)*', | ||
38 | -// name: 'FullErrorPage', | ||
39 | -// component: EXCEPTION_COMPONENT, | ||
40 | -// props: { | ||
41 | -// full: true, | ||
42 | -// }, | ||
43 | -// meta: { | ||
44 | -// title: 'FullErrorPage', | ||
45 | -// }, | ||
46 | -// }; |
src/router/guard/index.ts
1 | import type { Router } from 'vue-router'; | 1 | import type { Router } from 'vue-router'; |
2 | 2 | ||
3 | import { Modal, notification } from 'ant-design-vue'; | 3 | import { Modal, notification } from 'ant-design-vue'; |
4 | -import { AxiosCanceler } from '/@/utils/http/axios/axiosCancel'; | 4 | + |
5 | import { createProgressGuard } from './progressGuard'; | 5 | import { createProgressGuard } from './progressGuard'; |
6 | import { createPermissionGuard } from './permissionGuard'; | 6 | import { createPermissionGuard } from './permissionGuard'; |
7 | import { createPageLoadingGuard } from './pageLoadingGuard'; | 7 | import { createPageLoadingGuard } from './pageLoadingGuard'; |
8 | + | ||
8 | import { useSetting } from '/@/hooks/core/useSetting'; | 9 | import { useSetting } from '/@/hooks/core/useSetting'; |
10 | + | ||
9 | import { getIsOpenTab, setCurrentTo } from '/@/utils/helper/routeHelper'; | 11 | import { getIsOpenTab, setCurrentTo } from '/@/utils/helper/routeHelper'; |
10 | import { setTitle } from '/@/utils/browser'; | 12 | import { setTitle } from '/@/utils/browser'; |
13 | +import { AxiosCanceler } from '/@/utils/http/axios/axiosCancel'; | ||
11 | 14 | ||
12 | const { projectSetting, globSetting } = useSetting(); | 15 | const { projectSetting, globSetting } = useSetting(); |
13 | export function createGuard(router: Router) { | 16 | export function createGuard(router: Router) { |
@@ -36,10 +39,7 @@ export function createGuard(router: Router) { | @@ -36,10 +39,7 @@ export function createGuard(router: Router) { | ||
36 | 39 | ||
37 | router.afterEach((to) => { | 40 | router.afterEach((to) => { |
38 | // change html title | 41 | // change html title |
39 | - | ||
40 | - setTimeout(() => { | ||
41 | - setTitle(to.meta.title, globSetting.title); | ||
42 | - }, 0); | 42 | + setTitle(to.meta.title, globSetting.title); |
43 | }); | 43 | }); |
44 | 44 | ||
45 | openNProgress && createProgressGuard(router); | 45 | openNProgress && createProgressGuard(router); |
src/router/guard/permissionGuard.ts
@@ -2,12 +2,11 @@ import type { Router, RouteRecordRaw } from 'vue-router'; | @@ -2,12 +2,11 @@ import type { Router, RouteRecordRaw } from 'vue-router'; | ||
2 | 2 | ||
3 | import { userStore } from '/@/store/modules/user'; | 3 | import { userStore } from '/@/store/modules/user'; |
4 | import { permissionStore } from '/@/store/modules/permission'; | 4 | import { permissionStore } from '/@/store/modules/permission'; |
5 | + | ||
5 | import { PageEnum } from '/@/enums/pageEnum'; | 6 | import { PageEnum } from '/@/enums/pageEnum'; |
6 | import { getToken } from '/@/utils/auth'; | 7 | import { getToken } from '/@/utils/auth'; |
7 | -import { | ||
8 | - // FULL_PAGE_NOT_FOUND_ROUTE, | ||
9 | - PAGE_NOT_FOUND_ROUTE, | ||
10 | -} from '/@/router/constant'; | 8 | + |
9 | +import { PAGE_NOT_FOUND_ROUTE } from '/@/router/constant'; | ||
11 | import { RootRoute } from '../routes/index'; | 10 | import { RootRoute } from '../routes/index'; |
12 | 11 | ||
13 | const LOGIN_PATH = PageEnum.BASE_LOGIN; | 12 | const LOGIN_PATH = PageEnum.BASE_LOGIN; |
@@ -60,6 +59,7 @@ export function createPermissionGuard(router: Router) { | @@ -60,6 +59,7 @@ export function createPermissionGuard(router: Router) { | ||
60 | permissionStore.commitDynamicAddedRouteState(true); | 59 | permissionStore.commitDynamicAddedRouteState(true); |
61 | next(nextData); | 60 | next(nextData); |
62 | }); | 61 | }); |
62 | + | ||
63 | router.afterEach((to) => { | 63 | router.afterEach((to) => { |
64 | // Just enter the login page and clear the authentication information | 64 | // Just enter the login page and clear the authentication information |
65 | if (to.path === LOGIN_PATH) { | 65 | if (to.path === LOGIN_PATH) { |
src/router/guard/progressGuard.ts
@@ -11,6 +11,7 @@ export function createProgressGuard(router: Router) { | @@ -11,6 +11,7 @@ export function createProgressGuard(router: Router) { | ||
11 | !to.meta.inTab && NProgress.start(); | 11 | !to.meta.inTab && NProgress.start(); |
12 | return true; | 12 | return true; |
13 | }); | 13 | }); |
14 | + | ||
14 | router.afterEach(async (to) => { | 15 | router.afterEach(async (to) => { |
15 | !to.meta.inTab && NProgress.done(); | 16 | !to.meta.inTab && NProgress.done(); |
16 | return true; | 17 | return true; |
src/router/index.ts
@@ -2,6 +2,7 @@ import type { RouteRecordRaw } from 'vue-router'; | @@ -2,6 +2,7 @@ import type { RouteRecordRaw } from 'vue-router'; | ||
2 | import type { App } from 'vue'; | 2 | import type { App } from 'vue'; |
3 | 3 | ||
4 | import { createRouter, createWebHashHistory } from 'vue-router'; | 4 | import { createRouter, createWebHashHistory } from 'vue-router'; |
5 | + | ||
5 | import { scrollWaiter } from '../utils/scrollWaiter'; | 6 | import { scrollWaiter } from '../utils/scrollWaiter'; |
6 | 7 | ||
7 | import { createGuard } from './guard/'; | 8 | import { createGuard } from './guard/'; |
@@ -24,6 +25,7 @@ const router = createRouter({ | @@ -24,6 +25,7 @@ const router = createRouter({ | ||
24 | } | 25 | } |
25 | }, | 26 | }, |
26 | }); | 27 | }); |
28 | + | ||
27 | // reset router | 29 | // reset router |
28 | export function resetRouter() { | 30 | export function resetRouter() { |
29 | const resetWhiteNameList = [ | 31 | const resetWhiteNameList = [ |
@@ -45,21 +47,4 @@ export function setupRouter(app: App<Element>) { | @@ -45,21 +47,4 @@ export function setupRouter(app: App<Element>) { | ||
45 | createGuard(router); | 47 | createGuard(router); |
46 | } | 48 | } |
47 | 49 | ||
48 | -// // hmr | ||
49 | -// if (import.meta.hot) { | ||
50 | -// let removeRoutes: (() => void)[] = []; | ||
51 | - | ||
52 | -// for (let route of routes) { | ||
53 | -// removeRoutes.push(router.addRoute(route as RouteRecordRaw)); | ||
54 | -// } | ||
55 | - | ||
56 | -// import.meta.hot?.acceptDeps('./routes.ts', ({ routes }) => { | ||
57 | -// for (let removeRoute of removeRoutes) removeRoute(); | ||
58 | -// removeRoutes = []; | ||
59 | -// for (let route of routes) { | ||
60 | -// removeRoutes.push(router.addRoute(route)); | ||
61 | -// } | ||
62 | -// router.replace(''); | ||
63 | -// }); | ||
64 | -// } | ||
65 | export default router; | 50 | export default router; |
src/router/menus/index.ts
@@ -9,33 +9,7 @@ import { PermissionModeEnum } from '/@/enums/appEnum'; | @@ -9,33 +9,7 @@ import { PermissionModeEnum } from '/@/enums/appEnum'; | ||
9 | import { pathToRegexp } from 'path-to-regexp'; | 9 | import { pathToRegexp } from 'path-to-regexp'; |
10 | import modules from 'globby!/@/router/menus/modules/**/*.@(ts)'; | 10 | import modules from 'globby!/@/router/menus/modules/**/*.@(ts)'; |
11 | 11 | ||
12 | -// =========================== | ||
13 | -// ==========module import==== | ||
14 | -// =========================== | ||
15 | -// import dashboard from './modules/dashboard'; | ||
16 | - | ||
17 | -// import exceptionDemo from './modules/demo/exception'; | ||
18 | -// import iframeDemo from './modules/demo/iframe'; | ||
19 | -// import compDemo from './modules/demo/comp'; | ||
20 | -// import permissionDemo from './modules/demo/permission'; | ||
21 | -// import featDemo from './modules/demo/feat'; | ||
22 | -// import chartsDemo from './modules/demo/charts'; | ||
23 | -// import tableDemo from './modules/demo/table'; | ||
24 | -// import formDemo from './modules/demo/form'; | ||
25 | -// import treeDemo from './modules/demo/tree'; | ||
26 | - | ||
27 | -const menuModules: MenuModule[] = [ | ||
28 | - // dashboard, | ||
29 | - // featDemo, | ||
30 | - // exceptionDemo, | ||
31 | - // iframeDemo, | ||
32 | - // compDemo, | ||
33 | - // permissionDemo, | ||
34 | - // chartsDemo, | ||
35 | - // tableDemo, | ||
36 | - // formDemo, | ||
37 | - // treeDemo, | ||
38 | -]; | 12 | +const menuModules: MenuModule[] = []; |
39 | 13 | ||
40 | Object.keys(modules).forEach((key) => { | 14 | Object.keys(modules).forEach((key) => { |
41 | menuModules.push(modules[key]); | 15 | menuModules.push(modules[key]); |
src/router/routes/index.ts
@@ -4,30 +4,7 @@ import { DEFAULT_LAYOUT_COMPONENT, PAGE_NOT_FOUND_ROUTE, REDIRECT_ROUTE } from ' | @@ -4,30 +4,7 @@ import { DEFAULT_LAYOUT_COMPONENT, PAGE_NOT_FOUND_ROUTE, REDIRECT_ROUTE } from ' | ||
4 | import { genRouteModule } from '/@/utils/helper/routeHelper'; | 4 | import { genRouteModule } from '/@/utils/helper/routeHelper'; |
5 | import modules from 'globby!/@/router/routes/modules/**/*.@(ts)'; | 5 | import modules from 'globby!/@/router/routes/modules/**/*.@(ts)'; |
6 | 6 | ||
7 | -// import dashboard from './modules/dashboard'; | ||
8 | -// demo | ||
9 | -// import exceptionDemo from './modules/demo/exception'; | ||
10 | -// import iframeDemo from './modules/demo/iframe'; | ||
11 | -// import compDemo from './modules/demo/comp'; | ||
12 | -// import permissionDemo from './modules/demo/permission'; | ||
13 | -// import featDemo from './modules/demo/feat'; | ||
14 | -// import chartsDemo from './modules/demo/charts'; | ||
15 | -// import tableDemo from './modules/demo/table'; | ||
16 | -// import formDemo from './modules/demo/form'; | ||
17 | -// import treeDemo from './modules/demo/tree'; | ||
18 | - | ||
19 | -const routeModuleList: AppRouteModule[] = [ | ||
20 | - // exceptionDemo, | ||
21 | - // dashboard, | ||
22 | - // iframeDemo, | ||
23 | - // compDemo, | ||
24 | - // featDemo, | ||
25 | - // permissionDemo, | ||
26 | - // chartsDemo, | ||
27 | - // tableDemo, | ||
28 | - // formDemo, | ||
29 | - // treeDemo, | ||
30 | -]; | 7 | +const routeModuleList: AppRouteModule[] = []; |
31 | 8 | ||
32 | Object.keys(modules).forEach((key) => { | 9 | Object.keys(modules).forEach((key) => { |
33 | routeModuleList.push(modules[key]); | 10 | routeModuleList.push(modules[key]); |
@@ -38,6 +15,7 @@ export const asyncRoutes = [ | @@ -38,6 +15,7 @@ export const asyncRoutes = [ | ||
38 | PAGE_NOT_FOUND_ROUTE, | 15 | PAGE_NOT_FOUND_ROUTE, |
39 | ...genRouteModule(routeModuleList), | 16 | ...genRouteModule(routeModuleList), |
40 | ]; | 17 | ]; |
18 | + | ||
41 | // 主框架根路由 | 19 | // 主框架根路由 |
42 | export const RootRoute: AppRouteRecordRaw = { | 20 | export const RootRoute: AppRouteRecordRaw = { |
43 | path: '/', | 21 | path: '/', |
src/setup/error-handle/index.ts
@@ -66,25 +66,23 @@ export function scriptErrorHandler( | @@ -66,25 +66,23 @@ export function scriptErrorHandler( | ||
66 | if (event === 'Script error.' && !source) { | 66 | if (event === 'Script error.' && !source) { |
67 | return false; | 67 | return false; |
68 | } | 68 | } |
69 | - setTimeout(function () { | ||
70 | - const errorInfo: Partial<ErrorInfo> = {}; | ||
71 | - colno = colno || (window.event && (window.event as any).errorCharacter) || 0; | ||
72 | - errorInfo.message = event as string; | ||
73 | - if (error && error.stack) { | ||
74 | - errorInfo.stack = error.stack; | ||
75 | - } else { | ||
76 | - errorInfo.stack = ''; | ||
77 | - } | ||
78 | - const name = source ? source.substr(source.lastIndexOf('/') + 1) : 'script'; | ||
79 | - errorStore.commitErrorInfoState({ | ||
80 | - type: ErrorTypeEnum.SCRIPT, | ||
81 | - name: name, | ||
82 | - file: source as string, | ||
83 | - detail: 'lineno' + lineno, | ||
84 | - url: window.location.href, | ||
85 | - ...(errorInfo as Pick<ErrorInfo, 'message' | 'stack'>), | ||
86 | - }); | ||
87 | - }, 0); | 69 | + const errorInfo: Partial<ErrorInfo> = {}; |
70 | + colno = colno || (window.event && (window.event as any).errorCharacter) || 0; | ||
71 | + errorInfo.message = event as string; | ||
72 | + if (error && error.stack) { | ||
73 | + errorInfo.stack = error.stack; | ||
74 | + } else { | ||
75 | + errorInfo.stack = ''; | ||
76 | + } | ||
77 | + const name = source ? source.substr(source.lastIndexOf('/') + 1) : 'script'; | ||
78 | + errorStore.commitErrorInfoState({ | ||
79 | + type: ErrorTypeEnum.SCRIPT, | ||
80 | + name: name, | ||
81 | + file: source as string, | ||
82 | + detail: 'lineno' + lineno, | ||
83 | + url: window.location.href, | ||
84 | + ...(errorInfo as Pick<ErrorInfo, 'message' | 'stack'>), | ||
85 | + }); | ||
88 | return true; | 86 | return true; |
89 | } | 87 | } |
90 | 88 |
src/store/index.ts
@@ -15,7 +15,9 @@ const store = createStore({ | @@ -15,7 +15,9 @@ const store = createStore({ | ||
15 | strict: isDev, | 15 | strict: isDev, |
16 | // plugins, | 16 | // plugins, |
17 | }); | 17 | }); |
18 | + | ||
18 | export function setupStore(app: App<Element>) { | 19 | export function setupStore(app: App<Element>) { |
19 | app.use(store); | 20 | app.use(store); |
20 | } | 21 | } |
22 | + | ||
21 | export default store; | 23 | export default store; |
src/store/modules/app.ts
1 | -import store from '/@/store'; | ||
2 | -import { hotModuleUnregisterModule } from '/@/utils/helper/vuexHelper'; | 1 | +import type { ProjectConfig } from '/@/types/config'; |
2 | + | ||
3 | import { VuexModule, getModule, Module, Mutation, Action } from 'vuex-module-decorators'; | 3 | import { VuexModule, getModule, Module, Mutation, Action } from 'vuex-module-decorators'; |
4 | +import store from '/@/store'; | ||
4 | 5 | ||
5 | import { PROJ_CFG_KEY, LOCK_INFO_KEY } from '/@/enums/cacheEnum'; | 6 | import { PROJ_CFG_KEY, LOCK_INFO_KEY } from '/@/enums/cacheEnum'; |
6 | -import { ProjectConfig } from '/@/types/config'; | ||
7 | 7 | ||
8 | -// import { userStore } from './user'; | 8 | +import { hotModuleUnregisterModule } from '/@/utils/helper/vuexHelper'; |
9 | import { setLocal, getLocal, removeLocal } from '/@/utils/helper/persistent'; | 9 | import { setLocal, getLocal, removeLocal } from '/@/utils/helper/persistent'; |
10 | import { deepMerge } from '/@/utils'; | 10 | import { deepMerge } from '/@/utils'; |
11 | + | ||
11 | import { userStore } from './user'; | 12 | import { userStore } from './user'; |
12 | 13 | ||
13 | export interface LockInfo { | 14 | export interface LockInfo { |
@@ -20,12 +21,16 @@ const NAME = 'app'; | @@ -20,12 +21,16 @@ const NAME = 'app'; | ||
20 | hotModuleUnregisterModule(NAME); | 21 | hotModuleUnregisterModule(NAME); |
21 | @Module({ dynamic: true, namespaced: true, store, name: NAME }) | 22 | @Module({ dynamic: true, namespaced: true, store, name: NAME }) |
22 | class App extends VuexModule { | 23 | class App extends VuexModule { |
24 | + // Page loading status | ||
23 | private pageLoadingState = false; | 25 | private pageLoadingState = false; |
24 | 26 | ||
27 | + // project config | ||
25 | private projectConfigState: ProjectConfig | null = getLocal(PROJ_CFG_KEY); | 28 | private projectConfigState: ProjectConfig | null = getLocal(PROJ_CFG_KEY); |
26 | 29 | ||
30 | + // lock info | ||
27 | private lockInfoState: LockInfo | null = getLocal(LOCK_INFO_KEY); | 31 | private lockInfoState: LockInfo | null = getLocal(LOCK_INFO_KEY); |
28 | 32 | ||
33 | + // set main overflow hidden | ||
29 | private lockMainScrollState = false; | 34 | private lockMainScrollState = false; |
30 | 35 | ||
31 | get getPageLoading() { | 36 | get getPageLoading() { |
@@ -87,7 +92,7 @@ class App extends VuexModule { | @@ -87,7 +92,7 @@ class App extends VuexModule { | ||
87 | } | 92 | } |
88 | 93 | ||
89 | // /** | 94 | // /** |
90 | - // * @description: 解锁 | 95 | + // * @description: unlock page |
91 | // */ | 96 | // */ |
92 | @Action | 97 | @Action |
93 | public async unLockAction({ password, valid = true }: { password: string; valid?: boolean }) { | 98 | public async unLockAction({ password, valid = true }: { password: string; valid?: boolean }) { |
src/store/modules/error.ts
@@ -25,7 +25,10 @@ const NAME = 'error'; | @@ -25,7 +25,10 @@ const NAME = 'error'; | ||
25 | hotModuleUnregisterModule(NAME); | 25 | hotModuleUnregisterModule(NAME); |
26 | @Module({ dynamic: true, namespaced: true, store, name: NAME }) | 26 | @Module({ dynamic: true, namespaced: true, store, name: NAME }) |
27 | class Error extends VuexModule implements ErrorState { | 27 | class Error extends VuexModule implements ErrorState { |
28 | + // error log list | ||
28 | errorInfoState: ErrorInfo[] = []; | 29 | errorInfoState: ErrorInfo[] = []; |
30 | + | ||
31 | + // error log count | ||
29 | errorListCountState = 0; | 32 | errorListCountState = 0; |
30 | 33 | ||
31 | get getErrorInfoState() { | 34 | get getErrorInfoState() { |
src/store/modules/permission.ts
@@ -26,16 +26,16 @@ const NAME = 'permission'; | @@ -26,16 +26,16 @@ const NAME = 'permission'; | ||
26 | hotModuleUnregisterModule(NAME); | 26 | hotModuleUnregisterModule(NAME); |
27 | @Module({ dynamic: true, namespaced: true, store, name: NAME }) | 27 | @Module({ dynamic: true, namespaced: true, store, name: NAME }) |
28 | class Permission extends VuexModule { | 28 | class Permission extends VuexModule { |
29 | - // private routesState: AppRouteRecordRaw[] = []; | ||
30 | - | ||
31 | - // 权限编码列表 | 29 | + // Permission code list |
32 | private permCodeListState: string[] = []; | 30 | private permCodeListState: string[] = []; |
33 | 31 | ||
34 | // Whether the route has been dynamically added | 32 | // Whether the route has been dynamically added |
35 | private isDynamicAddedRouteState = false; | 33 | private isDynamicAddedRouteState = false; |
36 | 34 | ||
35 | + // To trigger a menu update | ||
37 | private lastBuildMenuTimeState = 0; | 36 | private lastBuildMenuTimeState = 0; |
38 | 37 | ||
38 | + // Backstage menu list | ||
39 | private backMenuListState: Menu[] = []; | 39 | private backMenuListState: Menu[] = []; |
40 | 40 | ||
41 | get getPermCodeListState() { | 41 | get getPermCodeListState() { |
@@ -50,10 +50,6 @@ class Permission extends VuexModule { | @@ -50,10 +50,6 @@ class Permission extends VuexModule { | ||
50 | return this.lastBuildMenuTimeState; | 50 | return this.lastBuildMenuTimeState; |
51 | } | 51 | } |
52 | 52 | ||
53 | - // get getRoutesState() { | ||
54 | - // return this.routesState; | ||
55 | - // } | ||
56 | - | ||
57 | get getIsDynamicAddedRouteState() { | 53 | get getIsDynamicAddedRouteState() { |
58 | return this.isDynamicAddedRouteState; | 54 | return this.isDynamicAddedRouteState; |
59 | } | 55 | } |
@@ -73,11 +69,6 @@ class Permission extends VuexModule { | @@ -73,11 +69,6 @@ class Permission extends VuexModule { | ||
73 | this.lastBuildMenuTimeState = new Date().getTime(); | 69 | this.lastBuildMenuTimeState = new Date().getTime(); |
74 | } | 70 | } |
75 | 71 | ||
76 | - // @Mutation | ||
77 | - // commitRoutesState(routes: AppRouteRecordRaw[]): void { | ||
78 | - // this.routesState = routes; | ||
79 | - // } | ||
80 | - | ||
81 | @Mutation | 72 | @Mutation |
82 | commitDynamicAddedRouteState(added: boolean): void { | 73 | commitDynamicAddedRouteState(added: boolean): void { |
83 | this.isDynamicAddedRouteState = added; | 74 | this.isDynamicAddedRouteState = added; |
src/store/modules/tab.ts
@@ -34,18 +34,15 @@ const getOpenKeepAliveRef = computed(() => appStore.getProjectConfig.openKeepAli | @@ -34,18 +34,15 @@ const getOpenKeepAliveRef = computed(() => appStore.getProjectConfig.openKeepAli | ||
34 | 34 | ||
35 | @Module({ namespaced: true, name: NAME, dynamic: true, store }) | 35 | @Module({ namespaced: true, name: NAME, dynamic: true, store }) |
36 | class Tab extends VuexModule { | 36 | class Tab extends VuexModule { |
37 | - // tab列表 | 37 | + // tab list |
38 | tabsState: TabItem[] = []; | 38 | tabsState: TabItem[] = []; |
39 | - // 缓存列表 | 39 | + // tab cache list |
40 | keepAliveTabsState: CacheName[] = []; | 40 | keepAliveTabsState: CacheName[] = []; |
41 | 41 | ||
42 | currentContextMenuIndexState = -1; | 42 | currentContextMenuIndexState = -1; |
43 | 43 | ||
44 | currentContextMenuState: TabItem | null = null; | 44 | currentContextMenuState: TabItem | null = null; |
45 | 45 | ||
46 | - /** | ||
47 | - * @description: 获取tabs | ||
48 | - */ | ||
49 | get getTabsState() { | 46 | get getTabsState() { |
50 | return this.tabsState; | 47 | return this.tabsState; |
51 | } | 48 | } |
@@ -58,9 +55,6 @@ class Tab extends VuexModule { | @@ -58,9 +55,6 @@ class Tab extends VuexModule { | ||
58 | return this.currentContextMenuState; | 55 | return this.currentContextMenuState; |
59 | } | 56 | } |
60 | 57 | ||
61 | - /** | ||
62 | - * @description: 获取缓存的tab列表 | ||
63 | - */ | ||
64 | get getKeepAliveTabsState() { | 58 | get getKeepAliveTabsState() { |
65 | return this.keepAliveTabsState; | 59 | return this.keepAliveTabsState; |
66 | } | 60 | } |
src/store/modules/user.ts
@@ -58,7 +58,6 @@ class User extends VuexModule { | @@ -58,7 +58,6 @@ class User extends VuexModule { | ||
58 | this.userInfoState = null; | 58 | this.userInfoState = null; |
59 | this.tokenState = ''; | 59 | this.tokenState = ''; |
60 | this.roleListState = []; | 60 | this.roleListState = []; |
61 | - // permissionStore.commitReset(); | ||
62 | } | 61 | } |
63 | 62 | ||
64 | @Mutation | 63 | @Mutation |
@@ -136,7 +135,6 @@ class User extends VuexModule { | @@ -136,7 +135,6 @@ class User extends VuexModule { | ||
136 | resetRouter(); | 135 | resetRouter(); |
137 | clearSession(); | 136 | clearSession(); |
138 | clearLocal(); | 137 | clearLocal(); |
139 | - // router.addRoute(FULL_PAGE_NOT_FOUND_ROUTE as RouteRecordRaw); | ||
140 | permissionStore.commitResetState(); | 138 | permissionStore.commitResetState(); |
141 | tabStore.commitResetState(); | 139 | tabStore.commitResetState(); |
142 | this.resetState(); | 140 | this.resetState(); |
src/types/config.d.ts
@@ -70,7 +70,6 @@ export interface ProjectConfig { | @@ -70,7 +70,6 @@ export interface ProjectConfig { | ||
70 | headerSetting: HeaderSetting; | 70 | headerSetting: HeaderSetting; |
71 | // 菜单类型 | 71 | // 菜单类型 |
72 | // menuType: MenuTypeEnum; | 72 | // menuType: MenuTypeEnum; |
73 | - | ||
74 | menuSetting: MenuSetting; | 73 | menuSetting: MenuSetting; |
75 | 74 | ||
76 | messageSetting: MessageSetting; | 75 | messageSetting: MessageSetting; |
@@ -88,15 +87,12 @@ export interface ProjectConfig { | @@ -88,15 +87,12 @@ export interface ProjectConfig { | ||
88 | showBreadCrumbIcon: boolean; | 87 | showBreadCrumbIcon: boolean; |
89 | // 使用error-handler-plugin | 88 | // 使用error-handler-plugin |
90 | useErrorHandle: boolean; | 89 | useErrorHandle: boolean; |
91 | - | ||
92 | // 开启页面切换动画 | 90 | // 开启页面切换动画 |
93 | openRouterTransition: boolean; | 91 | openRouterTransition: boolean; |
94 | // 路由切换动画 | 92 | // 路由切换动画 |
95 | routerTransition: RouterTransitionEnum; | 93 | routerTransition: RouterTransitionEnum; |
96 | - | ||
97 | // 是否开启登录安全校验 | 94 | // 是否开启登录安全校验 |
98 | openLoginVerify: boolean; | 95 | openLoginVerify: boolean; |
99 | - | ||
100 | // 是否监听网络变化 | 96 | // 是否监听网络变化 |
101 | listenNetWork: boolean; | 97 | listenNetWork: boolean; |
102 | // 是否开启页面切换loading | 98 | // 是否开启页面切换loading |
@@ -116,23 +112,17 @@ export interface ProjectConfig { | @@ -116,23 +112,17 @@ export interface ProjectConfig { | ||
116 | export interface GlobConfig { | 112 | export interface GlobConfig { |
117 | // 网站标题 | 113 | // 网站标题 |
118 | title: string; | 114 | title: string; |
119 | - | ||
120 | // 项目路径 | 115 | // 项目路径 |
121 | apiUrl: string; | 116 | apiUrl: string; |
122 | - | ||
123 | urlPrefix?: string; | 117 | urlPrefix?: string; |
124 | - | ||
125 | shortName: string; | 118 | shortName: string; |
126 | } | 119 | } |
127 | export interface GlobEnvConfig { | 120 | export interface GlobEnvConfig { |
128 | // 网站标题 | 121 | // 网站标题 |
129 | VITE_GLOB_APP_TITLE: string; | 122 | VITE_GLOB_APP_TITLE: string; |
130 | - | ||
131 | // 项目路径 | 123 | // 项目路径 |
132 | VITE_GLOB_API_URL: string; | 124 | VITE_GLOB_API_URL: string; |
133 | - | ||
134 | VITE_GLOB_API_URL_PREFIX?: string; | 125 | VITE_GLOB_API_URL_PREFIX?: string; |
135 | - | ||
136 | VITE_GLOB_APP_SHORT_NAME: string; | 126 | VITE_GLOB_APP_SHORT_NAME: string; |
137 | } | 127 | } |
138 | 128 |
src/types/global.d.ts
@@ -9,6 +9,7 @@ declare interface IObj<T = any> { | @@ -9,6 +9,7 @@ declare interface IObj<T = any> { | ||
9 | } | 9 | } |
10 | 10 | ||
11 | declare function parseInt(s: string | number, radix?: number): number; | 11 | declare function parseInt(s: string | number, radix?: number): number; |
12 | + | ||
12 | declare function parseFloat(string: string | number): number; | 13 | declare function parseFloat(string: string | number): number; |
13 | 14 | ||
14 | declare type Dictionary<T> = Record<string, T>; | 15 | declare type Dictionary<T> = Record<string, T>; |
@@ -26,6 +27,7 @@ declare type CustomizedHTMLElement<T> = HTMLElement & T; | @@ -26,6 +27,7 @@ declare type CustomizedHTMLElement<T> = HTMLElement & T; | ||
26 | declare type Indexable<T = any> = { | 27 | declare type Indexable<T = any> = { |
27 | [key: string]: T; | 28 | [key: string]: T; |
28 | }; | 29 | }; |
30 | + | ||
29 | declare type Hash<T> = Indexable<T>; | 31 | declare type Hash<T> = Indexable<T>; |
30 | 32 | ||
31 | declare type DeepPartial<T> = { | 33 | declare type DeepPartial<T> = { |
src/types/module.d.ts
1 | declare module 'ant-design-vue/es/locale/zh_CN'; | 1 | declare module 'ant-design-vue/es/locale/zh_CN'; |
2 | + | ||
2 | declare module 'globby!/@/router/routes/modules/**/*.@(ts)'; | 3 | declare module 'globby!/@/router/routes/modules/**/*.@(ts)'; |
4 | + | ||
3 | declare module 'globby!/@/router/menus/modules/**/*.@(ts)'; | 5 | declare module 'globby!/@/router/menus/modules/**/*.@(ts)'; |
6 | + | ||
4 | declare const React: string; | 7 | declare const React: string; |
src/types/shim-tsx.d.ts
1 | -// 文件: `shim-tsx.d.ts` | ||
2 | -import Vue, { VNode } from 'vue'; | ||
3 | -import type { ComponentRenderProxy } from '@vue/composition-api'; | 1 | +import type { ComponentRenderProxy, VNode } from 'vue'; |
4 | 2 | ||
5 | declare module '*.tsx' { | 3 | declare module '*.tsx' { |
6 | import { defineComponent } from 'vue'; | 4 | import { defineComponent } from 'vue'; |
7 | const component: ReturnType<defineComponent>; | 5 | const component: ReturnType<defineComponent>; |
8 | - // import { ComponentOptions } from 'vue'; | ||
9 | - // const component: ReturnType<ComponentOptions>; | ||
10 | export default component; | 6 | export default component; |
11 | } | 7 | } |
12 | 8 |