移动端登录不显示左侧菜单

master
RuoYi 5 years ago committed by Limy
parent fee7a85d69
commit d76adfc7a4

@ -7,6 +7,8 @@ layer.config({
skin: 'layer-ext-moon' skin: 'layer-ext-moon'
}); });
var isMobile = $.common.isMobile() || $(window).width() < 769;
$(function() { $(function() {
// MetsiMenu // MetsiMenu
$('#side-menu').metisMenu(); $('#side-menu').metisMenu();
@ -22,14 +24,19 @@ $(function() {
// 菜单切换 // 菜单切换
$('.navbar-minimalize').click(function() { $('.navbar-minimalize').click(function() {
$("body").toggleClass("mini-navbar"); if (isMobile) {
$("body").toggleClass("canvas-menu");
} else {
$("body").toggleClass("mini-navbar");
}
SmoothlyMenu(); SmoothlyMenu();
}); });
$('#side-menu>li').click(function() { $('#side-menu>li').click(function() {
if ($('body').hasClass('mini-navbar')) { if ($('body').hasClass('canvas-menu mini-navbar')) {
NavToggle(); NavToggle();
} }
}); });
$('#side-menu>li li a').click(function() { $('#side-menu>li li a').click(function() {
if ($(window).width() < 769) { if ($(window).width() < 769) {
@ -49,9 +56,8 @@ $(function() {
$(window).bind("load resize", $(window).bind("load resize",
function() { function() {
if ($(this).width() < 769) { if ($(this).width() < 769) {
$('body').addClass('mini-navbar'); $('body').addClass('canvas-menu');
$('.navbar-static-side').fadeIn(); $("nav .logo").addClass("hide");
$(".sidebar-collapse .logo").addClass("hide");
$(".slimScrollDiv").css({ "overflow":"hidden" }) $(".slimScrollDiv").css({ "overflow":"hidden" })
} }
}); });
@ -60,21 +66,27 @@ function NavToggle() {
$('.navbar-minimalize').trigger('click'); $('.navbar-minimalize').trigger('click');
} }
function fixedSidebar() {
$('#side-menu').hide();
$("nav .logo").addClass("hide");
setTimeout(function() {
$('#side-menu').fadeIn(500);
},
100);
}
function SmoothlyMenu() { function SmoothlyMenu() {
if (!$('body').hasClass('mini-navbar')) { if (isMobile && !$('body').hasClass('canvas-menu')) {
$('#side-menu').hide(); $('.navbar-static-side').fadeIn();
$(".sidebar-collapse .logo").removeClass("hide"); fixedSidebar();
setTimeout(function() { } else if (!isMobile &&!$('body').hasClass('mini-navbar')) {
$('#side-menu').fadeIn(500); fixedSidebar();
}, $("nav .logo").removeClass("hide");
100); } else if (isMobile && $('body').hasClass('fixed-sidebar')) {
} else if ($('body').hasClass('fixed-sidebar')) { $('.navbar-static-side').fadeOut();
$('#side-menu').hide(); fixedSidebar();
$(".sidebar-collapse .logo").addClass("hide"); } else if (!isMobile && $('body').hasClass('fixed-sidebar')) {
setTimeout(function() { fixedSidebar();
$('#side-menu').fadeIn(500);
},
300);
} else { } else {
$('#side-menu').removeAttr('style'); $('#side-menu').removeAttr('style');
} }
@ -591,4 +603,4 @@ $(function() {
}, },
} }
}) })
}); });

@ -711,7 +711,7 @@ var table = {
// 弹出层指定宽度 // 弹出层指定宽度
open: function (title, url, width, height, callback) { open: function (title, url, width, height, callback) {
//如果是移动端,就使用自适应大小弹窗 //如果是移动端,就使用自适应大小弹窗
if (navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)) { if ($.common.isMobile()) {
width = 'auto'; width = 'auto';
height = 'auto'; height = 'auto';
} }
@ -783,7 +783,7 @@ var table = {
// 弹出层全屏 // 弹出层全屏
openFull: function (title, url, width, height) { openFull: function (title, url, width, height) {
//如果是移动端,就使用自适应大小弹窗 //如果是移动端,就使用自适应大小弹窗
if (navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)) { if ($.common.isMobile()) {
width = 'auto'; width = 'auto';
height = 'auto'; height = 'auto';
} }
@ -896,7 +896,7 @@ var table = {
var _width = $.common.isEmpty(width) ? "800" : width; var _width = $.common.isEmpty(width) ? "800" : width;
var _height = $.common.isEmpty(height) ? ($(window).height() - 50) : height; var _height = $.common.isEmpty(height) ? ($(window).height() - 50) : height;
//如果是移动端,就使用自适应大小弹窗 //如果是移动端,就使用自适应大小弹窗
if (navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)) { if ($.common.isMobile()) {
_width = 'auto'; _width = 'auto';
_height = 'auto'; _height = 'auto';
} }
@ -1487,7 +1487,11 @@ var table = {
}   }  
} }
return count; return count;
} },
// 判断移动端
isMobile: function () {
return navigator.userAgent.match(/(Android|iPhone|SymbianOS|Windows Phone|iPad|iPod)/i);
},
} }
}); });
})(jQuery); })(jQuery);

@ -26,7 +26,7 @@
<i class="fa fa-times-circle"></i> <i class="fa fa-times-circle"></i>
</div> </div>
<a th:href="@{/index}"> <a th:href="@{/index}">
<li class="logo"> <li class="logo hidden-xs">
<span class="logo-lg">RuoYi</span> <span class="logo-lg">RuoYi</span>
</li> </li>
</a> </a>

Loading…
Cancel
Save