From 0a87850bce2e6fb59d0e3ce9889a45a425d94dcf Mon Sep 17 00:00:00 2001 From: wxz Date: Tue, 24 Sep 2024 09:50:55 +0800 Subject: [PATCH] =?UTF-8?q?add:=E5=A6=82=E6=9E=9C=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E8=B7=AF=E7=94=B1=E4=B8=BAtarget=3D=5Fblank,=E5=88=99=E7=94=A8?= =?UTF-8?q?window.open()=E6=89=93=E5=BC=80=E6=96=B0=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index 2702594d8..0ad413443 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -942,9 +942,20 @@ const router = new Router({ }), routes: pageRoutes.concat(moduleRoutes, moduleShujuRoutes, dataBoardRoutes), }); + router.beforeEach((to, from, next) => { // 添加动态(菜单)路由 // 已添加或者当前路由为页面路由, 可直接访问 + let toUrl = to.meta.iframeURL + if (toUrl && toUrl.indexOf("target=_blank") != -1) { + // 此处请求后端,获取一个ticket票据 + http.get("/auth/sso/getTicket") + .then(({data: res}) => { + let ticket = res.data + window.open(toUrl + ticket) + }) + return null; + } if (to.name === "caiji") { return next(); } @@ -982,7 +993,7 @@ router.beforeEach((to, from, next) => { }); return next({ name: "login", - query: { redirect: to.fullPath } + query: { redirect: to.fullPath } }); } window.SITE_CONFIG["menuShujuList"] = res.data; @@ -996,7 +1007,7 @@ router.beforeEach((to, from, next) => { console.log(err); next({ name: "login", - query: { redirect: to.fullPath } + query: { redirect: to.fullPath } }); }); http @@ -1013,7 +1024,7 @@ router.beforeEach((to, from, next) => { }); return next({ name: "login", - query: { redirect: to.fullPath } + query: { redirect: to.fullPath } }); } window.SITE_CONFIG["menuList"] = res.data @@ -1031,7 +1042,7 @@ router.beforeEach((to, from, next) => { console.log(err); next({ name: "login", - query: { redirect: to.fullPath } + query: { redirect: to.fullPath } }); }); });