/* * Copyright 2018 本系统版权归成都睿思商智科技有限公司所有 * 用户不能删除系统源码上的版权信息, 使用许可证地址: * https://www.ruisitech.com/licenses/index.html */ //自定义js //公共配置 $(document).ready(function () { // MetsiMenu $('#side-menu').metisMenu(); //固定菜单栏 $(function () { $('.sidebar-collapse').slimScroll({ height: '100%', railOpacity: 0.9, alwaysVisible: false }); }); // 侧边栏高度 function fix_height() { var heightWithoutNavbar = $("body > #wrapper").height() - 61; $(".sidebard-panel").css("min-height", heightWithoutNavbar + "px"); } fix_height(); $(window).bind("load resize click scroll", function () { if (!$("body").hasClass('body-small')) { fix_height(); } }); //侧边栏滚动 $(window).scroll(function () { if ($(window).scrollTop() > 0 && !$('body').hasClass('fixed-nav')) { $('#right-sidebar').addClass('sidebar-top'); } else { $('#right-sidebar').removeClass('sidebar-top'); } }); $('.full-height-scroll').slimScroll({ height: '100%' }); /** // 打开右侧边栏 $('.right-sidebar-toggle').click(function () { $('#right-sidebar').toggleClass('sidebar-open'); }); // 菜单切换 $('.navbar-minimalize').click(function () { $("body").toggleClass("mini-navbar"); SmoothlyMenu(); }); // 侧边栏高度 function fix_height() { var heightWithoutNavbar = $("body > #wrapper").height() - 61; $(".sidebard-panel").css("min-height", heightWithoutNavbar + "px"); } fix_height(); $(window).bind("load resize click scroll", function () { if (!$("body").hasClass('body-small')) { fix_height(); } }); //侧边栏滚动 $(window).scroll(function () { if ($(window).scrollTop() > 0 && !$('body').hasClass('fixed-nav')) { $('#right-sidebar').addClass('sidebar-top'); } else { $('#right-sidebar').removeClass('sidebar-top'); } }); $('.full-height-scroll').slimScroll({ height: '100%' }); $('#side-menu>li').click(function () { if ($('body').hasClass('mini-navbar')) { NavToggle(); } }); $('#side-menu>li li a').click(function () { if ($(window).width() < 769) { NavToggle(); } }); $('.nav-close').click(NavToggle); //ios浏览器兼容性处理 if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) { $('#content-main').css('overflow-y', 'auto'); } **/ $('#side-menu>li').click(function () { if ($('body').hasClass('mini-navbar')) { NavToggle(); } }); $('#side-menu>li li a').click(function () { if ($(window).width() < 769) { NavToggle(); } }); //ios浏览器兼容性处理 if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) { $('#content-main').css('overflow-y', 'auto'); } //右上角tab控制按钮 var closeevent = null; $("#taboptbtn").hover(function(){ var p = $(this).offset(); var l = p.left; var t = p.top; $("#taboptdiv").css({top:t+40, left:l-70,minWidth:120}).show(); }, function(){ closeevent = window.setTimeout(function(){ $("#taboptdiv").hide('fast'); }, 200); }); $("#taboptdiv").hover(function(){ if(closeevent){ clearTimeout(closeevent); closeevent = null; } }, function(){ $(this).hide('fast'); }); var closeuinfoevent = null; $("#uinfobtn").hover(function(){ var p = $(this).offset(); var l = p.left; var t = p.top; $("#uinfodiv").css({top:t+26,left:l}).show(); }, function(){ closeuinfoevent = window.setTimeout(function(){ $("#uinfodiv").hide('fast'); }, 200); }); $("#uinfodiv").hover(function(){ if(closeuinfoevent){ clearTimeout(closeuinfoevent); closeuinfoevent = null; } }, function(){ $(this).hide('fast'); }); //点击后窗口关闭事件 $("#uinfodiv li a").click(function(){ $("#uinfodiv").hide('fast'); }); $("#taboptdiv li a").click(function(){ $("#taboptdiv").hide('fast'); }); }); /** function showusermenu(ts){ var p = $(ts).offset(); var l = p.left; var t = p.top; $("#uinfodiv").css({top:t+25, left:l}).show(); } **/ function swatch(ts){ if($("body").hasClass("mini-navbar")){ $('body').removeClass('mini-navbar'); $(ts).removeClass("swatchBtn"); }else{ $('body').addClass('mini-navbar'); $(ts).addClass("swatchBtn"); } SmoothlyMenu(); } $(window).bind("load resize", function () { if ($(this).width() < 769) { $('body').addClass('mini-navbar'); $('.navbar-static-side').fadeIn(); } }); function NavToggle() { swatch(); } function SmoothlyMenu() { if (!$('body').hasClass('mini-navbar')) { $('#side-menu').hide(); setTimeout( function () { $('#side-menu').fadeIn(300); }, 100); } else if ($('body').hasClass('fixed-sidebar')) { $('#side-menu').hide(); setTimeout( function () { $('#side-menu').fadeIn(300); }, 300); } else { $('#side-menu').removeAttr('style'); } } function menuflash(tp){ if("closeAll" == tp){ $("ul.tabpanel_mover li").each(function(a, b){ var id = $(this).attr("id"); if(id != "t_home"){ $(this).remove(); } }); $("#t_home").addClass("active"); $(".tabpanel_content .html_content").each(function(a, b){ var id = $(this).attr("id"); if(id != "b_home"){ $(this).remove(); } }); $("#b_home").show(); $(".tabpanel_mover").css("marginLeft", "0px"); }else if("close" == tp){ var node = $(".tabpanel_mover li.active"); var cid = node.attr("id"); $("ul.tabpanel_mover li").each(function(a, b){ var id = $(this).attr("id"); if(id == "t_home" || id == cid) { }else{ $(this).remove(); } }); $("#" + cid).addClass("active"); cid = "b_" + cid.split("_")[1]; $(".tabpanel_content .html_content").each(function(a, b){ var id = $(this).attr("id"); if(id == "b_home" || id == cid){ }else{ $(this).remove(); } }); $("#"+cid).show(); $(".tabpanel_mover").css("marginLeft", "0px"); }else if("ref" == tp){ var node = $(".tabpanel_mover li.active"); var url = node.attr("u"); var cid = node.attr("id"); cid = "b_" + cid.split("_")[1]; if(url){ $("#"+cid+" iframe").attr("src", url); } } } function menuOper(mid, url){ $(".tabpanel_mover li").removeClass("active"); $(".tabpanel_mover #t_"+mid).addClass("active"); $(".tabpanel_content .html_content").hide(); $(".tabpanel_content #b_"+mid).show(); if(url){ $("#b_"+mid+" iframe").attr("src", url); } } function menuOpen(url, txt, mid, refresh){ var url = url; var n = txt; var id = mid; //菜单窗口是否打开 if($("#t_"+id).length > 0){ //已打开,切换tab menuOper(id, refresh?url:null); }else { //新建tab /** if($(".tabpanel_mover li").length >= 10){ msginfo("只能打开10个选项卡。"); return false; } **/ $(".tabpanel_mover li").removeClass("active"); var s = "