1
0

header.html 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. <!-- 头部区域 -->
  2. <style type="text/css">
  3. .clearfix::after {
  4. clear: both;
  5. }
  6. .clearfix::before,
  7. .clearfix::after {
  8. content: ' ';
  9. display: table;
  10. }
  11. .left {
  12. float: left;
  13. }
  14. .right {
  15. float: right;
  16. }
  17. .layui-layout-admin .layui-header {
  18. display: block;
  19. width: 100%;
  20. background-color: #36622b;
  21. border: none;
  22. height: 38px;
  23. color: #FFF !important;
  24. position: fixed;
  25. top: 0;
  26. left: 0;
  27. }
  28. .layui-layout-admin .layui-logo {
  29. display: block;
  30. height: 38px;
  31. width: 114px;
  32. line-height: 38px;
  33. color: #FFF;
  34. }
  35. .layui-layout-admin .loginbox {
  36. display: block;
  37. height: 38px;
  38. line-height: 38px;
  39. color: #FFF;
  40. }
  41. .layui-layout-admin .loginbox .layui-nav-item {
  42. white-space: nowrap;
  43. display: inline-block;
  44. height: 38px !important;
  45. line-height: 38px !important;
  46. color: #FFF;
  47. }
  48. .layui-layout-admin .layui-header a,
  49. .layui-layout-admin .layui-header a cite {
  50. color: #FFF;
  51. }
  52. .layui-layout-admin .layui-header .layui-nav .layui-nav-more {
  53. border-top-color: #FFF;
  54. display: none;
  55. }
  56. .layuicenter {
  57. display: block;
  58. margin-left: 114px;
  59. margin-right: 280px;
  60. color: #FFF !important;
  61. padding: 0 10px;
  62. height: 38px;
  63. line-height: 38px;
  64. overflow: auto;
  65. overflow-y: hidden;
  66. }
  67. /* 1,滚动条 */
  68. .layuicenter::-webkit-scrollbar {
  69. height: 8px;
  70. /* 横向滚动条 高度 */
  71. }
  72. /* 4.内层轨道,它会覆盖外层轨道的样式。 */
  73. .layuicenter::-webkit-scrollbar-track-piece {
  74. width: 8px;
  75. }
  76. /* 5,滑块 */
  77. .layuicenter::-webkit-scrollbar-thumb {
  78. background: #bec5ca;
  79. }
  80. /* 横向滑块悬浮 */
  81. .layuicenter::-webkit-scrollbar-thumb:horizontal:hover {
  82. background: #bec5ca;
  83. }
  84. .layuicenter .layui-nav-item {
  85. display: flex;
  86. flex-wrap: nowrap;
  87. width: 100%;
  88. color: #FFF !important;
  89. height: 38px !important;
  90. line-height: 38px !important;
  91. }
  92. .layui-layout-admin .layui-header .everytopnav {
  93. float: left;
  94. width: 80px;
  95. min-width: unset;
  96. text-align: center;
  97. border-right: 1px solid #FFF;
  98. }
  99. .layui-nav .layui-nav-item a {
  100. display: block;
  101. padding: 0;
  102. width: 80px;
  103. height: 38px;
  104. text-decoration: none;
  105. outline: none;
  106. -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  107. -webkit-tap-highlight-color: transparent;
  108. -moz-outline-style: none;
  109. }
  110. .layui-nav .layui-nav-item a:hover {
  111. background-color: #3ea400;
  112. color: #FFF;
  113. }
  114. .layui-nav .layui-nav-item div.nowclass {
  115. background-color: #3ea400;
  116. color: #FFF;
  117. }
  118. .logout {
  119. text-align: right;
  120. line-height: 38px;
  121. position: absolute;
  122. top: 0;
  123. right: 0;
  124. }
  125. .logout strong {
  126. font-weight: normal;
  127. padding-right: 5px;
  128. }
  129. .logout span {
  130. cursor: pointer;
  131. padding-right: 8px;
  132. }
  133. .ddaaalink {
  134. box-sizing: border-box;
  135. padding: 0px 5px;
  136. cursor: pointer;
  137. }
  138. .ddaaalink > a {
  139. width: 100% !important;
  140. text-align: left;
  141. }
  142. .layui-nav-bar {
  143. width: 0px !important;
  144. display: none !important;
  145. }
  146. </style>
  147. <div class="layui-header ">
  148. <div class="layui-logo left" lay-href="{:url('index/welcome')}" style="background-color: transparent !important;">
  149. <span class="headlogo1">{if $empdata.is_manager}管理层{else/}员工{/if}</span>
  150. </div>
  151. <ul class="layui-nav layuicenter" lay-shrink="all" id="LAY-system-side-menu" lay-filter="layadmin-system-side-menu">
  152. <li data-name="train" class="layui-nav-item">
  153. {volist name="menu" id="vo"}
  154. <div class="everytopnav"><a lay-href="{:url($vo.url)}">{$vo.name}</a></div>
  155. {/volist}
  156. </li>
  157. </ul>
  158. <div class="logout">
  159. <ul class="layui-nav layui-layout-right" style="display:flex;align-items: center;width:270px;" lay-filter="layadmin-layout-right">
  160. {notempty name="shop"}
  161. {else/}
  162. <div style="width:100px;"></div>
  163. {/notempty}
  164. {notempty name="switch_type"}
  165. <a href="javascript:;" style="margin-right: 10px;">
  166. <cite id="switch_type" data-type="{$switch_type}"> <img style="vertical-align:-3%;" src="__STATIC__/img/switchico.png" alt="">切换{if $switch_type == 1}PC{else/}社群{/if}端</cite>
  167. </a>
  168. {else/}
  169. <div style="width: 80px;"></div>
  170. {/notempty}
  171. {notempty name="shop"}
  172. <li class="layui-nav-item" style="height:38px;width: 80px;margin-right: 10px;" lay-unselect>
  173. <a href="javascript:;">
  174. <cite id="" style="position: relative;top:-5px;"> <img style="vertical-align:-3%;" src="__STATIC__/img/switchico.png" alt=""> 切换店面</cite>
  175. </a>
  176. <dl class="layui-nav-child layui-nav-childorder scrollset" style="width:160px !important;overflow-y: auto;left: none;height: 300px;">
  177. {volist name="shop" id="vo"}
  178. <dd class="ddStyle ddaaalink" onclick='switch_shop({$vo.root_id},{$vo.employee_id})'>
  179. {if condition="$vo.logo"}
  180. <img class="leftlinecloseimgbox pointer" src="{$vo.logo}" style="width: 20px;height:20px;float: left; margin-top: 6px;margin-right: 8px;"/>
  181. {else/}
  182. <img class="leftlinecloseimgbox pointer" src="__STATIC__/img/companyico.png" style="width: 20px;height:20px;float: left; margin-top: 6px;margin-right: 8px;"/>
  183. {/if}
  184. <a>{$vo.company_name}</a>
  185. </dd>
  186. {/volist}
  187. </dl>
  188. </li>
  189. {/notempty}
  190. <span style="margin-left: 5px;" id="openFrame" onclick="openFrame()" title="打开右侧导航菜单">导航</span>
  191. <strong><a class="exitbtn" href='{:url("index/logout")}' target="_top" title="安全的退出系统,建议使用">退出</a></strong>
  192. </ul>
  193. </div>
  194. </div>
  195. <script>
  196. for (var i = 0; i < $('.everytopnav').length; i++) {
  197. $('.everytopnav')[i].index = i;
  198. $($('.everytopnav')[i]).click(function () {
  199. let index = this.index;
  200. for (var j = 0; j < $('.everytopnav').length; j++) {
  201. $('.everytopnav')[j].classList.remove('nowclass');
  202. }
  203. $('.everytopnav')[index].classList.add('nowclass');
  204. let len = $('.layadmin-tabsbody-item');
  205. for (let i = 0; i < len.length; i++) {
  206. let str = $($('.layadmin-tabsbody-item')[i]).children('iframe')[0].src;
  207. if (str.indexOf('?') > -1) {
  208. $($('.layadmin-tabsbody-item')[i]).remove();
  209. }
  210. }
  211. this.click();
  212. })
  213. }
  214. let divEle = document.getElementById('LAY-system-side-menu');
  215. divEle.addEventListener("wheel", function (e) {
  216. //这里使用的是 chrom浏览器测试的,有一些Api不太准确 ,请大家注意!!!!
  217. let left = -e.wheelDelta || e.deltaY / 2;
  218. divEle.scrollLeft = divEle.scrollLeft + left;
  219. });
  220. $(function () {
  221. $(document).bind("contextmenu", function () { return false; }); $(document).bind("selectstart", function () { return false; }); $(document).keydown(function () { return key(arguments[0]) }); $("div.headnav ul li").click(function () {
  222. $(this).addClass("navOverClass").siblings("li").removeClass("navOverClass");
  223. });
  224. });
  225. function openFrame() {
  226. var atxt = document.getElementById("openFrame");
  227. if (atxt.innerHTML == "导航") {
  228. atxt.innerHTML = "隐藏";
  229. atxt.title = "关闭右侧导航菜单";
  230. openleftfun();
  231. } else {
  232. atxt.innerHTML = "导航";
  233. atxt.title = "打开右侧导航菜单";
  234. closeleftfun();
  235. }
  236. }
  237. $("#switch_type").click(function(){
  238. let type = $(this).prop("dataset").type;
  239. let employee_id = '{$empdata.id}';
  240. $.ajax({
  241. url: '{:url("index/switch_model")}',
  242. type: 'post',
  243. data: {type:type,employee_id:employee_id},
  244. dataType: 'json',
  245. success: function(res) {
  246. if(res.code === 0) {
  247. layer.msg(res.msg, {
  248. anim: 0
  249. ,time: 1000
  250. }, function() {
  251. location.reload();
  252. });
  253. }else if(res.code == 403){
  254. $(".exitbtn").trigger("click");
  255. } else {
  256. layer.msg(res.msg, {
  257. anim: 6
  258. ,time: 2000
  259. });
  260. }
  261. }
  262. });
  263. })
  264. function switch_shop (root_id,employee_id) {
  265. $.ajax({
  266. url: '{:url("index/switch_shop")}',
  267. type: 'post',
  268. data: {rootid:root_id,employee_id:employee_id},
  269. dataType: 'json',
  270. success: function(res) {
  271. if(res.code === 0) {
  272. layer.msg(res.msg, {
  273. anim: 0
  274. ,time: 1000
  275. }, function() {
  276. location.reload();
  277. });
  278. }else if(res.code == 403){
  279. $(".exitbtn").trigger("click");
  280. } else {
  281. layer.msg(res.msg, {
  282. anim: 6
  283. ,time: 2000
  284. });
  285. }
  286. }
  287. });
  288. }
  289. </script>