ITEyes/setting.html

149 lines
4.6 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>智眼-软件设置</title>
<script type="text/javascript">
function password() {
var testV = 1;
var pass1 = prompt('请输入密码','');
while (testV < 3) {
if (!pass1)
history.go(-1);
if (pass1 == "123") {//初始密码123
alert('密码正确');
break;
}
testV+=1;
var pass1 =
prompt('密码错误!请重新输入:');
}
if (pass1!="password" & testV ==3)
history.go(-1);
return " ";
}
document.write(password());
</script>
<style>
/* 样式定义 */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f5f5f5;
font-family: Arial, sans-serif;
}
.container {
background-color: white;
padding: 20px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
border-radius: 10px;
width: 300px;
margin-bottom: 20px;
}
h2 {
text-align: center;
margin-bottom: 10px;
}
label {
display: block;
margin-bottom: 5px;
text-align: center;
}
input[type="text"], input[type="number"], input[type="checkbox"] {
width: 100%;
padding: 10px;
margin-bottom: 20px;
border: 1px solid #ccc;
border-radius: 5px;
font-size: 16px;
}
.button-container {
display: flex;
justify-content: space-between;
}
button {
padding: 10px 20px;
background-color: #333;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: #555;
}
.function-buttons {
display: flex;
flex-wrap: wrap;
justify-content: center;
margin-top: 20px;
}
.function-buttons button {
width: 130px;
margin: 10px;
}
.hidden {
display: none;
}
</style>
</head>
<body>
<div class="container">
<h2>时间限制设置</h2>
<label for="time-limit">设置每天使用时间上限分钟填“0”则为不限制</label>
<input type="number" id="time-limit" min="0" max="7200">
<div class="button-container">
<button id="save-time-limit">保存</button>
</div>
</div>
<!-- 导航栏部分 -->
<div class="container">
<div class="function-buttons">
<a href="index.html"><button id="home">启动首页</button></a>
<a href="psw.html"><button id="unlock">解锁密码设置</button></a>
<a href="gncs.html"><button id="test">功能测试</button></a>
<a href="setting.html"><button id="settings">软件设置</button></a>
</div>
</div>
<script>
// 处理时间限制设置
document.getElementById('save-time-limit').addEventListener('click', function() {
const timeLimit = document.getElementById('time-limit').value;
if (timeLimit > 0 && timeLimit <= 7200) {
sendMessage({
"ClientEvent": "SetLongTestTime",
"Content": {
"Time": timeLimit
}
}).then(() => {
// 处理发送消息成功后的逻辑
longTest = true
alert(`已将每日使用时间上限设置为 ${timeLimit} 分钟`);
})
}
if (timeLimit > 7200) {
alert('请输入有效的分钟数');
}
if (timeLimit < 0) {
alert('请输入有效的分钟数');
}
if (timeLimit == 0) {
longTest = false
alert(`已取消时间限制`);
}
});
</script>
</body>
</html>