|
@@ -19,7 +19,7 @@ router.beforeEach(async(to, from, next) => {
|
|
|
|
|
|
// determine whether the user has logged in
|
|
// determine whether the user has logged in
|
|
const hasToken = getToken()
|
|
const hasToken = getToken()
|
|
-
|
|
|
|
|
|
+
|
|
console.log('hasToken==>',hasToken)
|
|
console.log('hasToken==>',hasToken)
|
|
if (hasToken) {
|
|
if (hasToken) {
|
|
if (to.path === '/login') {
|
|
if (to.path === '/login') {
|
|
@@ -41,7 +41,7 @@ router.beforeEach(async(to, from, next) => {
|
|
|
|
|
|
// generate accessible routes map based on roles
|
|
// generate accessible routes map based on roles
|
|
const accessRoutes = await store.dispatch('permission/generateRoutes', roles)
|
|
const accessRoutes = await store.dispatch('permission/generateRoutes', roles)
|
|
-
|
|
|
|
|
|
+ console.log(accessRoutes,'accessRoutes')
|
|
// dynamically add accessible routes
|
|
// dynamically add accessible routes
|
|
router.addRoutes(accessRoutes)
|
|
router.addRoutes(accessRoutes)
|
|
|
|
|
|
@@ -74,12 +74,16 @@ router.beforeEach(async(to, from, next) => {
|
|
NProgress.done()
|
|
NProgress.done()
|
|
// next({ path: '/login' })
|
|
// next({ path: '/login' })
|
|
// 构建要跳转的URL
|
|
// 构建要跳转的URL
|
|
- // const externalURL = "https://id.xiandaimuye.com/api/v1/oauth2/authorize?response_type=code&client_id=fTBm64I4k3kqHYtoFTUpvirCDxxCfx7I&redirect_uri=http://tmrwatch.cn:8082/api/v1/oauth2/token";
|
|
|
|
|
|
+ const externalURL = "https://id.xiandaimuye.com/api/v1/oauth2/authorize?response_type=code&client_id=fTBm64I4k3kqHYtoFTUpvirCDxxCfx7I&redirect_uri=http://tmrwatch.cn:8082/api/v1/oauth2/token";
|
|
// 使用 $router.push 进行页面跳转
|
|
// 使用 $router.push 进行页面跳转
|
|
// 注意: 这里的跳转是在当前窗口进行的,如果需要在新标签页打开,可以使用 window.open(externalURL)
|
|
// 注意: 这里的跳转是在当前窗口进行的,如果需要在新标签页打开,可以使用 window.open(externalURL)
|
|
- // window.open(externalURL, "_self");
|
|
|
|
|
|
+ window.open(externalURL, "_self");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ // 使用 $router.push 进行页面跳转
|
|
|
|
+ // 注意: 这里的跳转是在当前窗口进行的,如果需要在新标签页打开,可以使用 window.open(externalURL)
|
|
|
|
+ // window.open(url1, "_self");
|
|
})
|
|
})
|
|
|
|
|
|
router.afterEach(() => {
|
|
router.afterEach(() => {
|