-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
237 lines (206 loc) · 8.77 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
<!DOCTYPE html>
<html lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<META HTTP-EQUIV="imagetoolbar" CONTENT="no">
<!-- <title>学生进出学校核验</title>-->
<title>学生进出学校核验</title>
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
<link rel="stylesheet" href="./fx_files/weui.css">
<link rel="stylesheet" href="./fx_files/layui.css">
<link rel="stylesheet" href="./fx_files/weuix.css">
<link rel="stylesheet" href="./fx_files/fx.css">
<script type="text/javascript">
// set cookie for convenience
function setCookie(name, id, institute) {
// set expire to 7 days later
var date = new Date();
date.setTime(date.getTime() + (7*24*60*60*1000));
document.cookie = "name=" + encodeURIComponent(name);
document.cookie = "id=" + encodeURIComponent(id);
document.cookie = "institute=" + encodeURIComponent(institute);
document.cookie = "expires=" + date.toUTCString();
}
function updateCookie() {
var nameHolder = document.getElementById("name")
var idHolder = document.getElementById('id')
var instituteHolder = document.getElementById('institute')
setCookie(nameHolder.innerHTML, idHolder.innerHTML, instituteHolder.innerHTML)
}
// another random function from the internet
function getCookie(name) {
let matches = document.cookie.match(new RegExp("(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"));
return matches ? decodeURIComponent(matches[1]) : undefined;
}
// load data from cookie
function getSavedData() {
var items = document.cookie.split(';')
var name = getCookie('name')
var id = getCookie('id')
var institute = getCookie('institute')
if(name === undefined || id === undefined || institute === undefined) {
console.log("Cookie not found.")
return false
} else {
return [name, id, institute]
}
}
// deletes all cookies, for debug purposes
function throwCookies() {
document.cookie = 'max-age=0'
}
// random string function copied from StackOverflow
function generateId(length) {
var result = '';
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
var charactersLength = characters.length;
for ( var i = 0; i < length; i++ ) {
result += characters.charAt(Math.floor(Math.random() *
charactersLength));
}
return result;
}
//得到时间并写入div
function getDate(){
//获取当前时间
var date = new Date();
//格式化为本地时间格式
var date1 = date.toLocaleString();
//获取div
var div1 = document.getElementById("times");
//将时间写入div
div1.innerHTML = date1;
}
//使用定时器每秒向div写入当前时间
setInterval("getDate()",1000);
// set personal info and else
window.onload = function () {
// var dataFromCookie = getSavedData()
var name = ''
var id = ''
var institute = ''
// if (dataFromCookie == false) {
// name = prompt("请输入姓名", " ")
// id = prompt("请输入学号", " ")
// institute = prompt("请输入所在学院", " ")
// setCookie(name, id, institute)
// } else {
// name = dataFromCookie[0]
// id = dataFromCookie[1]
// institute = dataFromCookie[2]
// }
name = prompt("请输入姓名", " ")
id = prompt("请输入学号", " ")
institute = prompt("请输入所在学院", " ")
var nameHolder = document.getElementById("name")
var idHolder = document.getElementById('id')
var instituteHolder = document.getElementById('institute')
var rCodeHolder = document.getElementById('randomCode')
var mCodeHolder = document.getElementById('mysteriousCode')
nameHolder.innerHTML = name
idHolder.innerHTML = id
instituteHolder.innerHTML = institute
// Probably useless because no one actually verfies it
rCodeHolder.innerHTML = "随机码:" + generateId(6)
// register onclick event
nameHolder.onclick = function() { nameHolder.innerHTML = prompt("请输入姓名", " ") ?? " "; updateCookie() }
idHolder.onclick = function() { idHolder.innerHTML = prompt("请输入学号", " ") ?? " "; updateCookie() }
instituteHolder.onclick = function() { instituteHolder.innerHTML = prompt("请输入所在学院", " ") ?? " "; updateCookie() }
mCodeHolder.onclick = function() { mCodeHolder.innerHTML = prompt("请输入神秘代码", "1374") ?? "1374" }
rCodeHolder.onclick = function() { rCodeHolder.innerHTML = "随机码:" + generateId(6) }
}
</script>
<script src="./fx_files/safe.js"></script>
<!-- <style>
@keyframes scaleDraw {
/*定义关键帧、scaleDrew是需要绑定到选择器的关键帧名称*/
0% {
transform:scale(1);
/*开始为原始大小*/
}
25% {
transform:scale(1.1);
/*放大1.1倍*/
}
50% {
transform:scale(1);
}
75% {
transform:scale(1.1);
}
}.zp {
-webkit-animation-name:scaleDraw;
/*关键帧名称*/
-webkit-animation-timing-function:ease-in-out;
/*动画的速度曲线*/
-webkit-animation-iteration-count:infinite;
/*动画播放的次数*/
-webkit-animation-duration:4s;
/*动画所花费的时间*/
}
.bUtonadaLij {
width: 218rpx;
height: 80rpx;
/*background: #FFF;*/
border-radius: 40rpx;
line-height: 80rpx;
text-align: center;
font-size: 28rpx;
color: #006a4c;
border: 2rpx solid #006a4c;
font-weight: bold;
-webkit-animation-name: scaleDraw;
-webkit-animation-timing-function: ease-in-out;
-webkit-animation-iteration-count: infinite;
-webkit-animation-duration: 3s;
}
@keyframes scaleDraw {
0% {
transform: scale(1);
}
25% {
transform: scale(.8);
}
50% {
transform: scale(1);
}
75% {
transform: scale(.8);
}
}
</style> -->
</head>
<body>
<div class="page-hd cl0"></div>
<div class="page-hd cl1">
</div>
<div class="page-hd cl2">
<p id="name" style="font-size: 30px; font-family: STHeiti; font-weight: bold;" align="center"> </p>
</div>
<div class="page-hd cl3" style=" text-align: center;float:none;">
<p id='id' style="font-size: 20px; text-align:center;"> </p>
<p id='institute' style="font-size: 16px; text-align:center;"></p>
<p style="font-size: 16px; text-align:center;">
</p>
<div id="qr" class="tcenter" style="padding: 10px;height:170px;">
<img class='zp' width="140px" height="160px" src="cssjs/imgs/fail.jpg"> <!--<img class='zp' width="160px" height="160px" src="cssjs/imgs/www.png">-->
</div>
<p style="font-size: 16px; text-align:center;">
</p>
<p style="font-size: 16px; font-weight: 200;" align="center"></p>
</div>
<div class="page-hd cl4">
<p style="font-size: 20px; font-weight:bold;" align="center"><span id='times'></span></p>
</div>
<div class="page-hd cl5">
<p id="mysteriousCode" style="font-size: 20px; font-weight:bold;text-align: center; margin-top: -30px;">
1347</p>
</div>
<div id="colorDIV" class="page-hd cl6 cl6_purple" permit="purple">
<p style=" color:#fff; font-size: 25px; font-weight: 200;" align="center" class="bUtonadaLij">予以通行</p>
<p id="randomCode" style=" color:#fff; font-size: 15px; font-weight: 200; text-align: center; margin-top: 5px;">随机码:4Zhsrx</p>
</div>
<div class="page-hd cl7"></div>
<div class="page-hd cl8"></div>
</body>
</html>