leftnav.html 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>首页</title>
  6. <meta name="description" content="">
  7. <meta name="keywords" content="">
  8. <!--include header base-->
  9. <meta name="author" content="Roobo:F2E">
  10. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  11. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  12. <!-- Set render engine for 360 browser -->
  13. <meta name="renderer" content="webkit">
  14. <!--<link rel="icon" type="image/png" href="img/favicon/favicon.png">-->
  15. <!-- Add to homescreen for Chrome on Android -->
  16. <meta name="mobile-web-app-capable" content="yes">
  17. <!--<link rel="icon" type="image/png" sizes="192x192" href="img/favicon/android-icon-192x192.png">-->
  18. <!-- Add to homescreen for Safari on iOS -->
  19. <meta name="apple-mobile-web-app-capable" content="yes">
  20. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  21. <!--<link rel="apple-touch-icon-precomposed" href="img/favicon/favicon-57x57.png">-->
  22. <!-- Tile icon for Win8 (144x144 + tile color) -->
  23. <meta name="msapplication-TileImage" content="favicon.png">
  24. <meta name="msapplication-TileColor" content="#ffffff">
  25. <!------------------------------------------------------------------->
  26. <link rel="stylesheet" type="text/css" href="css/left-nav.css">
  27. <script type="text/javascript" src="js/lib/jquery-1.9.1/jquery.js" ></script>
  28. <script src="js/lib/jquery-1.9.1/jquery.min.js"></script>
  29. <script src="js/config/base_config.js"></script>
  30. <script src="js/lib/ajaxRedirect.js"></script>
  31. <script type="text/javascript">
  32. $(document).ready(function(){
  33. localStorage.setItem("fname","");
  34. localStorage.setItem("name","");
  35. $("#menu_div").html("");
  36. loadMenuItem("menu_div",0,1,"");
  37. $.ajax({
  38. url: baseConfig.URL.menuList + "",
  39. type: "get",
  40. data:{rtype:"get",mtype:1,fid:-1,mrstatus:0},
  41. cache: false,
  42. success:function (res) {
  43. console.log(res);
  44. allFunction== new Array();
  45. $.each(res.list,function (index,item) {
  46. var f={
  47. id:item.id
  48. ,classname:item.classname+"."+item.methodname
  49. ,name:item.name
  50. };
  51. allFunction.push(f);
  52. });
  53. console.log(allFunction);
  54. },
  55. complete:function (XHR, TS) {
  56. },
  57. error:function (XMLHttpRequest, textStatus, errorThrown) {
  58. }
  59. });
  60. });
  61. var allFunction= new Array();
  62. var show_level=4; //显示层级
  63. //加载菜单栏 level
  64. function loadMenuItem(obj,fid,level,fname){
  65. if(level>show_level){
  66. return;
  67. }
  68. $.ajax({
  69. url: baseConfig.URL.menuList + "",
  70. type: "get",
  71. data:{fid:fid,rtype:"get",mtype:0},
  72. cache: false,
  73. success:function (res) {
  74. console.log(res);
  75. var nexLevel=level+1;
  76. $.each(res.list,function (index,item) {
  77. if(level==1){
  78. if (index != 0) {
  79. $("#" + obj).append('<div><div class="nav-left-01" >'
  80. + '<a href="#" onclick="clickLevel(this,' + "'" + item.name + "'" + ',' + "'" + item.address + "'" + ')"><img src="' + item.imgurl + '" onerror="this.src=' + "'" + 'img/icon01_n.png' + "'" + '">'
  81. + '<p>' + item.name + '</p>' +
  82. '<img class="icon-right" src="img/min.png">'
  83. + '</a></div>'
  84. + '<ul class="classification" id="menu_div_' + item.id + '"></ul></div>');
  85. } else $("#" + obj).append("<div class=\"left-top\"><img src=\"img/home.png\"><p onclick='firstpage()' style='cursor: pointer'>首页</p></div>")
  86. .append('<div><div class="nav-left-01">'
  87. + '<a href="#" onclick="clickLevel(this,' + "'" + item.name + "'" + ',' + "'" + item.address + "'" + ')"><img src="' + item.imgurl + '" onerror="this.src=' + "'" + 'img/icon01_n.png' + "'" + '">'
  88. + '<p>' + item.name + '</p>'
  89. + '<img class="icon-right" src="img/min.png">'
  90. + '</a></div>'
  91. + '<ul class="classification" id="menu_div_' + item.id + '"></ul></div>');
  92. }else {
  93. $("#"+obj).append('<li><a href="#" onclick="clickLevelSub(this,'+"'"+item.name+"'"+','+"'"+item.address+"'"+','+"'"+fname+"'"+')">'+item.name+'</a></li>');
  94. }
  95. loadMenuItem('menu_div_'+item.id,item.id,nexLevel,item.name);
  96. });
  97. },
  98. complete:function (XHR, TS) {
  99. },
  100. });
  101. }
  102. function clickLevel(obj,name,url){
  103. $.each($("#menu_div").find("div").find("div").find("a").find("img"),function (index,imgobj) {
  104. var imgurl=$(imgobj).attr("src");
  105. imgurl=imgurl.replace("_s.","_n.");
  106. $(imgobj).attr("src",imgurl);
  107. });
  108. $("#menu_div").find("div").find("div").removeClass("slt01");
  109. $("#menu_div").find("div").find("ul").find("li").removeClass("slt011");
  110. $(obj).parent().addClass("slt01");
  111. $(obj).parent().addClass("slt01");
  112. showOrHidden(obj);
  113. // $("#navTitle").html(name);
  114. // $("#navSubTitle").html('');
  115. localStorage.setItem("fname",'');
  116. localStorage.setItem("name",name);
  117. localStorage.setItem("url1", "");
  118. localStorage.setItem("url2", "");
  119. goto(url);
  120. }
  121. function clickLevelSub(obj,name,url,fname){
  122. $.each($("#menu_div").find("div").find("div").find("a").find("img"),function (index,imgobj) {
  123. var imgurl=$(imgobj).attr("src");
  124. imgurl=imgurl.replace("_s.","_n.");
  125. $(imgobj).attr("src",imgurl);
  126. });
  127. $("#menu_div").find("div").find("div").removeClass("slt01");
  128. $("#menu_div").find("div").find("ul").find("li").removeClass("slt011");
  129. $(obj).parent().addClass("slt011");
  130. // $("#navTitle").html(fname);
  131. // $("#navSubTitle").html(name);
  132. localStorage.setItem("fname",fname);
  133. localStorage.setItem("name",name);
  134. if(name == "报名管理"){
  135. localStorage.setItem("url1", url);
  136. localStorage.setItem("url2", url);
  137. } else {
  138. localStorage.setItem("url1", "");
  139. localStorage.setItem("url2", "");
  140. }
  141. goto(url);
  142. }
  143. //显示或隐藏
  144. function showOrHidden(obj){
  145. if($(obj).parent().parent().children("ul").is(":hidden")){
  146. $(obj).children("img").eq(1).attr("src","img/min.png");
  147. }else{
  148. $(obj).children("img").eq(1).attr("src","img/add1.png");
  149. }
  150. $(obj).parent().parent().children("ul").toggle();
  151. }
  152. // 跳转
  153. function goto(url){
  154. if(url==""||url=="#") return;
  155. window.parent.document.getElementById('contentH').src='content.html?url='+url;
  156. }
  157. function firstpage() {
  158. $(window.parent.document).contents().find("#contentH")[0].contentWindow.tofirst();
  159. }
  160. </script>
  161. </head>
  162. <body>
  163. <div class="left">
  164. <div id="menu_div">
  165. <!--左边导航 一级菜单用div写的,二级菜单用ul写的,
  166. 选中的菜单,文字颜色改变,添加class="slt01"图标颜色改变,替换为_s图标 -->
  167. <div class="left-top" >
  168. <img src="img/home.png">
  169. <p>首页adasdas</p>
  170. </div>
  171. <div class="nav-left-01">
  172. <a href="">
  173. <img src="img/os.png">
  174. <p>系统管理</p>
  175. <img class="icon-right" src="img/add1.png"><!--二级菜单展开时隐藏display:none-->
  176. <img class="icon-right" src="img/min.png" style="display: none"><!--二级菜单展开时显示display:block-->
  177. </a>
  178. </div>
  179. <ul class="classification">
  180. <li><a href=""> 用户管理 </a></li>
  181. <li><a href=""> 角色管理 </a></li>
  182. </ul>
  183. </div>
  184. </div>
  185. </body>
  186. </html>