index.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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=\"{{moduleType}}\" data-href=\"/pages/grainWorkbook/{{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[17]);//基本信息ID 1
  14. }else if(modules){
  15. renderHeader(modules.treemap[17]);
  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">
  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(1)
  92. console.log(activeFunc)
  93. console.log(fun)
  94. //比较其是否为同一目标,防止重复点击
  95. if(activeFunc === fun) {
  96. return false;
  97. }
  98. $(this).addClass('active').siblings().removeClass('active');
  99. console.log(funs[fun])
  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>