From bb0e7bd5634fed14d57961124ef70a95101e840e Mon Sep 17 00:00:00 2001 From: RuoYi Date: Sun, 28 Jun 2020 09:49:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=B3=E9=94=AE=E9=A1=B5=E7=AD=BE=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E5=AE=9E=E7=8E=B0=E4=B8=8E=E8=8F=9C=E5=8D=95=E8=81=94?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/static/ruoyi/index.js | 31 +++++++++---------- .../src/main/resources/templates/index.html | 6 ---- 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/index.js b/ruoyi-admin/src/main/resources/static/ruoyi/index.js index 84b744bba..8fdd22c4a 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/index.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/index.js @@ -71,16 +71,20 @@ $(window).bind("load resize", function() { } } }); + function syncMenuTab(dataId) { - var $dataObj = $('a[href$="' + decodeURI(dataId) + '"]'); - if (!$dataObj.hasClass("noactive")) { - $('.nav ul').removeClass("in"); - $dataObj.parents("ul").addClass("in") - $dataObj.parents("li").addClass("active").siblings().removeClass("active").find('li').removeClass("active"); - $dataObj.parents("ul").css('height', 'auto').height(); - $dataObj.click(); - } + if(isLinkage) { + var $dataObj = $('a[href$="' + decodeURI(dataId) + '"]'); + if (!$dataObj.hasClass("noactive")) { + $('.nav ul').removeClass("in"); + $dataObj.parents("ul").addClass("in") + $dataObj.parents("li").addClass("active").siblings().removeClass("active").find('li').removeClass("active"); + $dataObj.parents("ul").css('height', 'auto').height(); + $dataObj.click(); + } + } } + function NavToggle() { $('.navbar-minimalize').trigger('click'); } @@ -128,6 +132,7 @@ $(function() { function setActiveTab(element) { if (!$(element).hasClass('active')) { var currentId = $(element).data('id'); + syncMenuTab(currentId); // 显示tab对应的内容区 $('.RuoYi_iframe').each(function() { if ($(this).data('id') == currentId) { @@ -395,8 +400,6 @@ $(function() { }); } scrollToTab($('.menuTab.active')); - setIframeUrl($('.page-tabs-content').find('.active').attr('data-id')); - syncMenuTab($('.page-tabs-content').find('.active').attr('data-id')); return false; } @@ -413,6 +416,7 @@ $(function() { function activeTab() { if (!$(this).hasClass('active')) { var currentId = $(this).data('id'); + syncMenuTab(currentId); // 显示tab对应的内容区 $('.mainContent .RuoYi_iframe').each(function() { if ($(this).data('id') == currentId) { @@ -455,7 +459,6 @@ $(function() { $(this).remove(); }); $('.page-tabs-content').css("margin-left", "0"); - setIframeUrl($('.page-tabs-content').find('.active').attr('data-id')); } // 关闭全部选项卡 @@ -469,7 +472,7 @@ $(function() { $(this).addClass("active"); }); $('.page-tabs-content').css("margin-left", "0"); - setIframeUrl($('.page-tabs-content').find('.active').attr('data-id')); + syncMenuTab($('.page-tabs-content').find('.active').attr('data-id')); } @@ -562,7 +565,6 @@ $(function() { callback: function(key, opt) { setActiveTab(this); tabCloseOther(); - syncMenuTab($('.page-tabs-content').find('.active').attr('data-id')); } }, "close_left": { @@ -578,7 +580,6 @@ $(function() { $(this).remove(); }); $('.page-tabs-content').css("margin-left", "0"); - syncMenuTab($('.page-tabs-content').find('.active').attr('data-id')); } }, "close_right": { @@ -590,7 +591,6 @@ $(function() { $('.menuTab[data-id="' + $(this).data('id') + '"]').remove(); $(this).remove(); }); - syncMenuTab($('.page-tabs-content').find('.active').attr('data-id')); } }, "close_all": { @@ -598,7 +598,6 @@ $(function() { icon: "fa-window-close", callback: function(key, opt) { tabCloseAll(); - syncMenuTab($('.page-tabs-content').find('.active').attr('data-id')); } }, "step": "---------", diff --git a/ruoyi-admin/src/main/resources/templates/index.html b/ruoyi-admin/src/main/resources/templates/index.html index d47f14451..270d79827 100644 --- a/ruoyi-admin/src/main/resources/templates/index.html +++ b/ruoyi-admin/src/main/resources/templates/index.html @@ -307,12 +307,6 @@ $(function() { applyPath(url); } } - if(isLinkage) { - $(".menuTabs").on("click", ".menuTab", function() { - var dataId = $(this).attr("data-id"); - syncMenuTab(dataId); - }) - } });