38 lines
1.3 KiB
HTML
38 lines
1.3 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
|
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
|
<title><%= htmlWebpackPlugin.options.title %></title>
|
|
</head>
|
|
<body>
|
|
<noscript>
|
|
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
|
</noscript>
|
|
<div id="app"></div>
|
|
<!-- built files will be auto injected -->
|
|
<script>
|
|
let timeout; // 定义一个变量存储定时器
|
|
|
|
function resetTimer() {
|
|
clearTimeout(timeout); // 清除之前的定时器
|
|
// 设置一个新的定时器,用户空闲时刷新
|
|
timeout = setTimeout(() => {
|
|
location.reload(); // 刷新当前页面
|
|
}, 300000); // 10 分钟
|
|
}
|
|
|
|
// 监听用户活动事件
|
|
window.onload = function() {
|
|
resetTimer(); // 页面加载时重置定时器
|
|
window.addEventListener('mousemove', resetTimer);
|
|
window.addEventListener('keypress', resetTimer);
|
|
window.addEventListener('scroll', resetTimer);
|
|
window.addEventListener('click', resetTimer);
|
|
};
|
|
</script>
|
|
</body>
|
|
</html>
|