diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/index.js b/ruoyi-admin/src/main/resources/static/ruoyi/index.js index 04f67f3d..b4f8ba29 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; // 选项卡菜单已存在 @@ -469,6 +470,13 @@ $(function() { $('#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'); @@ -476,6 +484,12 @@ $(function() { } }); + 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 ee75bd2a..d799bcff 100644 --- a/ruoyi-admin/src/main/resources/templates/index.html +++ b/ruoyi-admin/src/main/resources/templates/index.html @@ -27,9 +27,11 @@ -
  • +
  • 主页