-
Notifications
You must be signed in to change notification settings - Fork 0
/
backend.html
92 lines (84 loc) · 2.51 KB
/
backend.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<!DOCTYPE html>
<html>
<head>
<title>上传抗原检测结果</title>
<script src="main.js"></script>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f1f1f1;
padding: 20px;
}
h1 {
color: #333;
}
p {
color: #666;
}
label {
display: block;
margin-top: 10px;
}
input[type="text"] {
width: 300px;
padding: 10px;
border-radius: 5px;
border: none;
background-color: #fff;
}
button {
padding: 10px 20px;
background-color: #3498db;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
#message, #cha {
margin-top: 10px;
font-weight: bold;
}
.success {
color: green;
}
.error {
color: red;
}
</style>
<script>
async function uploadResult() {
const email = document.getElementById("email").value;
const result = document.getElementById("result").value;
const response = await fetch("/upload", {
method: "POST",
headers: {"Content-Type": "application/x-www-form-urlencoded"},
body: `result=${encodeURIComponent(result)}&email=${encodeURIComponent(email)}`
});
const data = await response.json();
if (response.ok) {
document.getElementById("message").innerText = "上传成功!";
document.getElementById("cha").innerText = data.se;
document.getElementById("message").classList.add("success");
} else {
document.getElementById("message").innerText = `上传失败:${data.message}`;
document.getElementById("message").classList.add("error");
}
}
</script>
</head>
<body>
<center>
<h1>上传抗原检测结果</h1>
<p>结果说明:C(阴性);T(无效结果);CT(阳性)</p>
<p>输入邮件地址及检测结果:</p>
<label for="email">邮件:</label>
<input type="text" id="email"><br>
<label for="result">检测结果:</label>
<input type="text" id="result"><br><br/>
<button onclick="uploadResult()">上传</button>
<p id="message"></p>
<p id="cha"></p>
<p id="ban"></p>
</center>
</body>
</html>