base.html 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <!--#include file="/inc/header.html"-->
  2. <script type="text/javascript">
  3. window.renderHeader=function(e){
  4. var template="{{#childenList}}<li class=\"bif-nav-item\" style=\" width: auto\" data-fun=\"{{moduleUrl}}\" data-href=\"/pages/{{moduleUrl}}.html\">{{moduleName}}</li>{{/childenList}}";
  5. var views = Mustache.render(template, e);
  6. $("#bif-nav-ul").html(views);
  7. $(".tree-breadcrumb #nav-item-a").html($("#bif-nav-ul li:first-child").html());
  8. $("#bif-nav-ul li:first-child").addClass("active");
  9. };
  10. $(function(){
  11. var modules=JSON.parse(window.sessionStorage.getItem("modules"));
  12. if(window.treemap){
  13. var treemap = window.treemap[1]
  14. // treemap.childenList = treemap.childenList.slice(0,-1)
  15. renderHeader(window.treemap[1]);//基本信息ID 1
  16. }else if(modules){
  17. renderHeader(modules.treemap[1]);
  18. }
  19. })
  20. </script>
  21. <div class="con-wrap">
  22. <div class="tree-breadcrumb">
  23. <span><a class="nav-prov">首页</a></span>&gt;
  24. <span class="nav-prov">山东分公司</span>
  25. <span><a class="nav-city" href="javascript:;"></a></span>
  26. <span><a class="nav-grain" href="javascript:;"></a></span>
  27. <span class="nav-house"></span>
  28. </div>
  29. <div id="con-map" style="margin-top: 0px;position: relative;">
  30. <div class="bif-nav">
  31. <ul id="bif-nav-ul">
  32. </ul>
  33. </div>
  34. <div class="author-nav">
  35. <ul id="tree-tt">
  36. </ul>
  37. </div>
  38. <div class="author-nav-sidebar">隐藏菜单</div>
  39. <div class="bif-con">
  40. </div>
  41. </div>
  42. </div>
  43. <!--#include file="/inc/footer.html"-->
  44. <style>
  45. .bif-nav-item {
  46. width: 97px;
  47. text-align: center;
  48. }
  49. .author-nav-sidebar {
  50. box-sizing: border-box;
  51. padding-top: 227px;
  52. float: left;
  53. height: 554px;
  54. line-height: 25px;
  55. width: 25px;
  56. cursor: pointer;
  57. text-align: center;
  58. /*writing-mode: vertical-rl;*/
  59. /*writing-mode:tb-rl;*/
  60. /* -webkit-transform:rotate(90deg);
  61. -moz-transform:rotate(90deg);
  62. -o-transform: rotate(90deg);*/
  63. /*white-space:nowrap;*/
  64. /*text-indent: 7px;*/
  65. margin-top: 10px;
  66. color: #fff;
  67. background-color: #ccc;
  68. }
  69. </style>
  70. <script>
  71. /*获取到链接首页的url*/
  72. $(function(){
  73. $.ajax({
  74. type: "post",
  75. dataType: 'json',
  76. url: config.baseUrl + "/sys/jump",
  77. success: function(e) {
  78. $('.nav-prov').attr('href','/'+e.defaultHome);
  79. },
  80. error: function(e) {
  81. console.log(e);
  82. }
  83. });
  84. });
  85. $(function() {
  86. base.getTree();
  87. base.listAllTypeRemote();
  88. $(document).on('click','[data-fun]',function( e ) {
  89. // console.log(e,'我的e');
  90. //获取当前激活状态的函数名称
  91. var activeFunc = $('.bif-nav .active').data('fun'),
  92. //获取当前点击目标的函数名
  93. fun = $(this).data('fun');
  94. console.log('我点过的')
  95. //比较其是否为同一目标,防止重复点击
  96. if (activeFunc === fun) {
  97. return false;
  98. }
  99. $(this).addClass('active').siblings().removeClass('active');
  100. if(typeof funs[fun] == 'function') {
  101. funs[fun]($(this),e);
  102. //删除多余的dom结构
  103. $('.panel,.window-shadow, .window-mask').remove();
  104. } else {
  105. console.info('not found function '+fun);
  106. }
  107. });
  108. // var showCount = 0,
  109. // hideCount = 0;
  110. //隐藏
  111. $('.author-nav-sidebar').on('click',function(e){
  112. e.preventDefault();
  113. var wid = $('.bif-con').css('width');
  114. // var li = $('.tabs-selected').index();
  115. if( wid !== '1172px' ) {
  116. $(this).text('显示菜单');
  117. $('.author-nav').hide();
  118. $('.bif-con').css('width','1172px');
  119. // if( showCount == 0 ) {
  120. // showCount++;
  121. $.parser.parse('.bif-con');
  122. //再次加载当前页面
  123. $('[data-fun].active').removeClass('active').trigger('click');
  124. } else {
  125. $(this).text('隐藏菜单');
  126. $('.author-nav').show();
  127. $('.bif-con').css('width','970px');
  128. // if( hideCount == 0 ) {
  129. // hideCount++;
  130. $.parser.parse('.bif-con');
  131. //再次加载当前页面
  132. $('[data-fun].active').removeClass('active').trigger('click');
  133. // }
  134. }
  135. })
  136. });
  137. </script>
  138. </body>
  139. </html>