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

56 lines
1.4 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</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>
</div>
</form>
</body>
<script>
function login(form) {
// let login_data = {
// name: form.name.value.trim(),
// password: form.password.value.trim()
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");
// window.localStorage.setItem("login_user", JSON.stringify(data));
return false;
}
</script>
</html>