You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

178 lines
4.2 KiB

  1. window.master = {
  2. loadcss:function(src){
  3. var head=document.getElementsByTagName("head")[0];
  4. var link = document.createElement('link');
  5. link.href = src;
  6. link.rel = "stylesheet";
  7. link.type = "text/css";
  8. head.appendChild(link);
  9. },
  10. loadModul:function(ev){
  11. var src = $(this).attr("load-href");
  12. if($(".control-show").find('.'+src).length===0){
  13. master.loadcss("css/"+src+".css")
  14. $.ajax({
  15. url:src+".html",
  16. success:function(text){
  17. $(".control-show").append(text);
  18. console.log(text);
  19. $("#x_guanli0").css("color","#000");
  20. },
  21. dataType:"html",
  22. });
  23. $.getScript("js/"+src+".js");
  24. }else{
  25. console.log(1)
  26. }
  27. },
  28. dropDown:function(){
  29. $('.dropdown-toggle').on("click",function(){
  30. $(this).next().slideToggle(200).parent().toggleClass("open");
  31. if($(this).find("img").attr("src")=="images/ic_dingdan_nor.png"){
  32. $(this).find("img").attr("src","images/ic_dingdan_sel.png");
  33. $(".dropdown1").find("img").attr("src","images/ic_yuding_nor.png");
  34. $(".dropdown3").find("img").attr("src","images/ic_shezhi_nor.png");
  35. }else if($(this).find("img").attr("src")=="images/ic_yuding_nor.png"){
  36. $(this).find("img").attr("src","images/ic_yuding_sel.png");
  37. $(".dropdown2").find("img").attr("src","images/ic_dingdan_nor.png");
  38. $(".dropdown3").find("img").attr("src","images/ic_shezhi_nor.png");
  39. }else if($(this).find("img").attr("src")=="images/ic_shezhi_nor.png"){
  40. $(this).find("img").attr("src","images/ic_shezhi_sel.png");
  41. $(".dropdown1").find("img").attr("src","images/ic_yuding_nor.png");
  42. $(".dropdown2").find("img").attr("src","images/ic_dingdan_nor.png");
  43. }
  44. })
  45. $(".cut_submit").click(function(){
  46. setStorage("cutId",$(this).attr("cutid"))
  47. })
  48. if(cutId==1){
  49. $("#cutid1").addClass("font_color")
  50. $("#cutid1").addClass("border_color")
  51. }else if(cutId==2){
  52. $("#cutid2").addClass("font_color")
  53. $("#cutid2").addClass("border_color")
  54. }
  55. else if(cutId==3){
  56. $("#cutid3").addClass("font_color")
  57. $("#cutid3").addClass("border_color")
  58. }
  59. else if(cutId==4){
  60. $("#cutid4").addClass("font_color")
  61. $("#cutid4").addClass("border_color")
  62. }
  63. else if(cutId==5){
  64. $("#cutid5").addClass("font_color")
  65. $("#cutid5").addClass("border_color")
  66. }
  67. }
  68. //filterData:function(dom,){}
  69. };
  70. $(document).ready(function(){
  71. // var ht_user_id=$.cookie('ht_user_role');
  72. // var menu_file = "./leftmenu"+ht_user_id+".html";
  73. var server_height = $(".clearfix").height();
  74. $(".control-bar").css("height",server_height);
  75. $(".control-bar").addClass("serverheight");
  76. cutId = getStorage("cutId");
  77. var user_name = getStorage("login_name");
  78. $(".title_top_box_span1").text(user_name);
  79. $.ajax({
  80. url:'./left_menu.html',
  81. success:function(data){
  82. $(".control-bar").html(data);
  83. master.dropDown()
  84. }
  85. })
  86. });
  87. //退出
  88. function login_out(){
  89. $.ajax({
  90. url:'./zz-fx/control.php', //请求地址
  91. type: "post", //请求方式
  92. data:{
  93. type:"distribut_logout"
  94. },
  95. async:false,
  96. dataType: "json",
  97. success: function (data) {
  98. console.log(data);
  99. if(data.code == 0){
  100. window.location.href="login.html";
  101. }else if(data.code == -1){
  102. }
  103. },
  104. fail: function (date) {
  105. // 此处放失败后执行的代码
  106. }
  107. });
  108. }
  109. //设置字符串类型的本地缓存
  110. function setStorage(objName, objValue){
  111. var sto = window.localStorage;
  112. if (sto)
  113. sto.setItem(objName, objValue);
  114. }
  115. //读取字符串类型的本地缓存
  116. function getStorage(objName){
  117. var ret = '';
  118. var sto = window.localStorage;
  119. if (sto)
  120. ret = sto.getItem(objName);
  121. return ret;
  122. }
  123. //清除本地缓存,如没指定名称则为清空所有缓存
  124. function clearStorage(objName){
  125. var sto = window.localStorage;
  126. if (sto) {
  127. if (objName)
  128. sto.removeItem(objName);
  129. else
  130. sto.clear();
  131. }
  132. }
  133. //设置Json类型的本地缓存
  134. function setStorJson(objName, json){
  135. if (json)
  136. setStorage(objName, JSON.stringify(json));
  137. }
  138. //读取Json类型的本地缓存
  139. function getStorJson(objName){
  140. var ret = null;
  141. var str = getStorage(objName);
  142. if (str)
  143. ret = JSON.parse(str);
  144. return ret;
  145. }