From 9f5ed82cdfe812662e96d164db1e43b6a06958c8 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 3 Dec 2019 18:02:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A8=E6=80=81=E5=8A=A0=E8=BD=BD=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=20=E9=A1=B5=E9=9D=A2=E5=88=B7=E6=96=B0=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/router/index.js | 14 ++++++++++++-- ruoyi-ui/src/store/modules/permission.js | 1 + ruoyi-ui/src/views/redirect.vue | 12 ++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 ruoyi-ui/src/views/redirect.vue diff --git a/ruoyi-ui/src/router/index.js b/ruoyi-ui/src/router/index.js index a31504908..b26536382 100644 --- a/ruoyi-ui/src/router/index.js +++ b/ruoyi-ui/src/router/index.js @@ -26,6 +26,17 @@ import Layout from '@/layout' // 公共路由 export const constantRoutes = [ + { + path: '/redirect', + component: Layout, + hidden: true, + children: [ + { + path: '/redirect/:path*', + component: () => import('@/views/redirect') + } + ] + }, { path: '/login', component: () => import('@/views/login'), @@ -93,8 +104,7 @@ export const constantRoutes = [ meta: { title: '修改生成配置' } } ] - }, - { path: '*', redirect: '/404', hidden: true } + } ] export default new Router({ diff --git a/ruoyi-ui/src/store/modules/permission.js b/ruoyi-ui/src/store/modules/permission.js index da937ae55..eb311642a 100644 --- a/ruoyi-ui/src/store/modules/permission.js +++ b/ruoyi-ui/src/store/modules/permission.js @@ -20,6 +20,7 @@ const permission = { // 向后端请求路由数据 getRouters().then(res => { const accessedRoutes = filterAsyncRouter(res.data) + accessedRoutes.push({ path: '*', redirect: '/404', hidden: true }) commit('SET_ROUTES', accessedRoutes) resolve(accessedRoutes) }) diff --git a/ruoyi-ui/src/views/redirect.vue b/ruoyi-ui/src/views/redirect.vue new file mode 100644 index 000000000..db4c1d66d --- /dev/null +++ b/ruoyi-ui/src/views/redirect.vue @@ -0,0 +1,12 @@ +