From c1f0505fb903db78ffef46b8431168acb047af90 Mon Sep 17 00:00:00 2001 From: laozt <2721205210@qq.com> Date: Tue, 17 Oct 2023 14:52:03 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E9=80=80=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 2 +- .env.production | 2 +- src/layout/components/Navbar.vue | 33 +++----------------------------- src/layout/newyjLayout.vue | 22 ++++++--------------- src/permission.js | 11 +++-------- 5 files changed, 14 insertions(+), 56 deletions(-) diff --git a/.env.development b/.env.development index ab0b6d5..176715a 100644 --- a/.env.development +++ b/.env.development @@ -18,7 +18,7 @@ VUE_APP_BASE_API = 'http://180.108.205.123:13002' # 政务网 # VUE_APP_LOCATION = 'http://2.46.4.197:8090' # 外网 -VUE_APP_LOCATION = 'http://180.108.205.123:8090' +VUE_APP_LOCATION = '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' # 路由懒加载 diff --git a/.env.production b/.env.production index 35c93e9..e31be43 100644 --- a/.env.production +++ b/.env.production @@ -9,7 +9,7 @@ ENV = 'production' # VUE_APP_BASE_API = 'http://39.101.188.84:9033' VUE_APP_BASE_API = 'http://180.108.205.123:13002' -VUE_APP_LOCATION = 'http://2.46.4.197:8090' +VUE_APP_LOCATION = 'http://2.46.4.197:8090/sso-server/oauth2/sso?aid=77434376&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F&response_type=code' # 路由懒加载 diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index 8a61dca..0b74a9f 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -51,23 +51,6 @@ - - @@ -138,23 +121,13 @@ export default { }) .then(() => { this.$store.dispatch("LogOut").then(() => { - // location.href = process.env.NODE_ENV === "production" - // ? "/demo/suzhouyingjiPC/" - // : "/"; - let isGovernmentAffairsNetwork = localStorage.getItem( "isGovernmentAffairsNetwork" ); - if (process.env.NODE_ENV === "production") { - if (isGovernmentAffairsNetwork == "1") { - location.href = - process.env.VUE_APP_LOCATION + - "/sso-server/oauth2/sso?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F&response_type=code"; - } else { - location.href = "/login"; - } + if (isGovernmentAffairsNetwork == "1") { + location.href = process.env.VUE_APP_LOCATION; } else { - location.href = "/"; + location.href = "/login?redirect=%2Findex"; } }); }) diff --git a/src/layout/newyjLayout.vue b/src/layout/newyjLayout.vue index 308e474..6849077 100644 --- a/src/layout/newyjLayout.vue +++ b/src/layout/newyjLayout.vue @@ -51,13 +51,13 @@ 退出登录 -
进入管理平台 -
+ -->
@@ -112,24 +112,14 @@ export default { }) .then(() => { this.$store.dispatch("LogOut").then(() => { - // location.href = process.env.NODE_ENV === "production" - // ? "/demo/suzhouyingjiPC/" - // : "/"; let isGovernmentAffairsNetwork = localStorage.getItem( "isGovernmentAffairsNetwork" ); - if (process.env.NODE_ENV === "production") { - console.log("production"); - if (isGovernmentAffairsNetwork == "1") { - console.log("进入跳转政务网的登录页"); - location.href = - process.env.VUE_APP_LOCATION + - "/sso-server/oauth2/sso?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F&response_type=code"; - } else { - location.href = "/login"; - } + if (isGovernmentAffairsNetwork == "1") { + // console.log("进入跳转政务网的登录页"); + location.href = process.env.VUE_APP_LOCATION; } else { - location.href = "/"; + location.href = "/login?redirect=%2Findex"; } }); }) diff --git a/src/permission.js b/src/permission.js index ccd3239..5b72ccb 100644 --- a/src/permission.js +++ b/src/permission.js @@ -30,7 +30,7 @@ router.beforeEach((to, from, next) => { isRelogin.show = false; store.dispatch("GenerateRoutes").then((accessRoutes) => { // 根据roles权限生成可访问的路由表 - console.log(res); + // console.log(res); router.addRoutes(accessRoutes); // 动态添加可访问路由表 //刷新之后,要去的路由肯定是自己已经保存过的新路由 let refresh = ""; @@ -83,21 +83,16 @@ router.beforeEach((to, from, next) => { }); }) .catch((err) => { - location.href = - process.env.VUE_APP_LOCATION + - "/sso-server/oauth2/sso?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F&response_type=code"; + location.href = process.env.VUE_APP_LOCATION; }); } else { // console.log('没code') - // location.href = process.env.VUE_APP_LOCATION + '/sso-server/oauth2/sso?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F' if (whiteList.indexOf(to.path) !== -1) { // 在免登录白名单,直接进入 next(); NProgress.done(); } else { - location.href = - process.env.VUE_APP_LOCATION + - "/sso-server/oauth2/sso?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F&response_type=code"; + location.href = process.env.VUE_APP_LOCATION; NProgress.done(); } }