支持mode配置history(表示去掉地址栏的#)

pull/145/head
RuoYi 2019-11-21 09:59:45 +08:00
parent 2c48aedda7
commit b05a539970
4 changed files with 38 additions and 15 deletions

View File

@ -482,10 +482,14 @@ $(function() {
// 设置锚点 // 设置锚点
function setIframeUrl(href) { function setIframeUrl(href) {
if($.common.equals("history", mode)) {
storage.set('publicPath', href);
} else {
var nowUrl = window.location.href; var nowUrl = window.location.href;
var newUrl = nowUrl.substring(0, nowUrl.indexOf("#")); var newUrl = nowUrl.substring(0, nowUrl.indexOf("#"));
window.location.href = newUrl + "#" + href; window.location.href = newUrl + "#" + href;
} }
}
$(window).keydown(function(event) { $(window).keydown(function(event) {
if (event.keyCode == 27) { if (event.keyCode == 27) {

View File

@ -247,7 +247,15 @@
<script th:src="@{/ajax/libs/fullscreen/jquery.fullscreen.js}"></script> <script th:src="@{/ajax/libs/fullscreen/jquery.fullscreen.js}"></script>
<script th:inline="javascript"> <script th:inline="javascript">
var ctx = [[@{/}]]; var ctx = [[@{/}]];
// 皮肤缓存
var skin = storage.get("skin"); var skin = storage.get("skin");
// history表示去掉地址的#)否则地址以"#"形式展示
var mode = "history";
// 历史访问路径缓存
var historyPath = storage.get("historyPath");
// 排除非左侧菜单链接
var excludesUrl = ["/system/user/profile"];
// 本地主题优先,未设置取系统配置 // 本地主题优先,未设置取系统配置
if($.common.isNotEmpty(skin)){ if($.common.isNotEmpty(skin)){
$("body").addClass(skin.split('|')[0]); $("body").addClass(skin.split('|')[0]);
@ -275,18 +283,27 @@ function switchSkin() {
}) })
} }
// 排除非左侧菜单链接 /** 刷新时访问路径页签 */
var excludesUrl = ["/system/user/profile"]; function applyPath(url) {
$(function() {
var hash = location.hash;
if (hash !== '') {
var url = hash.substring(1, hash.length);
$('a[href$="' + decodeURI(url) + '"]').click(); $('a[href$="' + decodeURI(url) + '"]').click();
if($.inArray(url, excludesUrl)){ if($.inArray(url, excludesUrl)){
$('a[href$="' + url + '"]').parent("li").addClass("selected").parents("li").addClass("active").end().parents("ul").addClass("in"); $('a[href$="' + url + '"]').parent("li").addClass("selected").parents("li").addClass("active").end().parents("ul").addClass("in");
} }
} }
$(function() {
if($.common.equals("history", mode) && window.performance.navigation.type == 1) {
var url = storage.get('publicPath');
if ($.common.isNotEmpty(url)) {
applyPath(url);
}
} else {
var hash = location.hash;
if ($.common.isNotEmpty(hash)) {
var url = hash.substring(1, hash.length);
applyPath(url);
}
}
}); });
</script> </script>
</body> </body>

View File

@ -199,7 +199,7 @@ public class ShiroConfig
* *
*/ */
@Bean @Bean
public SecurityManager securityManager(UserRealm userRealm, SpringSessionValidationScheduler springSessionValidationScheduler) public SecurityManager securityManager(UserRealm userRealm)
{ {
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager(); DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
// 设置realm. // 设置realm.

View File

@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.ruoyi.common.utils.Threads; import com.ruoyi.common.utils.Threads;
@ -39,6 +40,7 @@ public class SpringSessionValidationScheduler implements SessionValidationSchedu
*/ */
@Autowired @Autowired
@Qualifier("sessionManager") @Qualifier("sessionManager")
@Lazy
private ValidatingSessionManager sessionManager; private ValidatingSessionManager sessionManager;
// 相隔多久检查一次session的有效性单位毫秒默认就是10分钟 // 相隔多久检查一次session的有效性单位毫秒默认就是10分钟