myapp_sjy 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. package/Dockerfile +7 -0
  2. package/app.js +58 -0
  3. package/bin/www +92 -0
  4. package/package.json +100 -0
  5. package/pkg.zip +0 -0
  6. package/public/css/layui.css +1 -0
  7. package/public/css/modules/code.css +1 -0
  8. package/public/css/modules/laydate/default/laydate.css +1 -0
  9. package/public/css/modules/layer/default/icon-ext.png +0 -0
  10. package/public/css/modules/layer/default/icon.png +0 -0
  11. package/public/css/modules/layer/default/layer.css +1 -0
  12. package/public/css/modules/layer/default/loading-0.gif +0 -0
  13. package/public/css/modules/layer/default/loading-1.gif +0 -0
  14. package/public/css/modules/layer/default/loading-2.gif +0 -0
  15. package/public/font/iconfont.eot +0 -0
  16. package/public/font/iconfont.svg +554 -0
  17. package/public/font/iconfont.ttf +0 -0
  18. package/public/font/iconfont.woff +0 -0
  19. package/public/font/iconfont.woff2 +0 -0
  20. package/public/layui.js +5 -0
  21. package/public/stylesheets/style.css +8 -0
  22. package/routes/api.js +642 -0
  23. package/routes/datatime.js +16 -0
  24. package/routes/db.js +145 -0
  25. package/routes/index.js +28 -0
  26. package/routes/nppBackup/sql.js.2024-07-08_082213.bak +25 -0
  27. package/routes/nppBackup/sql.js.2024-07-08_082214.bak +25 -0
  28. package/routes/sql.js +25 -0
  29. package/routes/switch.js +33 -0
  30. package/routes/switch1.js +12 -0
  31. package/views/addroom.ejs +223 -0
  32. package/views/addstu.ejs +318 -0
  33. package/views/error.ejs +3 -0
  34. package/views/hisinfo.ejs +442 -0
  35. package/views/hisinfo1.ejs +291 -0
  36. package/views/login.ejs +227 -0
  37. package/views/modroom.ejs +365 -0
  38. package/views/modstu.ejs +375 -0
  39. package/views/rtinfo.ejs +342 -0
  40. package/views/rtinfo1.ejs +268 -0
@@ -0,0 +1,342 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="utf-8">
6
+ <title>签到管理系统</title>
7
+ <meta name="renderer" content="webkit">
8
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
9
+ <meta name="viewport" content="width=device-width, initial-scale=1">
10
+ <link href="/css/layui.css" rel="stylesheet">
11
+ <style>
12
+ .layui-header {
13
+ height: 60px;
14
+ background-color: #10081a !important;
15
+ }
16
+ .layui-layout-left {
17
+ margin-left: 0 !important;
18
+ }
19
+
20
+ .layui-layout-right {
21
+ margin-right: 0 !important;
22
+ }
23
+
24
+ body {
25
+ font-size: 16px;
26
+ /*字体大小*/
27
+ color: #010704;
28
+ /*字体颜色*/
29
+ }
30
+
31
+ .header-bg {
32
+ background-image: url('https://p2.ssl.qhimgs1.com/t017677196113fc982c.jpg');
33
+ background-size: cover;
34
+ background-position: center;
35
+ height: 200px;
36
+ }
37
+
38
+ .footer-bg {
39
+ background-image: url('https://p2.ssl.qhimgs1.com/t017677196113fc982c.jpg');
40
+ background-size: cover;
41
+ background-position: center;
42
+ height: 200px;
43
+ }
44
+ .layui-side {
45
+ background-color: #9ca58d !important;
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <div class="layui-layout layui-layout-admin">
52
+ <div class="header-bg">
53
+ <!-- 顶部导航栏 -->
54
+ <div class="layui-header">
55
+ <div class="layui-logo layui-hide-xs layui-bg-black">签到管理系统</div>
56
+
57
+ <!-- 导航菜单 -->
58
+ <ul class="layui-nav layui-layout-left">
59
+ <li class="layui-nav-item">
60
+ <a href="javascript:;"><i class="layui-icon layui-icon-user"></i> 学生信息管理</a>
61
+ <dl class="layui-nav-child">
62
+ <dd><a href="switch/modstu"><i class="layui-icon layui-icon-edit"></i> 查询与更新</a></dd>
63
+ <dd><a href="switch/addstu"><i class="layui-icon layui-icon-add-1"></i> 新增学生信息</a></dd>
64
+ </dl>
65
+ </li>
66
+ <li class="layui-nav-item">
67
+ <a href="javascript:;"><i class="layui-icon layui-icon-set"></i> 设备标识管理</a>
68
+ <dl class="layui-nav-child">
69
+ <dd><a href="switch/modroom"><i class="layui-icon layui-icon-edit"></i> 查询与更新</a></dd>
70
+ <dd><a href="switch/addroom"><i class="layui-icon layui-icon-add-1"></i> 新增设备信息</a></dd>
71
+ </dl>
72
+ </li>
73
+ </ul>
74
+
75
+ <!-- 右侧用户菜单 -->
76
+ <ul class="layui-nav layui-layout-right">
77
+ <li class="layui-nav-item layui-hide layui-show-sm-inline-block">
78
+ <a href="javascript:;">
79
+ <img src="https://pic.rmb.bdstatic.com/359341f4f00ad8453f6eb04b433c35ad.jpeg" class="layui-nav-img">
80
+ <!-- tester -->
81
+ </a>
82
+ <dl class="layui-nav-child">
83
+ <!-- <dd><a href="javascript:;">修改登录密码</a></dd>
84
+ <dd><a href="javascript:;">修改绑定手机</a></dd> -->
85
+ <dd><a href="/">登出</a></dd>
86
+ </dl>
87
+ </li>
88
+ <li class="layui-nav-item" lay-header-event="menuRight" lay-unselect>
89
+ <a href="javascript:;">
90
+ <i class="layui-icon layui-icon-more-vertical"></i>
91
+ </a>
92
+ </li>
93
+ </ul>
94
+ </div>
95
+ </div>
96
+
97
+ <!-- 左侧导航栏 -->
98
+ <div class="layui-side layui-bg-black">
99
+ <ul class="layui-nav layui-nav-tree" lay-filter="test">
100
+ <li class="layui-nav-item layui-this">
101
+ <a href="/switch"><i class="layui-icon layui-icon-ok"></i> 实时签到信息</a>
102
+ </li>
103
+ <li class="layui-nav-item">
104
+ <a href="switch/hisinfo"><i class="layui-icon layui-icon-chart"></i> 历史签到信息</a>
105
+ </li>
106
+ </ul>
107
+ </div>
108
+
109
+ <div class="layui-body" style="height: calc(100% - 260px); overflow: auto;">
110
+ <form class="layui-form" action="" id="timesearch_form" name="timesearch_form">
111
+ <div class="layui-form-item">
112
+ <div class="layui-inline" style="margin-top: 25px;">
113
+ <label class="layui-form-label" style="white-space: nowrap">签到截止时间</label>
114
+ <div class="layui-input-inline" style="width: 300px;">
115
+ <input type="text" class="layui-input" id="qdtime">
116
+ </div>
117
+ </div>
118
+ </div>
119
+
120
+ <table class="layui-table" id="record" lay-filter="demot1">
121
+ </table>
122
+ </form>
123
+ </div>
124
+
125
+ <div class="layui-footer footer-bg">
126
+ 不积跬步,无以至千里。
127
+ </div>
128
+ </div>
129
+
130
+ <script src="/layui.js"></script>
131
+ <script src="https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.js"></script>
132
+
133
+ <script>
134
+ //JS
135
+ layui.use(['element', 'layer', 'util', 'table', 'laydate'], function () {
136
+ var element = layui.element;
137
+ var layer = layui.layer;
138
+ var util = layui.util;
139
+ var table = layui.table;
140
+ var laydate = layui.laydate;
141
+ var $ = layui.$;
142
+
143
+ $(function () {
144
+ if ((sessionStorage.getItem("qdtime") == null)) {
145
+ $("#record").hide();
146
+ }
147
+ else {
148
+ $("#record").show();
149
+ }
150
+ $('#qdtime').val(sessionStorage.getItem("qdtime"));
151
+ // $('.layui-nav-child').on('click', 'a[href="javascript:;"]', function () {
152
+ // // 弹出修改密码的表单
153
+ // var passwordForm = '<form id="passwordForm">' +
154
+ // '旧密码: <input type="password" id="oldPassword" required><br>' +
155
+ // '新密码: <input type="password" id="newPassword" required><br>' +
156
+ // '确认密码: <input type="password" id="confirmPassword" required><br>' +
157
+ // '<button type="submit">提交</button>' +
158
+ // '</form>';
159
+ // layer.open({
160
+ // type: 1,
161
+ // title: '修改密码',
162
+ // content: passwordForm,
163
+ // area: ['300px', '250px'], // 宽度和高度
164
+ // btn: ['提交', '取消'],
165
+ // yes: function (index, layero) {
166
+ // var oldPassword = $('#oldPassword').val();
167
+ // var newPassword = $('#newPassword').val();
168
+ // var confirmPassword = $('#confirmPassword').val();
169
+
170
+ // // 简单的前端验证
171
+ // if (newPassword !== confirmPassword) {
172
+ // layer.msg('新密码和确认密码不一致!');
173
+ // return false;
174
+ // }
175
+
176
+ // // 发送 AJAX 请求到服务器端更新密码
177
+ // $.ajax({
178
+ // type: 'post',
179
+ // url: '/api/update_password', // 服务器端更新密码的API路由
180
+ // data: {
181
+ // current_password: oldPassword,
182
+ // new_password: newPassword,
183
+ // confirm_password: confirmPassword
184
+ // },
185
+ // success: function (data) {
186
+ // if (data.status === 'success') {
187
+ // layer.msg('密码更新成功!');
188
+ // // 可能需要在这里处理登出或其它逻辑
189
+ // } else {
190
+ // layer.msg('密码更新失败:' + data.message);
191
+ // }
192
+ // },
193
+ // error: function () {
194
+ // layer.msg('请求失败,请稍后重试!');
195
+ // }
196
+ // });
197
+
198
+ // // 关闭表单层
199
+ // layer.close(index);
200
+ // }
201
+ // });
202
+ // });
203
+ });
204
+
205
+ laydate.render({
206
+ elem: '#qdtime'
207
+ , type: 'time'
208
+ , done: function (value, date) {
209
+ sessionStorage.setItem("qdtime", value);
210
+ $.ajaxSetup({
211
+ data: {
212
+ sign: 0
213
+ }
214
+ });
215
+ $.ajax({
216
+ type: 'post',
217
+ url: '/api/timesearchrt',
218
+ data: {
219
+ time_h: ("0" + date.hours).slice(-2),
220
+ time_m: ("0" + date.minutes).slice(-2),
221
+ time_s: ("0" + date.seconds).slice(-2),
222
+ et: ("0" + date.hours).slice(-2) + ':' + ("0" + date.minutes).slice(-2) + ':' + ("0" + date.seconds).slice(-2),
223
+ sign: 2
224
+ },
225
+ success: function (data) {
226
+ layer.msg('签到截止时间 ' + sessionStorage.getItem("qdtime") + ' 设置成功!');
227
+ top.location.href = '/';
228
+ top.location.reload();
229
+ }
230
+ });
231
+ }
232
+ });
233
+
234
+ //头部事件
235
+ util.event('lay-header-event', {
236
+ menuLeft: function (othis) { // 左侧菜单事件
237
+ layer.msg('展开左侧菜单的操作', { icon: 0 });
238
+ },
239
+ menuRight: function () { // 右侧菜单事件
240
+ layer.open({
241
+ type: 1,
242
+ title: '作者',
243
+ content: '<div style="padding: 15px;">信息工程学院<br/>王璐、孙佳雨</div>',
244
+ area: ['150px', '100%'],
245
+ offset: 'rt', // 右上角
246
+ anim: 'slideLeft', // 从右侧抽屉滑出
247
+ shadeClose: true,
248
+ scrollbar: false
249
+ });
250
+ }
251
+ });
252
+
253
+ table.render({
254
+ elem: '#record',
255
+ url: '/api/recordlistrt',
256
+ toolbar: true,
257
+ title: '签到记录',
258
+ totalRow: true,
259
+ page: true,
260
+ id: 'abc',
261
+ limit: 10,
262
+ limits: [5, 10, 20, 30],
263
+ initSort: {
264
+ field: 'time',
265
+ type: 'desc'
266
+ },
267
+ parseData: function (res) { //res 即为原始返回的数据
268
+ var current_pages;
269
+ if (this.page === true) current_pages = 1;
270
+ else current_pages = this.page.curr;
271
+ var data = res.data.slice(this.limit * (current_pages - 1), this.limit * current_pages);
272
+ return {
273
+ "code": res.code,
274
+ "msg": res.msg,
275
+ "count": res.data.length,
276
+ "data": data
277
+ }
278
+ },
279
+ sort: true,
280
+ cols: [
281
+ [{
282
+ field: 'stuid',
283
+ title: '学号',
284
+ width: 200,
285
+ sort: true
286
+ }, {
287
+ field: 'name',
288
+ title: '姓名',
289
+ width: 200
290
+ }, {
291
+ field: 'type',
292
+ title: '类型',
293
+ width: 200,
294
+ sort: true
295
+ }, {
296
+ field: 'room',
297
+ title: '教室',
298
+ width: 200
299
+ }, {
300
+ field: 'time',
301
+ title: '签到时间',
302
+ sort: true,
303
+ }]
304
+ ]
305
+ });
306
+
307
+ setInterval(function myrefresh() {
308
+ $.ajax({
309
+ url: '/api/check',
310
+ method: 'get',
311
+ data: {},
312
+ success: function (data) {
313
+ if (data.flag1 == 0) {
314
+ sessionStorage.setItem("qdtime", "");
315
+ sessionStorage.setItem("timerange", "");
316
+ sessionStorage.setItem("username", "");
317
+ }
318
+ if (data.flag == 1) {
319
+ // table.reload('/');
320
+ top.location.href = '/';
321
+ top.location.reload();
322
+ layer.msg(data.id + ' 签到成功!');
323
+ }
324
+ else if (data.flag == 2) {
325
+ // table.reload('/');
326
+ top.location.href = '/';
327
+ top.location.reload();
328
+ layer.msg(data.id + ' 重复刷卡!');
329
+ }
330
+ },
331
+ error: function (data) {
332
+ alert("调用失败!");
333
+ }
334
+ });
335
+ }, 1000);
336
+
337
+ });
338
+ </script>
339
+
340
+ </body>
341
+
342
+ </html>
@@ -0,0 +1,268 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="utf-8">
6
+ <title>签到管理系统</title>
7
+ <meta name="renderer" content="webkit">
8
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
9
+ <meta name="viewport" content="width=device-width, initial-scale=1">
10
+ <link href="/css/layui.css" rel="stylesheet">
11
+ <style>
12
+ .layui-header {
13
+ height: 60px;
14
+ background-color: #10081a !important;
15
+ /* 深蓝色 */
16
+ }
17
+
18
+ .layui-layout-left {
19
+ margin-left: 0 !important;
20
+ }
21
+
22
+ .layui-layout-right {
23
+ margin-right: 0 !important;
24
+ }
25
+
26
+ body {
27
+ font-size: 16px;
28
+ /*字体大小*/
29
+ color: #010704;
30
+ /*字体颜色*/
31
+ }
32
+
33
+ .footer-bg {
34
+ background-image: url('https://p2.ssl.qhimgs1.com/t017677196113fc982c.jpg');
35
+ background-size: cover;
36
+ background-position: center;
37
+ height: 200px;
38
+ }
39
+ .layui-side {
40
+ background-color: #9ca58d !important;
41
+ }
42
+ </style>
43
+ </head>
44
+
45
+ <body
46
+ style="background-image: url('https://p2.ssl.qhimgs1.com/t017677196113fc982c.jpg'); background-size: cover; background-repeat: no-repeat; background-position: center; background-attachment: fixed;">
47
+ <div class="layui-layout layui-layout-admin">
48
+ <div class="header-bg">
49
+ <!-- 顶部导航栏 -->
50
+ <div class="layui-header">
51
+ <div class="layui-logo layui-hide-xs layui-bg-black">签到管理系统</div>
52
+
53
+ <!-- 右侧用户菜单 -->
54
+ <ul class="layui-nav layui-layout-right">
55
+ <li class="layui-nav-item layui-hide layui-show-sm-inline-block">
56
+ <a href="javascript:;">
57
+ <img src="https://pic.rmb.bdstatic.com/bjh/gallery/7673bb43bb01190ce0886b7b5dfbfc6a9451.jpeg" class="layui-nav-img">
58
+ <!-- tester -->
59
+ </a>
60
+ <dl class="layui-nav-child">
61
+ <!-- <dd><a href="javascript:;">修改登录密码</a></dd>
62
+ <dd><a href="javascript:;">修改绑定手机</a></dd> -->
63
+ <dd><a href="/">登出</a></dd>
64
+ </dl>
65
+ </li>
66
+ <li class="layui-nav-item" lay-header-event="menuRight" lay-unselect>
67
+ <a href="javascript:;">
68
+ <i class="layui-icon layui-icon-more-vertical"></i>
69
+ </a>
70
+ </li>
71
+ </ul>
72
+ </div>
73
+ </div>
74
+
75
+ <!-- 左侧导航栏 -->
76
+ <div class="layui-side layui-bg-black">
77
+ <ul class="layui-nav layui-nav-tree" lay-filter="test">
78
+ <li class="layui-nav-item layui-this">
79
+ <a href="/switch1"><i class="layui-icon layui-icon-ok"></i> 实时签到信息</a>
80
+ </li>
81
+ <li class="layui-nav-item">
82
+ <a href="switch1/hisinfo"><i class="layui-icon layui-icon-chart"></i> 历史签到信息</a>
83
+ </li>
84
+ </ul>
85
+ </div>
86
+
87
+ <div class="layui-body" style="height: 100%">
88
+ <form class="layui-form" action="" id="timesearch_form" name="timesearch_form">
89
+ <div class="layui-form-item">
90
+ <div class="layui-inline" style="margin-top: 25px;">
91
+ <label class="layui-form-label" style="white-space: nowrap">签到截止时间</label>
92
+ <div class="layui-input-inline" style="width: 300px;">
93
+ <input type="text" class="layui-input" id="qdtime">
94
+ </div>
95
+ </div>
96
+ </div>
97
+
98
+ <table class="layui-table" id="record" lay-filter="demot1">
99
+ </table>
100
+ </form>
101
+ </div>
102
+
103
+ <div class="layui-footer">
104
+ 不积跬步,无以至千里。
105
+ </div>
106
+ </div>
107
+
108
+ <script src="/layui.js"></script>
109
+ <script src="https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.js"></script>
110
+
111
+ <script>
112
+ //JS
113
+ layui.use(['element', 'layer', 'util', 'table', 'laydate'], function () {
114
+ var element = layui.element;
115
+ var layer = layui.layer;
116
+ var util = layui.util;
117
+ var table = layui.table;
118
+ var laydate = layui.laydate;
119
+ var $ = layui.$;
120
+
121
+ $(function () {
122
+ if ((sessionStorage.getItem("qdtime") == null)) {
123
+ $("#record").hide();
124
+ }
125
+ else {
126
+ $("#record").show();
127
+ }
128
+ $('#qdtime').val(sessionStorage.getItem("qdtime"));
129
+ });
130
+
131
+ laydate.render({
132
+ elem: '#qdtime'
133
+ , type: 'time'
134
+ , done: function (value, date) {
135
+ sessionStorage.setItem("qdtime", value);
136
+ $.ajaxSetup({
137
+ data: {
138
+ sign: 0
139
+ }
140
+ });
141
+ $.ajax({
142
+ type: 'post',
143
+ url: '/api/timesearchrt',
144
+ data: {
145
+ time_h: ("0" + date.hours).slice(-2),
146
+ time_m: ("0" + date.minutes).slice(-2),
147
+ time_s: ("0" + date.seconds).slice(-2),
148
+ et: ("0" + date.hours).slice(-2) + ':' + ("0" + date.minutes).slice(-2) + ':' + ("0" + date.seconds).slice(-2),
149
+ sign: 2
150
+ },
151
+ success: function (data) {
152
+ layer.msg('签到截止时间 ' + sessionStorage.getItem("qdtime") + ' 设置成功!');
153
+ top.location.href = '/';
154
+ top.location.reload();
155
+ }
156
+ });
157
+ }
158
+ });
159
+
160
+ //头部事件
161
+ util.event('lay-header-event', {
162
+ menuLeft: function (othis) { // 左侧菜单事件
163
+ layer.msg('展开左侧菜单的操作', { icon: 0 });
164
+ },
165
+ menuRight: function () { // 右侧菜单事件
166
+ layer.open({
167
+ type: 1,
168
+ title: '作者',
169
+ content: '<div style="padding: 15px;">信息工程学院<br/>王璐、孙佳雨</div>',
170
+ area: ['150px', '100%'],
171
+ offset: 'rt', // 右上角
172
+ anim: 'slideLeft', // 从右侧抽屉滑出
173
+ shadeClose: true,
174
+ scrollbar: false
175
+ });
176
+ }
177
+ });
178
+
179
+ table.render({
180
+ elem: '#record',
181
+ url: '/api/recordlistrt',
182
+ toolbar: true,
183
+ title: '签到记录',
184
+ totalRow: true,
185
+ page: true,
186
+ id: 'abc',
187
+ limit: 10,
188
+ limits: [5, 10, 20, 30],
189
+ initSort: {
190
+ field: 'time',
191
+ type: 'desc'
192
+ },
193
+ parseData: function (res) { //res 即为原始返回的数据
194
+ var current_pages;
195
+ if (this.page === true) current_pages = 1;
196
+ else current_pages = this.page.curr;
197
+ var data = res.data.slice(this.limit * (current_pages - 1), this.limit * current_pages);
198
+ return {
199
+ "code": res.code,
200
+ "msg": res.msg,
201
+ "count": res.data.length,
202
+ "data": data
203
+ }
204
+ },
205
+ sort: true,
206
+ cols: [
207
+ [{
208
+ field: 'stuid',
209
+ title: '学号',
210
+ width: 200,
211
+ sort: true
212
+ }, {
213
+ field: 'name',
214
+ title: '姓名',
215
+ width: 200
216
+ }, {
217
+ field: 'type',
218
+ title: '类型',
219
+ width: 200,
220
+ sort: true
221
+ }, {
222
+ field: 'room',
223
+ title: '教室',
224
+ width: 200
225
+ }, {
226
+ field: 'time',
227
+ title: '签到时间',
228
+ sort: true,
229
+ }]
230
+ ]
231
+ });
232
+
233
+ setInterval(function myrefresh() {
234
+ $.ajax({
235
+ url: '/api/check',
236
+ method: 'get',
237
+ data: {},
238
+ success: function (data) {
239
+ if (data.flag1 == 0) {
240
+ sessionStorage.setItem("qdtime", "");
241
+ sessionStorage.setItem("timerange", "");
242
+ sessionStorage.setItem("username", "");
243
+ }
244
+ if (data.flag == 1) {
245
+ // table.reload('/');
246
+ top.location.href = '/';
247
+ top.location.reload();
248
+ layer.msg(data.id + ' 签到成功!');
249
+ }
250
+ else if (data.flag == 2) {
251
+ // table.reload('/');
252
+ top.location.href = '/';
253
+ top.location.reload();
254
+ layer.msg(data.id + ' 重复刷卡!');
255
+ }
256
+ },
257
+ error: function (data) {
258
+ alert("调用失败!");
259
+ }
260
+ });
261
+ }, 1000);
262
+
263
+ });
264
+ </script>
265
+
266
+ </body>
267
+
268
+ </html>