jquery_长时间不操作自动锁屏

 

//基于Extjs   	var lock = true; //校验锁var LOGOUTTIMEINTERVAL = '<%=StringUtils.toString(ApplicationCache.getCo("LOGOUTTIMEINTERVAL"))%>' var oldLogoutTime = new Date().getTime();var newLogoutTime = new Date().getTime();var InTime = LOGOUTTIMEINTERVAL * 60 * 1000 ; //间隔最大时间(毫秒制) //选定当前元素$(this).on("mouseover click",function(e){  newLogoutTime = new Date().getTime();if(Math.abs(newLogoutTime-oldLogoutTime) < InTime){   //正常oldLogoutTime = new Date().getTime(); }else{if(lock){lock = false;timeout_checkUserPass();}}});var realPwd = '';var encryPwd = ''; var temp = '';function timeout_checkUserPass(){var form = new Ext.form.FormPanel({labelWidth: 100,defaultType: 'textfield',layout: "column",items: [{fieldLabel: '',columnWidth: 1,//inputType: 'password',id: 'repwd',enableKeyEvents: true,name: 'repwd',allowBlank: false,listeners: {keydown: function (obj, e) {encryPass(formCopy,obj,e);if (e.getKey() == e.ENTER) {Ext.Ajax.request({url: SRM_CONTEXT + '/icore/user/timeoutCheckPwd',params: {'realPwd':hex_md5(realPwd).toUpperCase()},success: function (response, options) {realPwd = ''; //置空密码lock = true;oldLogoutTime = new Date().getTime(); win.close();},failure: function (response, options) {formCopy.getField('repwd').setValue(null);SW.Msg.warn('密码不正确!');},});}}}}], buttons: [{id: 'button_save',text: '确定',margin: '0 90 0 0',handler: function () {var formDatabuton = formCopy.getField('repwd').getValue();formDatabuton = formDatabuton.charAt(formDatabuton.length-1);realPwd += formDatabuton;  //最后一位拼接Ext.Ajax.request({url: SRM_CONTEXT + '/icore/user/timeoutCheckPwd',params: {'realPwd':hex_md5(realPwd).toUpperCase()},success: function (response, options) {realPwd = ''; //置空密码lock = true;oldLogoutTime = new Date().getTime(); win.close();},failure: function (response, options) {formCopy.getField('repwd').setValue(null);SW.Msg.warn('密码不正确!');}});}}]});var win = new Ext.Window({title: '   输入系统登录密码',width: 250,height: 100,layout: 'fit',modal: true,closable:false, //去掉叉叉  items: [form],x:600,   //依据W3C:允许使用容器中的XY坐标定位项目y:300,html: 'Positioned at x:300, y:300'});var formCopy = form;win.show(Ext.getBody());}function encryPass(formCopy,obj,e){/******超时口令输入*******隐藏密码**V1************************/var formData = formCopy.getField('repwd').getValue();if(!formData) realPwd='';   //清空temp = obj.lastValue;temp = temp.charAt(temp.length-1);if(temp){realPwd += (temp == '*' ? '' : temp );for(var i=0;i  	

 


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部