[update] 修改跳转企标详情的判断

This commit is contained in:
lideqin
2023-11-01 18:02:53 +08:00
parent 2b2b67aa94
commit 5193f9bcec
+6 -6
View File
@@ -75,6 +75,9 @@ router.beforeEach(async (to, from, next) => {
redirect = redirect.substring(0, redirect.indexOf('code')) redirect = redirect.substring(0, redirect.indexOf('code'))
} }
if (to.path === redirect) { 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') { if (to.path === '/enterpriseStandardLibrary/enterpriseStandardDetail') {
// 跳企标详情,需要判断是否能看详情 // 跳企标详情,需要判断是否能看详情
const params = {} const params = {}
@@ -85,18 +88,15 @@ router.beforeEach(async (to, from, next) => {
} }
isCanLookDetail(params).then(res => { isCanLookDetail(params).then(res => {
if (res.success && res.result) { if (res.success && res.result) {
next({ ...to, replace: true }) next({ path: redirect })
} else { } else {
next({ path: '/404' }) next({ path: '/404' })
} }
}) })
} else { } 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 })
} }
}) })
}) })