window.master = { loadcss:function(src){ var head=document.getElementsByTagName("head")[0]; var link = document.createElement('link'); link.href = src; link.rel = "stylesheet"; link.type = "text/css"; head.appendChild(link); }, loadModul:function(ev){ var src = $(this).attr("load-href"); if($(".control-show").find('.'+src).length===0){ master.loadcss("css/"+src+".css") $.ajax({ url:src+".html", success:function(text){ $(".control-show").append(text); console.log(text); $("#x_guanli0").css("color","#000"); }, dataType:"html", }); $.getScript("js/"+src+".js"); }else{ console.log(1) } }, dropDown:function(){ $('.dropdown-toggle').on("click",function(){ $(this).next().slideToggle(200).parent().toggleClass("open"); if($(this).find("img").attr("src")=="images/ic_dingdan_nor.png"){ $(this).find("img").attr("src","images/ic_dingdan_sel.png"); $(".dropdown1").find("img").attr("src","images/ic_yuding_nor.png"); $(".dropdown3").find("img").attr("src","images/ic_shezhi_nor.png"); }else if($(this).find("img").attr("src")=="images/ic_yuding_nor.png"){ $(this).find("img").attr("src","images/ic_yuding_sel.png"); $(".dropdown2").find("img").attr("src","images/ic_dingdan_nor.png"); $(".dropdown3").find("img").attr("src","images/ic_shezhi_nor.png"); }else if($(this).find("img").attr("src")=="images/ic_shezhi_nor.png"){ $(this).find("img").attr("src","images/ic_shezhi_sel.png"); $(".dropdown1").find("img").attr("src","images/ic_yuding_nor.png"); $(".dropdown2").find("img").attr("src","images/ic_dingdan_nor.png"); } }) $(".cut_submit").click(function(){ setStorage("cutId",$(this).attr("cutid")) }) if(cutId==1){ $("#cutid1").addClass("font_color") $("#cutid1").addClass("border_color") }else if(cutId==2){ $("#cutid2").addClass("font_color") $("#cutid2").addClass("border_color") } else if(cutId==3){ $("#cutid3").addClass("font_color") $("#cutid3").addClass("border_color") } else if(cutId==4){ $("#cutid4").addClass("font_color") $("#cutid4").addClass("border_color") } else if(cutId==5){ $("#cutid5").addClass("font_color") $("#cutid5").addClass("border_color") } } //filterData:function(dom,){} }; $(document).ready(function(){ // var ht_user_id=$.cookie('ht_user_role'); // var menu_file = "./leftmenu"+ht_user_id+".html"; var server_height = $(".clearfix").height(); $(".control-bar").css("height",server_height); $(".control-bar").addClass("serverheight"); cutId = getStorage("cutId"); var user_name = getStorage("login_name"); $(".title_top_box_span1").text(user_name); $.ajax({ url:'./left_menu.html', success:function(data){ $(".control-bar").html(data); master.dropDown() } }) }); //退出 function login_out(){ $.ajax({ url:'./zz-fx/control.php', //请求地址 type: "post", //请求方式 data:{ type:"distribut_logout" }, async:false, dataType: "json", success: function (data) { console.log(data); if(data.code == 0){ window.location.href="login.html"; }else if(data.code == -1){ } }, fail: function (date) { // 此处放失败后执行的代码 } }); } //设置字符串类型的本地缓存 function setStorage(objName, objValue){ var sto = window.localStorage; if (sto) sto.setItem(objName, objValue); } //读取字符串类型的本地缓存 function getStorage(objName){ var ret = ''; var sto = window.localStorage; if (sto) ret = sto.getItem(objName); return ret; } //清除本地缓存,如没指定名称则为清空所有缓存 function clearStorage(objName){ var sto = window.localStorage; if (sto) { if (objName) sto.removeItem(objName); else sto.clear(); } } //设置Json类型的本地缓存 function setStorJson(objName, json){ if (json) setStorage(objName, JSON.stringify(json)); } //读取Json类型的本地缓存 function getStorJson(objName){ var ret = null; var str = getStorage(objName); if (str) ret = JSON.parse(str); return ret; }