diff --git a/src/permission.js b/src/permission.js index 5157e9ec..678e038b 100644 --- a/src/permission.js +++ b/src/permission.js @@ -75,6 +75,9 @@ router.beforeEach(async (to, from, next) => { redirect = redirect.substring(0, redirect.indexOf('code')) } if (to.path === redirect) { + // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + next({ ...to, replace: true }) + } else { if (to.path === '/enterpriseStandardLibrary/enterpriseStandardDetail') { // 跳企标详情,需要判断是否能看详情 const params = {} @@ -85,18 +88,15 @@ router.beforeEach(async (to, from, next) => { } isCanLookDetail(params).then(res => { if (res.success && res.result) { - next({ ...to, replace: true }) + next({ path: redirect }) } else { next({ path: '/404' }) } }) } else { - // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - next({ ...to, replace: true }) + // 跳转到目的路由 + next({ path: redirect }) } - } else { - // 跳转到目的路由 - next({ path: redirect }) } }) })