var firstTime = new Date().getTime();
var currentTime = new Date().getTime();
// var timeOut = 8 * 60 * 60 * 1000;
var timeId = window.setInterval(loginTime, 5000);
$(function(){
/* 鼠标移动事件 */
$(document).mouseover(function () {
firstTime = new Date().getTime(); //更新操作时间
});
})
function loginTime() {
currentTime = new Date().getTime();
//更新当前时间
if (currentTime - firstTime > timeOut) {
//判断是否超时
clearTimeout(timeId);
var loginTime = ‘
’
+ ‘
+ ‘
’
+ ‘
’
+ ‘
+ ‘
+ ‘
+ ‘
’
+ ‘
提示
’
+ ‘
’ + ‘由于您长时间未进行操作,请重新登录!’ + ‘
’
+ ‘
’
+ ‘ ’ + ‘确定’ + ‘’
+ ‘
’
+ ‘ ’ + ‘确定’ + ‘’
+ ‘
+ ‘
+ ‘
$('body .loginTime-mian').remove()
$('body').append(loginTime)
$(document).on('click', 'span[id="sureLoginOut"]', function () {
window.location.href = "./login.html";
})
}
}