From 9a895763d55e147be355a2198ecfd33f66c2e746 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 23 Aug 2022 20:59:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=A1=B5=E9=9D=A2=E5=86=85?= =?UTF-8?q?=E5=B5=8Ciframe=E5=88=87=E6=8D=A2tab=E4=B8=8D=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/common/constant/Constants.java | 5 ++++ .../service/impl/SysMenuServiceImpl.java | 4 ++-- ruoyi-ui/src/store/modules/tagsView.js | 23 +++++++++++-------- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java index 2dbdbe64..87fa40fc 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java @@ -19,6 +19,11 @@ public class Constants */ public static final String GBK = "GBK"; + /** + * www主域 + */ + public static final String WWW = "www."; + /** * http请求 */ diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java index 604d60e6..481a9ec9 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java @@ -529,7 +529,7 @@ public class SysMenuServiceImpl implements ISysMenuService */ public String innerLinkReplaceEach(String path) { - return StringUtils.replaceEach(path, new String[] { Constants.HTTP, Constants.HTTPS }, - new String[] { "", "" }); + return StringUtils.replaceEach(path, new String[] { Constants.HTTP, Constants.HTTPS, Constants.WWW, "." }, + new String[] { "", "", "", "/" }); } } diff --git a/ruoyi-ui/src/store/modules/tagsView.js b/ruoyi-ui/src/store/modules/tagsView.js index 39c70cba..9a88c2bc 100644 --- a/ruoyi-ui/src/store/modules/tagsView.js +++ b/ruoyi-ui/src/store/modules/tagsView.js @@ -6,11 +6,12 @@ const state = { const mutations = { ADD_IFRAME_VIEW: (state, view) => { - if (state.iframeViews.some(v => v.path === view.path)) { - return - } else { - state.iframeViews.push(view) - } + if (state.iframeViews.some(v => v.path === view.path)) return + state.iframeViews.push( + Object.assign({}, view, { + title: view.meta.title || 'no-name' + }) + ) }, ADD_VISITED_VIEW: (state, view) => { if (state.visitedViews.some(v => v.path === view.path)) return @@ -87,10 +88,12 @@ const mutations = { if (i > -1) { state.cachedViews.splice(i, 1) } + if(item.meta.link) { + const fi = state.iframeViews.findIndex(v => v.path === item.path) + state.iframeViews.splice(fi, 1) + } return false }) - const iframeIndex = state.iframeViews.findIndex(v => v.path === view.path) - state.iframeViews = state.iframeViews.filter((item, idx) => idx <= iframeIndex) }, DEL_LEFT_VIEWS: (state, view) => { const index = state.visitedViews.findIndex(v => v.path === view.path) @@ -105,10 +108,12 @@ const mutations = { if (i > -1) { state.cachedViews.splice(i, 1) } + if(item.meta.link) { + const fi = state.iframeViews.findIndex(v => v.path === item.path) + state.iframeViews.splice(fi, 1) + } return false }) - const iframeIndex = state.iframeViews.findIndex(v => v.path === view.path) - state.iframeViews = state.iframeViews.filter((item, idx) => idx >= iframeIndex) } }