diff --git a/public/config.js b/public/config.js index c8b0cba..51e105d 100644 --- a/public/config.js +++ b/public/config.js @@ -3,6 +3,8 @@ window._CONFIG = { ImageryProviderUrl: '/map/mapWX/{z}/{x}/{y}.jpg', RoadProviderUrl: '', TerrainProviderUrl: '/map/mapTerrain/', + showSystemMenu: false, + useThirdLogin: false, thirdLoginUrl: 'http://127.0.0.1:8080/thirdLogin', clientId: '0123456789', evaluationSrc: 'http://192.168.0.53:8088/thirdLogin/thirdLoginPage?username=admin', diff --git a/src/permission.js b/src/permission.js index 77e8dad..df88cc0 100644 --- a/src/permission.js +++ b/src/permission.js @@ -58,7 +58,7 @@ router.beforeEach((to, from, next) => { }) // 失败时,获取用户信息失败时,调用登出,来清空历史保留信息 store.dispatch('Logout').then(() => { - if (process.env.NODE_ENV === 'production') { + if (window._CONFIG.useThirdLogin) { openThirdLogin() } else { next({ path: loginRoutePath, query: { redirect: to.fullPath } }) @@ -74,7 +74,7 @@ router.beforeEach((to, from, next) => { // 在免登录名单,直接进入 next() } else { - if (process.env.NODE_ENV === 'production') { + if (window._CONFIG.useThirdLogin) { openThirdLogin() } else { next({ path: loginRoutePath, query: { redirect: to.fullPath } }) diff --git a/src/router/generator-routers.js b/src/router/generator-routers.js index 2cdee25..9c11eac 100644 --- a/src/router/generator-routers.js +++ b/src/router/generator-routers.js @@ -150,7 +150,7 @@ export const generatorDynamicRouter = (token) => { // 后端数据, 根级树数组, 根级 PID listToTree(data, childrenNav, '') console.log('childrenNav', childrenNav) - if (process.env.NODE_ENV !== 'production') { + if (window._CONFIG.showSystemMenu) { childrenNav.push(systemNav) } const routers = generator(childrenNav) diff --git a/src/utils/request.js b/src/utils/request.js index cfc0549..8cc2324 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -38,7 +38,7 @@ const errorHandler = (error) => { if (token) { store.dispatch('Logout').then(() => { setTimeout(() => { - if (process.env.NODE_ENV === 'production') { + if (window._CONFIG.useThirdLogin) { openThirdLogin() } else { window.location = '/user/login?redirect=' + window.location.pathname @@ -47,7 +47,7 @@ const errorHandler = (error) => { }) } else { setTimeout(() => { - if (process.env.NODE_ENV === 'production') { + if (window._CONFIG.useThirdLogin) { openThirdLogin() } else { window.location = '/user/login?redirect=' + window.location.pathname diff --git a/src/views/user/ThirdLogin.vue b/src/views/user/ThirdLogin.vue index dd6dca0..9092932 100644 --- a/src/views/user/ThirdLogin.vue +++ b/src/views/user/ThirdLogin.vue @@ -129,7 +129,7 @@ export default { onCancel() {}, }) } - if (process.env.NODE_ENV === 'production') { + if (window._CONFIG.useThirdLogin) { this.$store.dispatch('Logout').then(() => { openThirdLogin() })