From 141ce1516283e75289f882143293ce5816709a86 Mon Sep 17 00:00:00 2001 From: laozt <2721205210@qq.com> Date: Fri, 27 Oct 2023 14:42:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=A7=E6=B3=95=E7=9A=84=E5=8D=95=E7=82=B9?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E9=82=A3=E8=BE=B9=20=20=20=E4=BD=A0=E5=8A=A0?= =?UTF-8?q?=E4=B8=AA=E5=88=A4=E6=96=AD=20=20=E5=8F=96=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E6=B5=8F=E8=A7=88=E5=99=A8=E7=9A=84ip=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 10 +++++----- .env.production | 8 ++++---- src/layout/components/Navbar.vue | 5 ++++- src/layout/newyjLayout.vue | 5 ++++- src/permission.js | 10 ++++++++-- 5 files changed, 25 insertions(+), 13 deletions(-) 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(); } }