diff --git a/nezha-fronted/src/permission.js b/nezha-fronted/src/permission.js index b1cc10df3..d05fad303 100644 --- a/nezha-fronted/src/permission.js +++ b/nezha-fronted/src/permission.js @@ -48,8 +48,32 @@ router.beforeEach((to, from, next) => { store.commit('setButtonList', arr) store.commit('setRoleList', res.data.roles) bus.$emit('login') + const path = [] + if (menuList) { + menuList.forEach(e => { + if (e.route) { + path.push(e.route) + } else { + if (e.children) { + e.children.forEach(e => { + if (e.route) { + path.push(e.route) + } else { + if (e.children) { + e.children.forEach(e => { + if (e.route) { + path.push(e.route) + } + }) + } + } + }) + } + } + }) + } router.push({ - path: menuList[0].children[0].route, + path: path[0], query: { t: +new Date() } diff --git a/nezha-fronted/src/store/user.js b/nezha-fronted/src/store/user.js index cbfdb9dbc..499c86c44 100644 --- a/nezha-fronted/src/store/user.js +++ b/nezha-fronted/src/store/user.js @@ -86,8 +86,32 @@ const user = { store.commit('setButtonList', arr) store.commit('setRoleList', res.data.roles) bus.$emit('login') + const path = [] + if (menuList) { + menuList.forEach(e => { + if (e.route) { + path.push(e.route) + } else { + if (e.children) { + e.children.forEach(e => { + if (e.route) { + path.push(e.route) + } else { + if (e.children) { + e.children.forEach(e => { + if (e.route) { + path.push(e.route) + } + }) + } + } + }) + } + } + }) + } router.push({ - path: menuList[0].children[0].route, + path: path[0], query: { t: +new Date() }