From 308c1364177121a976c6f0a33a83300a93800466 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=9C=9F=E8=B1=86=E5=93=A5?= Date: Tue, 16 Aug 2022 16:57:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/components/AiniTop/index.vue | 2 ++ src/router/dynamicRouter.ts | 13 ------------- src/router/staticRouter.ts | 17 +++++++++++++++-- src/views/permission/rolePermission/index.vue | 2 +- src/views/system/menu/index.vue | 1 + vite.config.ts | 2 +- 6 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/layout/components/AiniTop/index.vue b/src/layout/components/AiniTop/index.vue index 0902199..ab3ef9d 100644 --- a/src/layout/components/AiniTop/index.vue +++ b/src/layout/components/AiniTop/index.vue @@ -29,6 +29,8 @@ const loginOut = () => { cancelButtonText: '取消', type: 'warning', }).then(() => { + localStorage.clear() + sessionStorage.clear() router.push('/login') }) } diff --git a/src/router/dynamicRouter.ts b/src/router/dynamicRouter.ts index e205a7d..4380ae2 100644 --- a/src/router/dynamicRouter.ts +++ b/src/router/dynamicRouter.ts @@ -83,19 +83,6 @@ export const addRoutes = (router: Router) => { const userStore = useUserStore(pinia) const menuList = userStore.getPermissionMenuList const routerData = formatRouter(menuList) - router.addRoute({ - path: '/', - name: 'fist', - component: layout['../layout/index.vue'], - redirect: '/home', - children: [ - { - path: '/home', - name: 'home', - component: () => import('@/views/home/index.vue'), - }, - ], - }) routerData.forEach((element) => { router.addRoute(element) }) diff --git a/src/router/staticRouter.ts b/src/router/staticRouter.ts index 1f92049..18f11b7 100644 --- a/src/router/staticRouter.ts +++ b/src/router/staticRouter.ts @@ -2,8 +2,17 @@ import layout from '../layout/index.vue' const staticRouter = [ { - path: '/:catchAll(.*)', - component: () => import('@/pages/404/index.vue'), + path: '/', + name: 'fist', + component: layout, + redirect: '/home', + children: [ + { + path: '/home', + name: 'home', + component: () => import('@/views/home/index.vue'), + }, + ], }, { path: '/login', @@ -34,5 +43,9 @@ const staticRouter = [ }, ], }, + { + path: '/:catchAll(.*)', + component: () => import('@/pages/404/index.vue'), + }, ] export default staticRouter diff --git a/src/views/permission/rolePermission/index.vue b/src/views/permission/rolePermission/index.vue index 8c0e312..e2ed4ef 100644 --- a/src/views/permission/rolePermission/index.vue +++ b/src/views/permission/rolePermission/index.vue @@ -53,7 +53,7 @@ const handleGrant = () => { if (!menuTreeRef.value) { return } - const menuIdArr = menuTreeRef.value.getCheckedKeys(false) + const menuIdArr = menuTreeRef.value.getCheckedKeys(true) const menuIds = menuIdArr.join(',') assignPermission({ roleId: id, diff --git a/src/views/system/menu/index.vue b/src/views/system/menu/index.vue index 2065426..bde4019 100644 --- a/src/views/system/menu/index.vue +++ b/src/views/system/menu/index.vue @@ -249,6 +249,7 @@ const tableColumns = reactive>([ label: '菜单名称', prop: 'menuName', width: '200', + fixed: true, }, { label: '路由', diff --git a/vite.config.ts b/vite.config.ts index cbdbf5a..781338a 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -45,7 +45,7 @@ export default ({ command, mode }) => { https: false, // 运行服务是否以https方式 host: true, port: VITE_PORT, - open: true, + open: false, proxy: { [VITE_APP_BASE_URL]: { target: 'http://localhost:3102/', // 代理的目标地址-本地 -- Gitee