smart-green-house-server-an.../html/enroll.html

98 lines
2.3 KiB
HTML
Raw Permalink Normal View History

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>用户注册</title>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
padding: 0;
background-color: #f5f5f5;
}
form {
background-color: #ffffff;
padding: 20px;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
.row {
margin-bottom: 10px;
}
.center {
display: flex;
justify-content: center;
}
input {
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
width: 200px;
}
button {
padding: 10px 20px;
background-color: #4caf50;
color: #ffffff;
border: none;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<form onsubmit="return login(this);">
<div class="row">
<input name="name" placeholder="请输入账号">
</div>
<div class="row">
<input name="password" placeholder="请输入密码">
</div>
<div class="row center">
<button>确认</button>
</div>
</form>
<script>
function login(form) {
let name = form.name.value.trim();
let password = form.password.value.trim();
if (name == "" || password == "") {
alert("账号或密码不能为空");
return false;
}
let login_data = {
name: name,
password: password
};
fetch("../cgi-bin/sqlite_cgi_insert_base.cgi", {
method: "POST",
body: JSON.stringify(login_data),
headers: {
"Content-Type": "application/json;charset=utf-8"
}
});
open("./login.html", "_self");
return false;
}
</script>
</body>
</html>