index.html 3.9 KB

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