var timeout; /** * 没有操作则跳转锁屏 */ function resetTimeout() { clearTimeout(timeout); timeout = setTimeout(function() { console.log('用户没有操作'); // 如果没有操作超过1分钟,跳转到锁屏页面 window.location.href = "../dzhwk/lock?flag=" + flag; }, 1000*60); // 1分钟 } /** * 显示当前时间(年月日时分秒) */ function timeFormate() { let that = this let year = new Date().getFullYear(); let month = new Date().getMonth() + 1 < 10 ? '0' + (new Date().getMonth() + 1) : new Date().getMonth() + 1; let date = new Date().getDate() < 10 ? '0' + new Date().getDate() : new Date().getDate(); let hh = new Date().getHours() < 10 ? '0' + new Date().getHours() : new Date().getHours(); let mm = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() : new Date().getMinutes(); let ss = new Date().getSeconds() < 10 ? '0' + new Date().getSeconds() : new Date().getSeconds(); let week = new Date().getDay(); let weeks = ['日', '一', '二', '三', '四', '五', '六']; let getWeek = '星期' + weeks[week]; /* that.datebox.date = year + ' ' + month + ' ' + date; that.datebox.time = hh + ':' + mm + ':' + ss; that.datebox.week = getWeek; */ /* $('.h-date .d').text(year + '-' + month + '-' + date); $('.date .time').text(hh + ':' + mm + ':' + ss);*/ $('.date .d2').text(month + '月' + date + '日' + getWeek); $('.date .time2').text(hh + ':' + mm); $('.h-date').text(year + '-' + month + '-' + date + ' ' + hh + ':' + mm); } /** * 显示当前时间(年月日时分秒) */ function getNowTime() { let that = this let year = new Date().getFullYear(); let month = new Date().getMonth() + 1 < 10 ? '0' + (new Date().getMonth() + 1) : new Date().getMonth() + 1; let date = new Date().getDate() < 10 ? '0' + new Date().getDate() : new Date().getDate(); let hh = new Date().getHours() < 10 ? '0' + new Date().getHours() : new Date().getHours(); let mm = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() : new Date().getMinutes(); let ss = new Date().getSeconds() < 10 ? '0' + new Date().getSeconds() : new Date().getSeconds(); return year + '-' + month + '-' + date + ' ' + hh + ':' + mm + ":" + ss; } /** * 功能页面跳转 * @param tag */ function toPage(tag) { if(tag == "security"){ layer.msg("暂未开放!"); return; } if(tag == "grain-check"){ layer.msg("暂未开放!"); return; } if(tag == "grain-handle"){ layer.msg("暂未开放!"); return; } window.location.href = "../dzhwk/" + tag; }