forked from mainkeys/nuist-goout
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.html
More file actions
79 lines (78 loc) · 2.2 KB
/
Copy pathsetup.html
File metadata and controls
79 lines (78 loc) · 2.2 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Setup</title>
<meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<script src="jquery-3.6.0.min.js"></script>
</head>
<body>
<form>
<p>
<label for="name">姓名</label>
<input type="text" id="name">
</p>
<p>
<label for="stuid">学号</label>
<input type="text" id="stuid">
</p>
<p>
<label for="college">学院</label>
<input type="text" id="college">
</p>
<p>
<label for="clazz">班级</label>
<input type="text" id="clazz">
</p>
<p>
<label for="idcard">身份证号码</label>
<input type="text" id="idcard">
</p>
<p>
<label for="phone">手机号码</label>
<input type="text" id="phone">
</p>
<p>
<label for="start">请假开始时间</label>
<input type="text" id="start" placeholder="yyyy-MM-dd hh:mm">
</p>
<p>
<label for="end">请假结束时间</label>
<input type="text" id="end" placeholder="yyyy-MM-dd hh:mm">
</p>
<p>
<button>
保存
</button>
</p>
<p>
数据将保存在浏览器的 LocalStorage 中,不会收集任何信息
</p>
</form>
<script>
$(document).ready(() => {
$('form').submit((e) => {
e.preventDefault()
const name = $('#name').val()
const stuid = $('#stuid').val()
const college = $('#college').val()
const clazz = $('#clazz').val()
const idcard = $('#idcard').val()
const phone = $('#phone').val()
const start = $('#start').val()
const end = $('#end').val()
const obj = {name, stuid, college, clazz, idcard, phone, start, end}
console.log(obj)
localStorage.setItem('fake-leave', JSON.stringify(obj))
})
const lastState=localStorage.getItem('fake-leave')
if(lastState){
const saved=JSON.parse(lastState)
for (const savedKey in saved) {
$('#'+savedKey).val(saved[savedKey])
}
}
})
</script>
</body>
</html>