From 5b5e905089d2645a080d6ca3575c3561c170a461 Mon Sep 17 00:00:00 2001 From: sxile <3440626@qq.com> Date: Tue, 12 Nov 2019 13:52:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81iframe=E5=B1=80=E9=83=A8?= =?UTF-8?q?=E5=88=B7=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/main/resources/static/ruoyi/index.js | 17 +++++++++++++++-- .../src/main/resources/templates/index.html | 19 +++++++++++++++---- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/index.js b/ruoyi-admin/src/main/resources/static/ruoyi/index.js index 1c85648..93d4883 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/index.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/index.js @@ -219,6 +219,7 @@ $(function() { flag = true; $(".nav ul li, .nav li").removeClass("selected"); $(this).parent("li").addClass("selected"); + setIframeUrl($(this).attr("href")); if (dataUrl == undefined || $.trim(dataUrl).length == 0) return false; // 选项卡菜单已存在 @@ -468,14 +469,26 @@ $(function() { $('#content-main').toggleClass('max'); $('#ax_close_max').show(); } - + // 设置锚点 + function setIframeUrl(href) { + var nowUrl = window.location.href; + var newUrl = nowUrl.substring(0, nowUrl.indexOf("#")); + window.location.href = newUrl + "#" + href; + } + $(window).keydown(function(event) { if (event.keyCode == 27) { $('#content-main').removeClass('max'); $('#ax_close_max').hide(); } }); - + + window.onhashchange = function() { + var hash = location.hash; + var url = hash.substring(1, hash.length); + $('a[href$="' + url + '"]').click(); + }; + // 右键菜单实现 $.contextMenu({ selector: ".menuTab", diff --git a/ruoyi-admin/src/main/resources/templates/index.html b/ruoyi-admin/src/main/resources/templates/index.html index 5a75977..3b19cfb 100644 --- a/ruoyi-admin/src/main/resources/templates/index.html +++ b/ruoyi-admin/src/main/resources/templates/index.html @@ -27,9 +27,11 @@ -
  • +
  • 主页