-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathindex.html
150 lines (135 loc) · 3.95 KB
/
index.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>佛祖保佑~~~</title>
<style>
section {
position: absolute;
top: 45%;
left: 50%;
transform: translate(-50%, -50%);
padding: 30px 0;
width: 400px;
border: 1px solid #ccc;
border-radius: 10px;
}
h4 {
text-align: center;
}
div {
height: 50px;
width: 100%;
line-height: 50px;
}
label {
display: inline-block;
width: 150px;
text-align: right;
}
input {
padding: 0 0 0 4px;
margin: 0;
border-radius: 4px;
outline: none;
border: 1px solid #ccc;
width: 200px;
height: 24px;
font-size: 20px;
}
span {
display: inline-block;
margin: 20px 0 0 153px;
height: 30px;
width: 80px;
border-radius: 6px;
line-height: 30px;
text-align: center;
color: white;
background-color: #F38181;
cursor: pointer;
}
.tip {
padding: 0 30px 0 30px;
margin: 30px 0 0 0;
font-size: 14px;
color: #ccc;
}
.author, .other {
padding: 0 30px 0 30px;
margin: 6px 0 0 0;
font-size: 14px;
color: #ccc;
}
.question {
padding: 0 30px 0 30px;
margin: 12px 0 0 0;
font-size: 14px;
color: #aaa;
line-height: 25px;
}
.img {
width: 120px;
height: 120px;
margin: 6px 0 0 30px;
}
</style>
</head>
<body>
<section>
<h4>饿了么大红包攻略</h4>
<div>
<label for="">红包链接</label>
<input type="text" name="url" id="url">
</div>
<div>
<label for="">领取手机号</label>
<input type="text" name="mobile" id="mobile">
</div>
<span onclick="submit()" id="btn">领取</span>
<p class="question">如何获取红包链接?</br>
1.分享红包到qq,选择'我的电脑',然后复制链接。</br>
2.分享红包到微信,在微信pc版中使用浏览器打开,然后复制链接。</p>
<p class="tip">目前领取速度较慢,大概半分钟左右,请耐心等待...</p>
<p class="author">作者:cooljser</p>
<p class="other">问题反馈q群: 246080018</p>
<p class="other">想要打赏的小伙伴可以使用微信扫描下面的二维码~~~</p>
<img src="wechat.png" class="img">
<p class="other">特别感谢: @宝婷、@会飞的猪、@CrazyVirusss</p>
</section>
</body>
<script>
function getById(id) {
return document.getElementById(id);
}
function submit() {
let hongbaoUrl = getById('url').value;
let mobile = getById('mobile').value;
if (hongbaoUrl && mobile) {
getHongbao({
url: hongbaoUrl,
mobile: mobile
});
getById('btn').style.backgroundColor = '#ccc';
}
}
function getHongbao(data) {
console.log(data)
let xhr = new XMLHttpRequest();
xhr.open('POST', '/getHongbao');
xhr.setRequestHeader("Content-Type","application/json");
xhr.send(JSON.stringify(data));
xhr.onload = function() {
if (xhr.status == 200) {
let res = xhr.response;
let data = JSON.parse(res);
alert(data.msg);
getById('btn').style.backgroundColor = '#F38181';
}
}
xhr.onerror = function(e) {
console.log(e);
}
}
</script>
</html>