标签:type 锁屏 rtt set eth == html blog dos
<li class="layui-nav-item"> <a href="javascript:;" id="lock"> <i class="iconfont icon-diannao1"></i> 锁屏</a> </li>
<div class="lock-screen" style="display: none;"> <div id="locker" class="lock-wrapper"> <div id="time"></div> <div class="lock-box center"> <img src="/static/images/user.jpg" style="width:100px;height:100px;" alt=""> <h1>admin</h1> <duv class="form-group col-lg-12"> <input type="password" placeholder=‘锁屏状态,请输入密码解锁‘ id="lock_password" class="form-control lock-input" autofocus name="lock_password"> <button id="unlock" class="btn btn-lock">解锁</button> </duv> </div> </div> </div>
// 快捷键锁屏设置 $(document).keydown(function(e){ if(e.altKey && e.which == 76){ lockSystem(); } }); function startTimer(){ var today=new Date(); var h=today.getHours(); var m=today.getMinutes(); var s=today.getSeconds(); m = m < 10 ? ‘0‘ + m : m; s = s < 10 ? ‘0‘ + s : s; $(‘#time‘).html(h+":"+m+":"+s); var t=setTimeout(function(){startTimer()},500); } // 锁屏状态检测 function checkLockStatus(locked){ // 锁屏 if(locked == 1){ $(‘.lock-screen‘).show(); $(‘#locker‘).show(); $(‘#layui_layout‘).hide(); $(‘#lock_password‘).val(‘‘); }else{ $(‘.lock-screen‘).hide(); $(‘#locker‘).hide(); $(‘#layui_layout‘).show(); } } checkLockStatus(‘0‘); // 锁定屏幕 function lockSystem(){ var url = ‘‘; $.post( url, function(data){ if(data){ checkLockStatus(1); }else{ layer.alert(‘锁屏失败,请稍后再试!‘); } }); startTimer(); } //解锁屏幕 function unlockSystem(){ // 与后台交互代码已移除,根据需求定义或删除此功能 checkLockStatus(0); } // 点击锁屏 $(‘#lock‘).click(function(){ lockSystem(); }); // 解锁进入系统 $(‘#unlock‘).click(function(){ unlockSystem(); }); // 监控lock_password 键盘事件 $(‘#lock_password‘).keypress(function(e){ var key = e.which; if (key == 13) { unlockSystem(); } });
标签:type 锁屏 rtt set eth == html blog dos
原文地址:http://www.cnblogs.com/chenchenphp/p/7137118.html