diff --git a/.env.development b/.env.development index 36d77b4..cf0670c 100644 --- a/.env.development +++ b/.env.development @@ -2,7 +2,7 @@ # @Author: 张涛 # @Date: 2023-07-18 13:04:50 # @LastEditors: 张涛 - # @LastEditTime: 2023-10-18 16:40:13 + # @LastEditTime: 2023-10-27 14:12:24 # @FilePath: \suzhouyingjiPC\.env.development ### # 页面标题 @@ -17,16 +17,16 @@ VUE_APP_BASE_API = 'http://localhost:13002' # VUE_APP_BASE_API = 'http://180.108.205.123:13002' # 统一登录-内网 -# VUE_APP_SSO_LOGIN = 'http://2.46.4.197:8090/sso-server/oauth2/sso?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F&response_type=code' +VUE_APP_SSO_LOGIN_N = 'http://2.46.4.197:8090/sso-server/oauth2/sso?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F&response_type=code' # 退出登录-内网 -# VUE_APP_SSO_LOGOUT ='http://2.46.4.197:8090/sso-server/oauth2/logout?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F' +VUE_APP_SSO_LOGOUT_N ='http://2.46.4.197:8090/sso-server/oauth2/logout?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F' # 统一登录-外网 -VUE_APP_SSO_LOGIN = 'http://180.108.205.123:8090/sso-server/oauth2/sso?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F&response_type=code' +VUE_APP_SSO_LOGIN_W = 'http://180.108.205.123:8090/sso-server/oauth2/sso?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F&response_type=code' # 退出登录-外网 -VUE_APP_SSO_LOGOUT ='http://180.108.205.123:8090/sso-server/oauth2/logout?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F' +VUE_APP_SSO_LOGOUT_W ='http://180.108.205.123:8090/sso-server/oauth2/logout?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F' # 路由懒加载 VUE_CLI_BABEL_TRANSPILE_MODULES = true diff --git a/.env.production b/.env.production index b4d3c2e..9741b85 100644 --- a/.env.production +++ b/.env.production @@ -10,16 +10,16 @@ ENV = 'production' VUE_APP_BASE_API = 'http://180.108.205.123:13002' n # 统一登录-内网 -# VUE_APP_SSO_LOGIN = 'http://2.46.4.197:8090/sso-server/oauth2/sso?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F&response_type=code' +VUE_APP_SSO_LOGIN_N = 'http://2.46.4.197:8090/sso-server/oauth2/sso?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F&response_type=code' # 退出登录-内网 -# VUE_APP_SSO_LOGOUT ='http://2.46.4.197:8090/sso-server/oauth2/logout?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F' +VUE_APP_SSO_LOGOUT_N ='http://2.46.4.197:8090/sso-server/oauth2/logout?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F' # 统一登录-外网 -VUE_APP_SSO_LOGIN = 'http://180.108.205.123:8090/sso-server/oauth2/sso?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F&response_type=code' +VUE_APP_SSO_LOGIN_W = 'http://180.108.205.123:8090/sso-server/oauth2/sso?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F&response_type=code' # 退出登录-外网 -VUE_APP_SSO_LOGOUT ='http://180.108.205.123:8090/sso-server/oauth2/logout?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F' +VUE_APP_SSO_LOGOUT_W ='http://180.108.205.123:8090/sso-server/oauth2/logout?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F' # 路由懒加载 VUE_CLI_BABEL_TRANSPILE_MODULES = true \ No newline at end of file diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index be221f5..2ca486d 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -135,7 +135,10 @@ export default { ); if (isGovernmentAffairsNetwork == "1") { localStorage.removeItem("isGovernmentAffairsNetwork"); - location.href = process.env.VUE_APP_SSO_LOGOUT; + location.href = + window.location.hostname == "180.108.205.123" + ? process.env.VUE_APP_SSO_LOGOUT_W + : process.env.VUE_APP_SSO_LOGOUT_N; } else { localStorage.removeItem("isGovernmentAffairsNetwork"); location.href = "/login?redirect=%2Findex"; diff --git a/src/layout/newyjLayout.vue b/src/layout/newyjLayout.vue index eb97ddb..7d85594 100644 --- a/src/layout/newyjLayout.vue +++ b/src/layout/newyjLayout.vue @@ -130,7 +130,10 @@ export default { // console.log("进入跳转政务网的登录页"); if (isGovernmentAffairsNetwork == "1") { localStorage.removeItem("isGovernmentAffairsNetwork"); - location.href = process.env.VUE_APP_SSO_LOGOUT; + location.href = + window.location.hostname == "180.108.205.123" + ? process.env.VUE_APP_SSO_LOGOUT_W + : process.env.VUE_APP_SSO_LOGOUT_N; } else { localStorage.removeItem("isGovernmentAffairsNetwork"); location.href = "/login?redirect=%2Findex"; diff --git a/src/permission.js b/src/permission.js index b9c9685..9c7cd92 100644 --- a/src/permission.js +++ b/src/permission.js @@ -82,7 +82,10 @@ router.beforeEach((to, from, next) => { }); }) .catch((err) => { - location.href = process.env.VUE_APP_SSO_LOGIN; + location.href = + window.location.hostname == "180.108.205.123" + ? process.env.VUE_APP_SSO_LOGIN_W + : process.env.VUE_APP_SSO_LOGIN_N; }); } else { // console.log('没code') @@ -91,7 +94,10 @@ router.beforeEach((to, from, next) => { next(); NProgress.done(); } else { - location.href = process.env.VUE_APP_SSO_LOGIN; + location.href = + window.location.hostname == "180.108.205.123" + ? process.env.VUE_APP_SSO_LOGIN_W + : process.env.VUE_APP_SSO_LOGIN_N; NProgress.done(); } }