myapp_9wlsjy 1.0.1

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 +101 -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,442 @@
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 layui-this">
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
+ <div class="layui-form-item">
104
+ <div class="layui-inline">
105
+ <label class="layui-form-label" style="white-space: nowrap; margin-top: 25px;">日期时间范围</label>
106
+ <div class="layui-input-inline" style="width: 300px; margin-top: 25px;">
107
+ <input type="text" class="layui-input" id="timerange" placeholder=" - ">
108
+ </div>
109
+ </div>
110
+
111
+ <div class="layui-inline" style="margin-top: 25px; margin-left: 10px;">
112
+ <label class="layui-form-label">学号查询</label>
113
+ <div class="layui-input-inline">
114
+ <input type="text" id="studentId" class="layui-input" placeholder="请输入学号">
115
+ </div>
116
+ <!-- <button id="searchButton" class="layui-btn">查询</button> -->
117
+ </div>
118
+
119
+ <div class="layui-inline" style="margin-top: 25px; margin-left: 10px;">
120
+ <label class="layui-form-label">房间号查询</label>
121
+ <div class="layui-input-inline">
122
+ <input type="text" id="roomNumber" class="layui-input" placeholder="请输入房间号">
123
+ </div>
124
+ </div>
125
+
126
+ <button id="combinedSearchButton" class="layui-btn">组合查询</button>
127
+
128
+ <div class="layui-inline" style="float: right; margin-top: 25px;">
129
+ <button id="chartshow" class="layui-btn" type="button" lay-filter="chartshow">迟到情况统计
130
+ </button>
131
+ </div>
132
+ </div>
133
+
134
+ <table class="layui-table" id="record" lay-filter="demot1">
135
+ </table>
136
+ </div>
137
+
138
+
139
+
140
+ <div class="layui-footer">
141
+ 不积跬步,无以至千里。
142
+ </div>
143
+ </div>
144
+
145
+ <div class="layui-row layui-col-md3" style="width:550px;margin:auto;display:none;" id="chart">
146
+ <canvas id="myChart"></canvas>
147
+ <table lay-even lay-skin="nob" style="float: right">
148
+ <tbody>
149
+ <tr>
150
+ <td>正常:</td>
151
+ <td><label name="normalper" id="normalper" style="float: right"></label></td>
152
+ </tr>
153
+ <tr>
154
+ <td>迟到:</td>
155
+ <td><label name="lateper" id="lateper" style="float: right"></label></td>
156
+ </tr>
157
+ </tbody>
158
+ </table>
159
+ </div>
160
+
161
+ <script src="/layui.js"></script>
162
+ <script src="https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.js"></script>
163
+ <script src="https://cdn.bootcss.com/Chart.js/2.7.3/Chart.js"></script>
164
+
165
+ <script>
166
+
167
+ layui.use(['layer', 'form', 'table', 'laydate'], function () {
168
+ var layer = layui.layer;
169
+ var form = layui.form;
170
+ var table = layui.table;
171
+ var laydate = layui.laydate;
172
+
173
+ // 初始化表格
174
+ var tableIns = table.render({
175
+ elem: '#record',
176
+ url: '/api/combinedSearch', // 数据来源URL
177
+ page: true, // 开启分页
178
+ sort: true,
179
+ cols: [
180
+ [ // 表格标题
181
+ { field: 'stuid', title: '学号', width: 130 },
182
+ { field: 'name', title: '姓名', width: 130 },
183
+ { field: 'type', title: '类型', width: 130, sort: true },
184
+ { field: 'room', title: '教室', width: 130 },
185
+ { field: 'time', title: '签到时间', sort: true },
186
+ { field: 'qd', title: '签到情况', sort: true }
187
+ ]
188
+ ],
189
+ done: function (res) {
190
+ if (res.code === 0) {
191
+ // 分页数据符合规范
192
+ } else {
193
+ // 处理错误情况
194
+ layer.msg('查询数据失败');
195
+ }
196
+ },
197
+ sort: function (obj) { // 定义排序的回调
198
+ // 获取当前排序的字段和排序顺序
199
+ var field = obj.field; // 当前排序的字段名
200
+ var order = obj.type; // 当前排序的顺序:asc 升序,desc 降序
201
+
202
+ // 重新加载表格,添加排序参数
203
+ tableIns.reload({
204
+ where: {
205
+ sortField: field, // 排序字段
206
+ sortOrder: order // 排序顺序
207
+ }
208
+ });
209
+ }
210
+ });
211
+
212
+ //绑定查询按钮的点击事件
213
+ // document.getElementById('searchButton').addEventListener('click', function () {
214
+ // var studentId = document.getElementById('studentId').value; // 获取学号输入框的值
215
+
216
+ // // 重新加载表格,包含分页参数
217
+ // tableIns.reload({
218
+ // where: { // 设置查询条件
219
+ // stuid: studentId
220
+ // },
221
+ // page: {
222
+ // curr: 1 // 从第一页开始
223
+ // }
224
+ // });
225
+ // });
226
+
227
+ // 绑定组合查询按钮的点击事件
228
+ document.getElementById('combinedSearchButton').addEventListener('click', function () {
229
+ var studentId = document.getElementById('studentId').value.trim();
230
+ var roomNumber = document.getElementById('roomNumber').value.trim();
231
+
232
+ // 检查输入是否为空
233
+ if (!studentId || !roomNumber) {
234
+ layer.msg('学号或房间号不能为空');
235
+ return;
236
+ }
237
+
238
+ tableIns.reload({
239
+ where: { // 设置查询条件
240
+ stuid: studentId,
241
+ roomNumber: roomNumber
242
+ },
243
+ page: {
244
+ curr: 1 // 从第一页开始
245
+ }
246
+ });
247
+
248
+
249
+ // 构建查询参数
250
+ // var queryParams = new URLSearchParams({
251
+ // stuid: studentId,
252
+ // roomNumber: roomNumber,
253
+ // page: 1,
254
+ // limit: 10,
255
+ // sort: 'time',
256
+ // order: 'desc'
257
+ // }).toString();
258
+
259
+ // // 调用后端API进行组合查询
260
+ // fetch('/api/combinedSearch?' + queryParams, {
261
+ // method: 'GET'
262
+ // })
263
+ // .then(response => response.json())
264
+ // .then(data => {
265
+ // if (data.code === 0) {
266
+ // // 重新渲染表格
267
+ // tableIns.reload({
268
+ // data: data.data
269
+ // });
270
+ // } else {
271
+ // layer.msg('查询失败:' + data.msg);
272
+ // }
273
+ // })
274
+ // .catch(error => {
275
+ // layer.msg('查询出错');
276
+ // console.error('Error:', error);
277
+ // });
278
+ });
279
+ });
280
+ //JS
281
+ layui.use(['element', 'layer', 'util', 'table', 'laydate'], function () {
282
+ var element = layui.element;
283
+ var layer = layui.layer;
284
+ var util = layui.util;
285
+ var table = layui.table;
286
+ var laydate = layui.laydate;
287
+ var $ = layui.$;
288
+ var form = layui.form;
289
+ var returnMessage;
290
+ // var $ = layui.jquery;
291
+ var ctx = document.getElementById('myChart').getContext('2d');
292
+
293
+ laydate.render({
294
+ elem: '#timerange'
295
+ , type: 'datetime'
296
+ , range: true
297
+ , done: function (value, date, endDate) {
298
+ sessionStorage.setItem("timerange", value);
299
+ value = value.split(" - ");
300
+ $.ajax({
301
+ type: 'post',
302
+ url: '/api/timesearch',
303
+ data: {
304
+ bt: value[0],
305
+ et: value[1],
306
+ sign: 1
307
+ },
308
+ success: function (data) {
309
+ top.location.href = '';
310
+ top.location.reload();
311
+ }
312
+ });
313
+ }
314
+ });
315
+
316
+ $(document).on('click', '#chartshow', function () {
317
+ var myChart = new Chart(ctx, {
318
+ type: 'pie',
319
+ data: {
320
+ labels: ['正常', '迟到'],
321
+ datasets: [{
322
+ label: '示例',
323
+ data: [sessionStorage.getItem("normal"), sessionStorage.getItem("late")],
324
+ backgroundColor: ['#58D3F7', '#FA8258'],
325
+ borderWidth: 1
326
+ }]
327
+ }
328
+ })
329
+ $('#normalper').html(((parseInt(sessionStorage.getItem("normal")) / (parseInt(sessionStorage.getItem("normal")) +
330
+ parseInt(sessionStorage.getItem("late")))) * 100).toFixed(2) + '%');
331
+ $('#lateper').html(((parseInt(sessionStorage.getItem("late")) / (parseInt(sessionStorage.getItem("normal")) +
332
+ parseInt(sessionStorage.getItem("late")))) * 100).toFixed(2) + '%');
333
+ layer.open({
334
+ type: 1,
335
+ id: 5,
336
+ title: "迟到情况统计",
337
+ area: ['35%', '50%'],
338
+ content: $("#chart"),
339
+ });
340
+ });
341
+
342
+ //头部事件
343
+ util.event('lay-header-event', {
344
+ menuLeft: function (othis) { // 左侧菜单事件
345
+ layer.msg('展开左侧菜单的操作', { icon: 0 });
346
+ },
347
+ menuRight: function () { // 右侧菜单事件
348
+ layer.open({
349
+ type: 1,
350
+ title: '作者',
351
+ content: '<div style="padding: 15px;">信息工程学院<br />王璐、孙佳雨</div>',
352
+ area: ['150px', '100%'],
353
+ offset: 'rt', // 右上角
354
+ anim: 'slideLeft', // 从右侧抽屉滑出
355
+ shadeClose: true,
356
+ scrollbar: false
357
+ });
358
+ }
359
+ });
360
+
361
+ table.render({
362
+ elem: '#record',
363
+ url: '/api/recordlist',
364
+ toolbar: true,
365
+ title: '签到记录',
366
+ totalRow: true,
367
+ page: true,
368
+ id: 'abc',
369
+ limit: 10,
370
+ limits: [5, 10, 20, 30],
371
+ initSort: {
372
+ field: 'time',
373
+ type: 'desc'
374
+ },
375
+ parseData: function (res) { //res 即为原始返回的数据
376
+ var current_pages;
377
+ if (this.page === true) current_pages = 1;
378
+ else current_pages = this.page.curr;
379
+ var data = res.data.slice(this.limit * (current_pages - 1), this.limit * current_pages);
380
+ return {
381
+ "code": res.code,
382
+ "msg": res.msg,
383
+ "count": res.data.length,
384
+ "data": data
385
+ }
386
+ },
387
+ sort: true,
388
+ cols: [
389
+ [{
390
+ field: 'stuid',
391
+ title: '学号',
392
+ width: 130,
393
+ sort: true
394
+ }, {
395
+ field: 'name',
396
+ title: '姓名',
397
+ width: 130
398
+ }, {
399
+ field: 'type',
400
+ title: '类型',
401
+ width: 130,
402
+ sort: true
403
+ }, {
404
+ field: 'room',
405
+ title: '教室',
406
+ width: 130
407
+ }, {
408
+ field: 'time',
409
+ title: '签到时间',
410
+ sort: true
411
+ }, {
412
+ field: 'qd',
413
+ title: '签到情况',
414
+ sort: true
415
+ }]
416
+ ],
417
+ done: function (res, curr, count) {
418
+ $.ajax({
419
+ type: 'get',
420
+ url: '/api/chartcheck',
421
+ success: function (data) {
422
+ sessionStorage.setItem("late", data.la);
423
+ sessionStorage.setItem("normal", data.no);
424
+ }
425
+ });
426
+ $.each(res.data, function (index, item) {
427
+ if (item.qd == '迟到') {
428
+ $("#record").next().find('tbody tr[data-index="' + index +
429
+ '"]').css("background-color", "#FFA07A");
430
+ }
431
+ });
432
+ }
433
+ });
434
+
435
+
436
+
437
+ });
438
+ </script>
439
+
440
+ </body>
441
+
442
+ </html>