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,375 @@
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
+ <form class="layui-form" action="" id="idsearch_form" name="idsearch_form">
104
+ <label class="layui-form-label" style="margin-top: 25px;">按学号查找</label>
105
+ <div class="layui-input-inline" style="width: 300px; margin-top: 25px;">
106
+ <input type="text" class="layui-input" id="idinput" name="idinput">
107
+ </div>
108
+ <div class="layui-inline">
109
+ <button class="layui-btn" lay-submit lay-filter="idsearch" style="margin-top: 25px;">
110
+ <i class="layui-icon layui-icon-search" style="font-size: 15px; color: #ffffff;"></i>
111
+ 搜索
112
+ </button>
113
+ <button class="layui-btn" lay-submit lay-filter="allidsearch" style="margin-top: 25px;">
114
+ 显示全部
115
+ </button>
116
+ </div>
117
+ <table class="layui-table" id="numbers" lay-filter="demot2">
118
+ </table>
119
+ </form>
120
+ </div>
121
+
122
+ <div class="layui-footer">
123
+ 不积跬步,无以至千里。
124
+ </div>
125
+ </div>
126
+
127
+ <div id='barDemo' style='display:none'>
128
+ <a class="layui-btn layui-btn-xs" id="only_watch_btn" lay-event="detail">仅查看</a>
129
+ <a class="layui-btn layui-btn-xs" id="mod_btn" lay-event="fix">修改</a>
130
+ <a class="layui-btn layui-btn-danger layui-btn-xs" id="delete_btn" name="delete_btn" lay-event="del"
131
+ style="display:inline-block">删除</a>
132
+ </div>
133
+ <div id='barDemo1' style='display:none'>
134
+ <a class="layui-btn layui-btn-xs" lay-event="passwordchange">编辑</a>
135
+ </div>
136
+
137
+ <script src="/layui.js"></script>
138
+ <script src="https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.js"></script>
139
+
140
+ <script>
141
+ //JS
142
+ layui.use(['element', 'layer', 'util', 'table', 'laydate', 'form'], function () {
143
+ var element = layui.element;
144
+ var layer = layui.layer;
145
+ var util = layui.util;
146
+ var table = layui.table;
147
+ var laydate = layui.laydate;
148
+ var $ = layui.$;
149
+ var form = layui.form;
150
+
151
+ $(function () {
152
+ $('#idinput').val(sessionStorage.getItem("stuidsearch"));
153
+ if ((sessionStorage.getItem("username") == null) || (sessionStorage.getItem("username") == "")) {
154
+ $("#delete_btn").hide();
155
+ $("#mod_btn").hide();
156
+ $("#only_watch_btn").show();
157
+ sessionStorage.setItem("editaccess", false);
158
+ }
159
+ else {
160
+ $("#delete_btn").show();
161
+ $("#mod_btn").show();
162
+ $("#only_watch_btn").hide();
163
+ sessionStorage.setItem("editaccess", true);
164
+ }
165
+ });
166
+
167
+ table.render({
168
+ elem: '#numbers',
169
+ url: '/api/list',
170
+ id: 'def',
171
+ toolbar: true,
172
+ title: '个人信息',
173
+ totalRow: true,
174
+ page: true,
175
+ limit: 10,
176
+ limits: [5, 10, 20, 30],
177
+ parseData: function (res) {
178
+ console.log(res);
179
+ var current_pages;
180
+ if (this.page === true) current_pages = 1;
181
+ else current_pages = this.page.curr;
182
+ var data = res.data.slice(this.limit * (current_pages - 1), this.limit * current_pages);
183
+ return {
184
+ "code": res.code,
185
+ "msg": res.msg,
186
+ "count": res.data.length,
187
+ "data": data
188
+ }
189
+ },
190
+ cols: [
191
+ [{
192
+ field: 'stuid',
193
+ title: '学号',
194
+ width: 200,
195
+ sort: true
196
+ }, {
197
+ field: 'name',
198
+ title: '姓名',
199
+ width: 200,
200
+ edit: sessionStorage.getItem("editaccess")
201
+ }, {
202
+ field: 'cardid',
203
+ title: '卡号',
204
+ width: 350,
205
+ edit: sessionStorage.getItem("editaccess"),
206
+ sort: true
207
+ }, {
208
+ field: 'type',
209
+ title: '类型',
210
+ width: 200,
211
+ edit: sessionStorage.getItem("editaccess"),
212
+ sort: true
213
+ }, {
214
+ title: '操作',
215
+ toolbar: '#barDemo',
216
+ fixed: 'right'
217
+ }]
218
+ ]
219
+ });
220
+
221
+ table.on('edit(demot2)', function (obj) {
222
+ console.log(obj.data);
223
+ $.ajax({
224
+ url: '/db/update_users',
225
+ method: 'post',
226
+ data: obj.data,
227
+ success: function (data) {
228
+ if (data.status == 'ok') {
229
+ layer.msg('更新成功!');
230
+ setTimeout(function () {
231
+ top.location.reload();
232
+ }, 1500);
233
+ } else if (data.status == 'error') {
234
+ layer.msg('更新失败! 原因是:' + data.err);
235
+ setTimeout(function () {
236
+ top.location.reload();
237
+ }, 1500);
238
+ }
239
+ }
240
+ });
241
+ return false;
242
+ });
243
+
244
+ table.on('tool(demot2)', function (obj) {
245
+ var data = obj.data; //当前行的数据
246
+ var layEvent = obj.event; //当前行的具体的哪个event
247
+
248
+ if (layEvent === 'detail') {
249
+ layer.msg(JSON.stringify(data));
250
+ }
251
+ else if (layEvent === 'fix') {
252
+ layer.msg("请在对应表格中直接修改即可!");
253
+ }
254
+ else if (layEvent === 'del') {
255
+ layer.confirm('真的要删除吗?', function (index) {
256
+ obj.del();
257
+ layer.close(index);
258
+ $.ajax({
259
+ url: '/db/delete_users',
260
+ method: 'post',
261
+ data: {
262
+ id: data.id,
263
+ stuid: data.stuid
264
+ },
265
+ success: function (data) {
266
+ table.reload('def');
267
+ layer.msg('删除成功!');
268
+ }
269
+ });
270
+ })
271
+ }
272
+ });
273
+
274
+
275
+
276
+ //头部事件
277
+ util.event('lay-header-event', {
278
+ menuLeft: function (othis) { // 左侧菜单事件
279
+ layer.msg('展开左侧菜单的操作', { icon: 0 });
280
+ },
281
+ menuRight: function () { // 右侧菜单事件
282
+ layer.open({
283
+ type: 1,
284
+ title: '作者',
285
+ content: '<div style="padding: 15px;">信息工程学院<br/>王璐、孙佳雨</div>',
286
+ area: ['150px', '100%'],
287
+ offset: 'rt', // 右上角
288
+ anim: 'slideLeft', // 从右侧抽屉滑出
289
+ shadeClose: true,
290
+ scrollbar: false
291
+ });
292
+ }
293
+ });
294
+
295
+ form.on('submit(idsearch)', function (data) {
296
+ sessionStorage.setItem("stuidsearch", data.field.idinput);
297
+ $.ajax({
298
+ type: 'post',
299
+ url: '/api/idsearch',
300
+ data: {
301
+ sign: 1,
302
+ id: data.field.idinput
303
+ },
304
+ success: function (data) {
305
+ top.location.href = '';
306
+ top.location.reload();
307
+ }
308
+ });
309
+ return false;
310
+ });
311
+
312
+ form.on('submit(allidsearch)', function (data) {
313
+ sessionStorage.setItem("stuidsearch", '');
314
+ $.ajax({
315
+ type: 'post',
316
+ url: '/api/idsearch',
317
+ data: {
318
+ sign: 0
319
+ },
320
+ success: function (data) {
321
+ top.location.href = '';
322
+ top.location.reload();
323
+ }
324
+ });
325
+ return false;
326
+ });
327
+ });
328
+
329
+ form.verify({
330
+ stuid: function (value, item) { //value:表单的值、item:表单的DOM对象
331
+ var checkResult = "";
332
+ $.ajax({
333
+ url: "/api/inputcheck0",
334
+ type: "POST",
335
+ data: {
336
+ n: 0,
337
+ idinput: value
338
+ },
339
+ async: false,
340
+ success: function (result) {
341
+ if ((result.sign == 0) && (value != "")) {
342
+ checkResult = "该学号已存在";
343
+ }
344
+ },
345
+ error: function () {
346
+ }
347
+ });
348
+ if (checkResult != '')
349
+ return checkResult;
350
+ }
351
+ , cardid: function (value, item) { //value:表单的值、item:表单的DOM对象
352
+ var checkResult = "";
353
+ $.ajax({
354
+ url: "/api/inputcheck1",
355
+ type: "POST",
356
+ data: {
357
+ n: 1,
358
+ idinput: value
359
+ },
360
+ async: false,
361
+ success: function (result) {
362
+ if (result.sign == 0) {
363
+ checkResult = "该卡号已存在";
364
+ }
365
+ }
366
+ });
367
+ if (checkResult != '')
368
+ return checkResult;
369
+ }
370
+ });
371
+ </script>
372
+
373
+ </body>
374
+
375
+ </html>