right.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. <input type="hidden" id="avatar"
  2. {if condition="!$user['avatar']"}
  3. value="/static/img/girl.gif"
  4. {else/}
  5. value="{$user.avatar}"
  6. {/if}
  7. />
  8. <input type="hidden" id="name" value="{$user.name}">
  9. <input type="hidden" id="roleName" value="{$user.rolename}">
  10. <div id="page-wrapper" class="gray-bg dashbard-1">
  11. <div class="row border-bottom">
  12. <nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0">
  13. <ul class="nav navbar-top-links navbar-right">
  14. <!--
  15. <li class="dropdown">
  16. <a class="dropdown-toggle count-info" data-toggle="dropdown" href="#" onmouseover="$('.dropdown-toggle').dropdown()">
  17. <i class="fa fa-bell"></i>
  18. @if(dbsx>0){
  19. <span class="label label-danger">${dbsx}</span>
  20. @}
  21. </a>
  22. @if(tool.isEmpty(tasks)){
  23. @}else{
  24. <ul class="dropdown-menu dropdown-alerts" style="height: 300px;overflow: auto">
  25. @for(item in tasks){
  26. <li>
  27. <a href="javascript:void(0)">
  28. <div>
  29. <i class="fa fa-envelope fa-fw"></i> ${item.description}
  30. <span class="pull-right text-muted small">${item.createTime}</span>
  31. </div>
  32. </a>
  33. </li>
  34. <li class="divider"></li>
  35. @}
  36. </ul>
  37. @}
  38. </li>-->
  39. <li class="dropdown hidden-xs">
  40. <a class="dropdown-toggle" aria-expanded="false" style="font-weight: 900" onclick="javascript:lockScreen();">
  41. <i class="fa fa-lock"></i> 锁屏
  42. </a>
  43. </li>
  44. <li class="dropdown hidden-xs">
  45. <a class="right-sidebar-toggle" aria-expanded="false">
  46. <i class="fa fa-tasks"></i> 主题
  47. </a>
  48. </li>
  49. </ul>
  50. </nav>
  51. </div>
  52. <div class="row content-tabs">
  53. <button class="roll-nav roll-left J_tabLeft"><i class="fa fa-backward"></i>
  54. </button>
  55. <nav class="page-tabs J_menuTabs">
  56. <div class="page-tabs-content">
  57. <a href="javascript:;" class="active J_menuTab" data-id="/common/notice">公告栏</a>
  58. </div>
  59. </nav>
  60. <div class="btn-group roll-nav roll-right">
  61. <button class="dropdown J_tabClose" data-toggle="dropdown">关闭操作<span class="caret"></span>
  62. </button>
  63. <ul role="menu" class="dropdown-menu dropdown-menu-right">
  64. <li class="J_tabShowActive"><a>定位当前选项卡</a>
  65. </li>
  66. <li class="divider"></li>
  67. <li class="J_tabCloseAll"><a>关闭全部选项卡</a>
  68. </li>
  69. <li class="J_tabCloseOther"><a>关闭其他选项卡</a>
  70. </li>
  71. </ul>
  72. </div>
  73. <a href="/admin/auth/logout" class="roll-nav roll-right J_tabExit"><i class="fa fa fa-sign-out"></i> 退出</a>
  74. </div>
  75. <div class="row J_mainContent" id="content-main">
  76. <iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="/common/notice" frameborder="0" data-id="/common/notice" seamless></iframe>
  77. </div>
  78. </div>
  79. <link href="/static/css/lockScreen.css" rel="stylesheet">
  80. <script src="/static/js/jquery.min.js?v=2.1.4"></script>
  81. <script src="/static/js/common/Feng.js"></script>
  82. <style type="text/css">
  83. .dbsx{
  84. line-height: 12px;
  85. padding: 1px 3px;
  86. position: absolute;
  87. top: 8px;
  88. background-color: #1ab394;
  89. color: #FFFFFF;
  90. font-size: 3px;
  91. }
  92. .dropdown-menu .divider {
  93. height: 1px;
  94. overflow: hidden;
  95. background-color: #333;
  96. }
  97. </style>
  98. <script type="text/javascript">
  99. var task = null;
  100. var time = 10;
  101. window.onload=function (){
  102. var locked = sessionStorage.getItem('locked');
  103. if(locked)lockScreen();
  104. // setTimeLockScreen();
  105. initTime(time);
  106. }
  107. // 锁屏
  108. function lockScreen() {
  109. document.onkeydown = function () {
  110. var e = window.event || arguments[0];
  111. // 屏蔽 F12
  112. if (e.keyCode === 123) {
  113. return false;
  114. // 屏蔽 Ctrl+Shift+I
  115. } else if ((e.ctrlKey) && (e.shiftKey) && (e.keyCode === 73)) {
  116. return false;
  117. // 屏蔽 Shift+F10
  118. } else if ((e.shiftKey) && (e.keyCode === 121)) {
  119. return false;
  120. }
  121. };
  122. // 屏蔽右键单击
  123. document.oncontextmenu = function () {
  124. return false;
  125. };
  126. $('#locking').remove();
  127. if ($("#avatar").val()) {
  128. $('body').append('<div id="locking"><figure onclick="lockInput(this);"><img src="' +$("#avatar").val() + '" ></figure><h3>' + $("#name").val() + '</h3></div>');
  129. }
  130. setTimeout(function () {
  131. $('#locking').addClass('lock-ani');
  132. }, 200);
  133. sessionStorage.setItem('locked', true);
  134. }
  135. // 锁屏输入
  136. function lockInput(dom) {
  137. $(dom).find('img').unwrap();
  138. $('#locking').append('<div class="input-group">' +
  139. ' <input class="form-control form-control-lg" id="lockPassword" style="color: #333;" type="password" placeholder="请输入登录密码解锁">' +
  140. ' <div class="input-group-addon" style="background-color: #ccc;border: 1px solid #ccc;" onclick="unlockScreen();">' +
  141. ' <span class="input-group-text">' +
  142. ' <i class="fa fa-key " style="color: #555;font-weight: 900;"></i>' +
  143. ' </span>' +
  144. ' </div>' +
  145. ' </div>');
  146. setTimeout(function () {
  147. $('#locking .input-group').addClass('lock-input-ani');
  148. }, 200);
  149. $('#locking input').focus();
  150. }
  151. // 解锁
  152. function unlockScreen() {
  153. var password = $('#lockPassword').val();
  154. var url = "/admin/auth/valid_password";
  155. $.ajax({
  156. type: "post",
  157. url: url,
  158. dataType: "json",
  159. async: false,
  160. data: {"password":password},
  161. contentType : 'application/x-www-form-urlencoded ',
  162. success: function(data) {
  163. if(data.code==200){
  164. $('#locking').fadeOut(300, function () {
  165. $('#locking').remove();
  166. });
  167. sessionStorage.removeItem('locked');
  168. document.onkeydown = function () {
  169. var e = window.event || arguments[0];
  170. // 屏蔽 F12
  171. if (e.keyCode === 123) {
  172. return true;
  173. // 屏蔽 Ctrl+Shift+I
  174. } else if ((e.ctrlKey) && (e.shiftKey) && (e.keyCode === 73)) {
  175. return true;
  176. // 屏蔽 Shift+F10
  177. } else if ((e.shiftKey) && (e.keyCode === 121)) {
  178. return true;
  179. }
  180. };
  181. // 屏蔽右键单击
  182. document.oncontextmenu = function () {
  183. return true;
  184. };
  185. }else{
  186. if(data.status==1){
  187. Feng.error(data.msg);
  188. }else if(data.status==2){
  189. window.location.href = "/admin/auth/login";
  190. }
  191. }
  192. },
  193. error: function(data) {
  194. console.log(data);return;
  195. window.location.href = "/admin/auth/login";
  196. }
  197. });
  198. }
  199. function initTime(time) {
  200. var locked = sessionStorage.getItem('locked');
  201. var maxTime = 60*time;
  202. task = setInterval(function () {
  203. if(!locked){
  204. lockScreen();
  205. }
  206. },1000*maxTime);
  207. listenTime();
  208. }
  209. function listenTime() {
  210. var body = document.querySelector('html');
  211. body.addEventListener("click",restTime);
  212. body.addEventListener("keyup",restTime);
  213. body.addEventListener("keypress",restTime);
  214. body.addEventListener("keydown",restTime);
  215. body.addEventListener("mousemove",restTime);
  216. body.addEventListener("mousewheel",restTime);
  217. }
  218. function restTime(){
  219. if (task!=null){
  220. clearInterval(task);
  221. }
  222. initTime(time);
  223. }
  224. // function setTimeLockScreen(){
  225. // var locked = sessionStorage.getItem('locked');
  226. // (function($){
  227. // funObj = {
  228. // timeUserFun:'timeUserFun',
  229. // }
  230. // $[funObj.timeUserFun] = function(time){
  231. // var time = time || 5; // 默认参数
  232. // var userTime = time*60;
  233. // var testUser = "";
  234. // var objTime = {
  235. // init:0,
  236. // time:function(){
  237. // objTime.init += 1;
  238. // if(objTime.init == userTime && !locked){
  239. // lockScreen();
  240. // }
  241. // },
  242. // eventFun:function(){
  243. // clearInterval(testUser);
  244. // objTime.init = 0;
  245. // testUser = setInterval(objTime.time,1000);
  246. // }
  247. // }
  248. // testUser = setInterval(objTime.time,1000);
  249. // var body = document.querySelector('html');
  250. // body.addEventListener("click",objTime.eventFun);
  251. // body.addEventListener("keyup",objTime.eventFun);
  252. // body.addEventListener("keypress",objTime.eventFun);
  253. // body.addEventListener("keydown",objTime.eventFun);
  254. // body.addEventListener("mousemove",objTime.eventFun);
  255. // body.addEventListener("mousewheel",objTime.eventFun);
  256. // }
  257. // })(window);
  258. // timeUserFun(5);
  259. // }
  260. </script>