This repository has been archived by the owner on Apr 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
join.html
76 lines (75 loc) · 2.19 KB
/
join.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="stylesheet"
href="https://unpkg.com/[email protected]/build/forms-min.css"
crossorigin="anonymous"
/>
<link
rel="stylesheet"
href="https://unpkg.com/[email protected]/build/buttons-min.css"
crossorigin="anonymous"
/>
<script>
function join(event) {
const name = document.getElementById("name").value;
const el = document.getElementById("info-box");
const urlParams = new URLSearchParams(window.location.search);
fetch(urlParams.get("api"), {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
event: urlParams.get("event"),
event_hash: urlParams.get("hash"),
timestamp: urlParams.get("timestamp"),
name,
}),
})
.then((r) => r.json())
.then((message) => {
if (message.success) {
el.style.color = "green";
el.innerText = "报名成功!";
} else {
el.style.color = "darkred";
el.innerText = "报名失败,可能是有重名";
}
})
.catch((err) => {
el.style.color = "darkred";
el.innerText = "报名失败,可能是网络故障,或姓名太罕见";
});
}
</script>
<title>参加抽奖</title>
</head>
<body>
<div style="margin: auto; max-width: 350px; text-align: center">
<br/>
<p>欢迎参加“挑战杯”宣讲会暨本研经验交流会!</p>
<p>请输入姓名参与宣讲会结束后的抽奖</p>
<p id="info-box" style="color: darkred"> </p>
<form class="pure-form">
<input
style="margin: auto"
id="name"
type="text"
placeholder="您的姓名"
/>
</form>
<br />
<button
type="submit"
class="pure-button pure-button-primary"
onclick="join()"
>
报名
</button>
</div>
</body>
</html>