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,365 @@
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
+ .footer-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
+ .layui-side {
38
+ background-color: #9ca58d !important;
39
+ }
40
+ </style>
41
+ </head>
42
+
43
+ <body style="background-image: url('https://p2.ssl.qhimgs1.com/t017677196113fc982c.jpg'); background-size: cover; background-repeat: no-repeat; background-position: center; background-attachment: fixed;">
44
+ <div class="layui-layout layui-layout-admin">
45
+ <div class="header-bg">
46
+ <!-- 顶部导航栏 -->
47
+ <div class="layui-header">
48
+ <div class="layui-logo layui-hide-xs layui-bg-black">签到管理系统</div>
49
+
50
+ <!-- 导航菜单 -->
51
+ <ul class="layui-nav layui-layout-left">
52
+ <li class="layui-nav-item">
53
+ <a href="javascript:;"><i class="layui-icon layui-icon-user"></i> 学生信息管理</a>
54
+ <dl class="layui-nav-child">
55
+ <dd><a href="modstu"><i class="layui-icon layui-icon-edit"></i> 查询与更新</a></dd>
56
+ <dd><a href="addstu"><i class="layui-icon layui-icon-add-1"></i> 新增学生信息</a></dd>
57
+ </dl>
58
+ </li>
59
+ <li class="layui-nav-item">
60
+ <a href="javascript:;"><i class="layui-icon layui-icon-set"></i> 设备标识管理</a>
61
+ <dl class="layui-nav-child">
62
+ <dd><a href="modroom"><i class="layui-icon layui-icon-edit"></i> 查询与更新</a></dd>
63
+ <dd><a href="addroom"><i class="layui-icon layui-icon-add-1"></i> 新增设备信息</a></dd>
64
+ </dl>
65
+ </li>
66
+ </ul>
67
+
68
+ <!-- 右侧用户菜单 -->
69
+ <ul class="layui-nav layui-layout-right">
70
+ <li class="layui-nav-item layui-hide layui-show-sm-inline-block">
71
+ <a href="javascript:;">
72
+ <img src="https://pic.rmb.bdstatic.com/359341f4f00ad8453f6eb04b433c35ad.jpeg" class="layui-nav-img">
73
+ <!-- tester -->
74
+ </a>
75
+ <dl class="layui-nav-child">
76
+ <!-- <dd><a href="javascript:;">修改登录密码</a></dd>
77
+ <dd><a href="javascript:;">修改绑定手机</a></dd> -->
78
+ <dd><a href="/">登出</a></dd>
79
+ </dl>
80
+ </li>
81
+ <li class="layui-nav-item" lay-header-event="menuRight" lay-unselect>
82
+ <a href="javascript:;">
83
+ <i class="layui-icon layui-icon-more-vertical"></i>
84
+ </a>
85
+ </li>
86
+ </ul>
87
+ </div>
88
+ </div>
89
+
90
+ <!-- 左侧导航栏 -->
91
+ <div class="layui-side layui-bg-black">
92
+ <ul class="layui-nav layui-nav-tree" lay-filter="test">
93
+ <li class="layui-nav-item">
94
+ <a href="/switch"><i class="layui-icon layui-icon-ok"></i> 实时签到信息</a>
95
+ </li>
96
+ <li class="layui-nav-item">
97
+ <a href="hisinfo"><i class="layui-icon layui-icon-chart"></i> 历史签到信息</a>
98
+ </li>
99
+ </ul>
100
+ </div>
101
+
102
+ <div class="layui-body" style="height: 100%">
103
+ <!-- 刷卡机管理 -->
104
+ <form class="layui-form" action="" id="roomsearch_form" name="roomsearch_form">
105
+ <label class="layui-form-label" style="margin-top: 25px;">房间号查找</label>
106
+ <div class="layui-input-inline" style="width: 300px; margin-top: 25px;">
107
+ <input type="text" class="layui-input" id="roominput" name="roominput">
108
+ </div>
109
+ <div class="layui-inline">
110
+ <button class="layui-btn" lay-submit lay-filter="roomsearch" style="margin-top: 25px;">
111
+ <i class="layui-icon layui-icon-search"
112
+ style="font-size: 15px; color: #ffffff;"></i>
113
+ 搜索
114
+ </button>
115
+ <button class="layui-btn" lay-submit lay-filter="allroomsearch" style="margin-top: 25px;">
116
+ 显示全部
117
+ </button>
118
+ </div>
119
+ <table class="layui-table" id="rooms" lay-filter="demot3">
120
+ </table>
121
+ </form>
122
+ </div>
123
+
124
+ <div class="layui-footer">
125
+ 不积跬步,无以至千里。
126
+ </div>
127
+ </div>
128
+
129
+ <div id='barDemo' style='display:none'>
130
+ <a class="layui-btn layui-btn-xs" id="only_watch_btn" lay-event="detail">仅查看</a>
131
+ <a class="layui-btn layui-btn-xs" id="mod_btn" lay-event="fix">修改</a>
132
+ <a class="layui-btn layui-btn-danger layui-btn-xs" id="delete_btn" name="delete_btn" lay-event="del"
133
+ style="display:inline-block">删除</a>
134
+ </div>
135
+ <div id='barDemo1' style='display:none'>
136
+ <a class="layui-btn layui-btn-xs" lay-event="passwordchange">编辑</a>
137
+ </div>
138
+
139
+ <script src="/layui.js"></script>
140
+ <script src="https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.js"></script>
141
+
142
+ <script>
143
+ //JS
144
+ layui.use(['element', 'layer', 'util', 'table', 'laydate', 'form'], function () {
145
+ var element = layui.element;
146
+ var layer = layui.layer;
147
+ var util = layui.util;
148
+ var table = layui.table;
149
+ var laydate = layui.laydate;
150
+ var $ = layui.$;
151
+ var form = layui.form;
152
+
153
+ $(function () {
154
+ $('#idinput').val(sessionStorage.getItem("stuidsearch"));
155
+ if ((sessionStorage.getItem("username") == null) || (sessionStorage.getItem("username") == "")) {
156
+ $("#delete_btn").hide();
157
+ $("#mod_btn").hide();
158
+ $("#only_watch_btn").show();
159
+ sessionStorage.setItem("editaccess", false);
160
+ }
161
+ else {
162
+ $("#delete_btn").show();
163
+ $("#mod_btn").show();
164
+ $("#only_watch_btn").hide();
165
+ sessionStorage.setItem("editaccess", true);
166
+ }
167
+ });
168
+
169
+ table.render({
170
+ elem: '#rooms',
171
+ //height: 300,
172
+ url: '/api/roomslist',
173
+ id: 'def3',
174
+ toolbar: true,
175
+ title: '刷卡机房间信息',
176
+ totalRow: true,
177
+ page: true,
178
+ limit: 10,
179
+ limits: [5, 10, 20, 30],
180
+ initSort: {
181
+ field: 'num'
182
+ },
183
+ parseData: function (res) { //res 即为原始返回的数据
184
+ var current_pages;
185
+ if (this.page === true) current_pages = 1;
186
+ else current_pages = this.page.curr;
187
+ var data = res.data.slice(this.limit * (current_pages - 1), this.limit * current_pages);
188
+ return {
189
+ "code": res.code,
190
+ "msg": res.msg,
191
+ "count": res.data.length,
192
+ "data": data
193
+ }
194
+ },
195
+ sort: true,
196
+ cols: [
197
+ [{
198
+ field: 'num',
199
+ title: '房间号',
200
+ width: 130,
201
+ sort: true
202
+ },
203
+ {
204
+ field: 'mac',
205
+ title: '刷卡机',
206
+ width: 500,
207
+ edit: sessionStorage.getItem("editaccess")
208
+ },
209
+ {
210
+ toolbar: '#barDemo',
211
+ fixed: 'right'
212
+ }]
213
+ ]
214
+ });
215
+
216
+ table.on('edit(demot3)', function (obj) {
217
+ console.log(obj.data);
218
+ $.ajax({
219
+ url: '/db/update_rooms',
220
+ method: 'post',
221
+ data: obj.data,
222
+ success: function (data) {
223
+ if (data.status == 'ok') {
224
+ layer.msg('更新成功!');
225
+ setTimeout(function () {
226
+ top.location.reload();
227
+ }, 1500);
228
+ } else if (data.status == 'error') {
229
+ layer.msg('更新失败! 原因是:' + data.err);
230
+ setTimeout(function () {
231
+ top.location.reload();
232
+ }, 1500);
233
+ }
234
+ }
235
+ });
236
+ return false;
237
+ });
238
+
239
+ table.on('tool(demot3)', function (obj) {
240
+ var data = obj.data; //当前行的数据
241
+ var layEvent = obj.event; //当前行的具体的哪个event
242
+
243
+ if (layEvent === 'detail') {
244
+ layer.msg(JSON.stringify(data));
245
+ }
246
+ else if (layEvent === 'fix') {
247
+ layer.msg("请在对应表格中直接修改即可!");
248
+ }
249
+ else if (layEvent === 'del') {
250
+ layer.confirm('真的要删除吗?', function (index) {
251
+ obj.del();
252
+ layer.close(index);
253
+ $.ajax({
254
+ url: '/db/delete_rooms',
255
+ method: 'post',
256
+ data: {
257
+ id: data.id,
258
+ stuid: data.stuid
259
+ },
260
+ success: function (data) {
261
+ table.reload('def3');
262
+ layer.msg('删除成功!');
263
+ }
264
+ });
265
+ })
266
+ }
267
+ });
268
+
269
+
270
+
271
+
272
+ //头部事件
273
+ util.event('lay-header-event', {
274
+ menuLeft: function (othis) { // 左侧菜单事件
275
+ layer.msg('展开左侧菜单的操作', { icon: 0 });
276
+ },
277
+ menuRight: function () { // 右侧菜单事件
278
+ layer.open({
279
+ type: 1,
280
+ title: '作者',
281
+ content: '<div style="padding: 15px;">信息工程学院<br/>王璐、孙佳雨</div>',
282
+ area: ['150px', '100%'],
283
+ offset: 'rt', // 右上角
284
+ anim: 'slideLeft', // 从右侧抽屉滑出
285
+ shadeClose: true,
286
+ scrollbar: false
287
+ });
288
+ }
289
+ });
290
+
291
+ form.on('submit(roomsearch)', function (data) {
292
+ $.ajax({
293
+ type: 'post',
294
+ url: '/api/roomsearch',
295
+ data: {
296
+ sign: 1,
297
+ id: data.field.roominput
298
+ },
299
+ success: function (data) {
300
+ top.location.href = '';
301
+ top.location.reload();
302
+ }
303
+ });
304
+ return false;
305
+ });
306
+
307
+ form.on('submit(allroomsearch)', function (data) {
308
+ $.ajax({
309
+ type: 'post',
310
+ url: '/api/roomsearch',
311
+ data: {
312
+ sign: 0
313
+ },
314
+ success: function (data) {
315
+ top.location.href = '';
316
+ top.location.reload();
317
+ }
318
+ });
319
+ return false;
320
+ });
321
+
322
+ // form.verify({
323
+ // roomnum: function (value, item) { //value:表单的值、item:表单的DOM对象
324
+ // var checkResult = "";
325
+ // $.ajax({
326
+ // url: "/api/inputcheck2",
327
+ // type: "POST",
328
+ // data: {
329
+ // idinput: value
330
+ // },
331
+ // async: false,
332
+ // success: function (result) {
333
+ // if (result.sign == 0) {
334
+ // checkResult = "该房间已存在";
335
+ // }
336
+ // }
337
+ // });
338
+ // if (checkResult != '')
339
+ // return checkResult;
340
+ // }
341
+ // , mac: function (value, item) { //value:表单的值、item:表单的DOM对象
342
+ // var checkResult = "";
343
+ // $.ajax({
344
+ // url: "/api/inputcheck3",
345
+ // type: "POST",
346
+ // data: {
347
+ // idinput: value
348
+ // },
349
+ // async: false,
350
+ // success: function (result) {
351
+ // if ((result.sign == 0) && (value != "")) {
352
+ // checkResult = "该机器已存在于其他房间中";
353
+ // }
354
+ // }
355
+ // });
356
+ // if (checkResult != '')
357
+ // return checkResult;
358
+ // }
359
+ // });
360
+ });
361
+ </script>
362
+
363
+ </body>
364
+
365
+ </html>