myapp_evenfuture 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. package/Dockerfile +7 -0
  2. package/app.js +58 -0
  3. package/bin/www +91 -0
  4. package/package.json +20 -0
  5. package/public/css/layui.css +1 -0
  6. package/public/css/lizhi.webp +0 -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 +505 -0
  23. package/routes/datatime.js +17 -0
  24. package/routes/db.js +158 -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 +28 -0
  30. package/routes/switch1.js +12 -0
  31. package/views/addstu.ejs +276 -0
  32. package/views/error.ejs +4 -0
  33. package/views/hisinfo.ejs +301 -0
  34. package/views/hisinfo1.ejs +301 -0
  35. package/views/login.ejs +203 -0
  36. package/views/modroom.ejs +405 -0
  37. package/views/modstu.ejs +327 -0
  38. package/views/rtinfo.ejs +234 -0
  39. package/views/rtinfo1.ejs +234 -0
@@ -0,0 +1,327 @@
1
+ <!DOCTYPE html>
2
+ <html>
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
+ </head>
12
+
13
+ <body>
14
+ <div class="layui-layout layui-layout-admin">
15
+ <div class="layui-header">
16
+ <div class="layui-logo layui-hide-xs " style="background-color:rgb(146, 151, 209);color: black">签到管理系统</div>
17
+
18
+ <ul class="layui-nav layui-layout-left" >
19
+ <li class="layui-nav-item">
20
+ <a href="addstu">新增学生信息</a>
21
+ <!-- 可以继续添加更多的导航项 -->
22
+ </ul>
23
+
24
+ <ul class="layui-nav layui-layout-right">
25
+ <li class="layui-nav-item layui-hide layui-show-sm-inline-block">
26
+ <a href="javascript:;">
27
+ <img src="/css/lizhi.webp" class="layui-nav-img">
28
+ <!-- tester -->
29
+ </a>
30
+ <dl class="layui-nav-child">
31
+ <!-- <dd><a href="javascript:;">修改登录密码</a></dd>
32
+ <dd><a href="javascript:;">修改绑定手机</a></dd>
33
+ <dd><a href="javascript:;">登出</a></dd> -->
34
+ <dd><a href="/">退出登录</a></dd>
35
+ </dl>
36
+ </li>
37
+ <li class="layui-nav-item" lay-header-event="menuRight" lay-unselect>
38
+ <a href="javascript:;">
39
+ <i class="layui-icon layui-icon-more-vertical"></i>
40
+ </a>
41
+ </li>
42
+ </ul>
43
+ </div>
44
+
45
+ <div class="layui-side "style="background-color: rgb(146, 151, 209)">
46
+ <div class="layui-side-scroll">
47
+ <!-- 左侧导航区域(可配合layui已有的垂直导航) -->
48
+
49
+ <ul class="layui-nav layui-nav-tree" lay-filter="test" style="background-color:rgb(146, 151, 209) ">
50
+ <!-- Swipe -->
51
+ <li class="layui-nav-item"><a href="/switch" style="color:rgb(0, 0, 0)">实时签到信息</a></li>
52
+ <!-- 实时签到信息只统计当天的 -->
53
+ <li class="layui-nav-item "><a href="hisinfo" style="color:rgb(0, 0, 0)">历史签到信息</a></li>
54
+
55
+ <li class="layui-nav-item layui-this" ><a href="modstu" style="color:rgb(0, 0, 0)">用户管理</a></li>
56
+ <li class="layui-nav-item " ><a href="modroom" style = "color: black;">房间管理</a></li>
57
+ </ul>
58
+ </div>
59
+ </div>
60
+
61
+ <div class="layui-body" style="height: 100%">
62
+ <form class="layui-form" action="" id="idsearch_form" name="idsearch_form">
63
+ <label class="layui-form-label" style="margin-top: 25px;">按学号查找</label>
64
+ <div class="layui-input-inline" style="width: 400px; margin-top: 25px;">
65
+ <input type="text" class="layui-input" id="idinput" name="idinput">
66
+ </div>
67
+ <div class="layui-inline">
68
+ <button class="layui-btn" lay-submit lay-filter="idsearch" style="background-color:rgb(100, 109, 214);margin-top: 25px;">
69
+ <i class="layui-icon layui-icon-search" style="font-size: 15px; color: #ffffff;"></i>
70
+ 搜索
71
+ </button>
72
+ <button class="layui-btn" lay-submit lay-filter="allidsearch" style="background-color:rgb(100, 109, 214);margin-top: 25px;">
73
+ 显示全部
74
+ </button>
75
+ </div>
76
+ <table class="layui-table" id="numbers" lay-filter="demot2">
77
+ </table>
78
+ </form>
79
+ </div>
80
+
81
+ <div class="layui-footer">
82
+ 学习是一种信仰。
83
+ </div>
84
+ </div>
85
+
86
+ <div id='barDemo' style='display:none'>
87
+ <a class="layui-btn layui-btn-xs" id="mod_btn" lay-event="fix"style="background-color:rgb(100, 109, 214);">修改</a>
88
+ <a class="layui-btn layui-btn-danger layui-btn-xs" id="delete_btn" name="delete_btn" lay-event="del"
89
+ style="display:inline-block;">删除</a>
90
+ </div>
91
+ <div id='barDemo1' style='display:none'>
92
+ <a class="layui-btn layui-btn-xs" lay-event="passwordchange">编辑</a>
93
+ </div>
94
+
95
+ <script src="/layui.js"></script>
96
+ <script src="https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.js"></script>
97
+
98
+ <script>
99
+ //JS
100
+ layui.use(['element', 'layer', 'util', 'table', 'laydate', 'form'], function () {
101
+ var element = layui.element;
102
+ var layer = layui.layer;
103
+ var util = layui.util;
104
+ var table = layui.table;
105
+ var laydate = layui.laydate;
106
+ var $ = layui.$;
107
+ var form = layui.form;
108
+
109
+ $(function () {
110
+ $('#idinput').val(sessionStorage.getItem("stuidsearch"));
111
+ if ((sessionStorage.getItem("username") == null) || (sessionStorage.getItem("username") == "")) {
112
+ $("#delete_btn").hide();
113
+ $("#mod_btn").hide();
114
+ sessionStorage.setItem("editaccess", false);
115
+ }
116
+ else {
117
+ $("#delete_btn").show();
118
+ $("#mod_btn").show();
119
+ sessionStorage.setItem("editaccess", true);
120
+ }
121
+ });
122
+
123
+ table.render({
124
+ elem: '#numbers',
125
+ url: '/api/list',
126
+ id: 'def',
127
+ toolbar: true,
128
+ title: '个人信息',
129
+ totalRow: true,
130
+ page: true,
131
+ limit: 10,
132
+ limits: [5, 10, 20, 30],
133
+ parseData: function (res) {
134
+ console.log(res);
135
+ var current_pages;
136
+ if (this.page === true) current_pages = 1;
137
+ else current_pages = this.page.curr;
138
+ var data = res.data.slice(this.limit * (current_pages - 1), this.limit * current_pages);
139
+ return {
140
+ "code": res.code,
141
+ "msg": res.msg,
142
+ "count": res.data.length,
143
+ "data": data
144
+ }
145
+ },
146
+ cols: [
147
+ [{
148
+ field: 'stuid',
149
+ title: '学号',
150
+ width: 150,
151
+ sort: true
152
+ }, {
153
+ field: 'name',
154
+ title: '姓名',
155
+ width: 150,
156
+ edit: sessionStorage.getItem("editaccess")
157
+ }, {
158
+ field: 'cardid',
159
+ title: '卡号',
160
+ width: 300,
161
+ edit: sessionStorage.getItem("editaccess"),
162
+ sort: true
163
+ }, {
164
+ field: 'type',
165
+ title: '类型',
166
+ width: 150,
167
+ edit: sessionStorage.getItem("editaccess"),
168
+ sort: true
169
+ }, {
170
+ title: '操作',
171
+ toolbar: '#barDemo',
172
+ fixed: 'right'
173
+ }]
174
+ ]
175
+ });
176
+
177
+ table.on('edit(demot2)', function (obj) {
178
+ console.log(obj.data);
179
+ $.ajax({
180
+ url: '/db/update_users',
181
+ method: 'post',
182
+ data: obj.data,
183
+ success: function (data) {
184
+ if (data.status == 'ok') {
185
+ layer.msg('更新成功!');
186
+ setTimeout(function () {
187
+ top.location.reload();
188
+ }, 1500);
189
+ } else if (data.status == 'error') {
190
+ layer.msg('更新失败! 原因是:' + data.err);
191
+ setTimeout(function () {
192
+ top.location.reload();
193
+ }, 1500);
194
+ }
195
+ }
196
+ });
197
+ return false;
198
+ });
199
+
200
+ table.on('tool(demot2)', function (obj) {
201
+ var data = obj.data; //当前行的数据
202
+ var layEvent = obj.event; //当前行的具体的哪个event
203
+
204
+ if (layEvent === 'fix') {
205
+ layer.msg("请在对应表格中直接修改即可!");
206
+ }
207
+ else if (layEvent === 'del') {
208
+ layer.confirm('真的要删除吗?', function (index) {
209
+ obj.del();
210
+ layer.close(index);
211
+ $.ajax({
212
+ url: '/db/delete_users',
213
+ method: 'post',
214
+ data: {
215
+ id: data.id,
216
+ stuid: data.stuid
217
+ },
218
+ success: function (data) {
219
+ table.reload('def');
220
+ layer.msg('删除成功!');
221
+ }
222
+ });
223
+ })
224
+ }
225
+ });
226
+
227
+
228
+ //头部事件
229
+ util.event('lay-header-event', {
230
+ menuLeft: function (othis) { // 左侧菜单事件
231
+ layer.msg('展开左侧菜单的操作', { icon: 0 });
232
+ },
233
+ menuRight: function () { // 右侧菜单事件
234
+ layer.open({
235
+ type: 1,
236
+ title: '作者',
237
+ content: '<div style="padding: 15px;">信息工程学院<br/>祝乙文,姜莱</div>',
238
+ area: ['150px', '100%'],
239
+ offset: 'rt', // 右上角
240
+ anim: 'slideLeft', // 从右侧抽屉滑出
241
+ shadeClose: true,
242
+ scrollbar: false
243
+ });
244
+ }
245
+ });
246
+
247
+ form.on('submit(idsearch)', function (data) {
248
+ sessionStorage.setItem("stuidsearch", data.field.idinput);
249
+ $.ajax({
250
+ type: 'post',
251
+ url: '/api/idsearch',
252
+ data: {
253
+ sign: 1,
254
+ id: data.field.idinput
255
+ },
256
+ success: function (data) {
257
+ top.location.href = '';
258
+ top.location.reload();
259
+ }
260
+ });
261
+ return false;
262
+ });
263
+
264
+ form.on('submit(allidsearch)', function (data) {
265
+ sessionStorage.setItem("stuidsearch", '');
266
+ $.ajax({
267
+ type: 'post',
268
+ url: '/api/idsearch',
269
+ data: {
270
+ sign: 0
271
+ },
272
+ success: function (data) {
273
+ top.location.href = '';
274
+ top.location.reload();
275
+ }
276
+ });
277
+ return false;
278
+ });
279
+ });
280
+
281
+ form.verify({
282
+ stuid: function (value, item) { //value:表单的值、item:表单的DOM对象
283
+ var checkResult = "";
284
+ $.ajax({
285
+ url: "/api/inputcheck0",
286
+ type: "POST",
287
+ data: {
288
+ n: 0,
289
+ idinput: value
290
+ },
291
+ async: false,
292
+ success: function (result) {
293
+ if ((result.sign == 0) && (value != "")) {
294
+ checkResult = "该学号已存在";
295
+ }
296
+ },
297
+ error: function () {
298
+ }
299
+ });
300
+ if (checkResult != '')
301
+ return checkResult;
302
+ }
303
+ , cardid: function (value, item) { //value:表单的值、item:表单的DOM对象
304
+ var checkResult = "";
305
+ $.ajax({
306
+ url: "/api/inputcheck1",
307
+ type: "POST",
308
+ data: {
309
+ n: 1,
310
+ idinput: value
311
+ },
312
+ async: false,
313
+ success: function (result) {
314
+ if (result.sign == 0) {
315
+ checkResult = "该卡号已存在";
316
+ }
317
+ }
318
+ });
319
+ if (checkResult != '')
320
+ return checkResult;
321
+ }
322
+ });
323
+ </script>
324
+
325
+ </body>
326
+
327
+ </html>
@@ -0,0 +1,234 @@
1
+ <!DOCTYPE html>
2
+ <html>
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
+ </head>
12
+
13
+ <body>
14
+ <div class="layui-layout layui-layout-admin">
15
+ <div class="layui-header">
16
+ <div class="layui-logo layui-hide-xs " style="background-color:rgb(146, 151, 209);color:black ">签到管理系统</div>
17
+
18
+ <ul class="layui-nav layui-layout-right">
19
+ <li class="layui-nav-item layui-hide layui-show-sm-inline-block">
20
+ <a href="javascript:;">
21
+ <img src="/css/lizhi.webp" class="layui-nav-img">
22
+ <!-- tester -->
23
+ </a>
24
+ <dl class="layui-nav-child">
25
+ <dd><a href="/">退出登录</a></dd>
26
+ </dl>
27
+ </li>
28
+ <li class="layui-nav-item" lay-header-event="menuRight" lay-unselect>
29
+ <a href="javascript:;">
30
+ <i class="layui-icon layui-icon-more-vertical"></i>
31
+ </a>
32
+ </li>
33
+ </ul>
34
+ </div>
35
+
36
+ <div class="layui-side " style="background-color:rgb(146, 151, 209) ">
37
+ <div class="layui-side-scroll">
38
+ <!-- 左侧导航区域(可配合layui已有的垂直导航) -->
39
+
40
+ <ul class="layui-nav layui-nav-tree" lay-filter="test" style="background-color:rgb(146, 151, 209) ">
41
+ <!-- Swipe -->
42
+ <li class="layui-nav-item "><a href="/switch" style="color:rgb(0, 0, 0)">实时签到信息</a></li>
43
+ <!-- 实时签到信息只统计当天的 -->
44
+ <li class="layui-nav-item"><a href="switch/hisinfo" style="color:rgb(0, 0, 0)">历史签到信息</a></li>
45
+
46
+ <li class="layui-nav-item "><a href="switch/modstu" style="color:rgb(0, 0, 0)">用户管理</a></li>
47
+ <li class="layui-nav-item " ><a href="switch/modroom" style = "color: black;">房间管理</a></li>
48
+ </ul>
49
+
50
+ </div>
51
+ </div>
52
+
53
+ <div class="layui-body" style="height: 100%">
54
+ <form class="layui-form" action="" id="timesearch_form" name="timesearch_form">
55
+ <div class="layui-form-item">
56
+ <div class="layui-inline" style="margin-top: 25px;">
57
+ <label class="layui-form-label" style="white-space: nowrap">签到截止时间</label>
58
+ <div class="layui-input-inline" style="width: 300px;">
59
+ <input type="text" class="layui-input" id="qdtime">
60
+ </div>
61
+ </div>
62
+ </div>
63
+
64
+ <table class="layui-table" id="record" lay-filter="demot1">
65
+ </table>
66
+ </form>
67
+ </div>
68
+
69
+ <div class="layui-footer">
70
+ 学习是一种信仰。
71
+ </div>
72
+ </div>
73
+
74
+ <script src="/layui.js"></script>
75
+ <script src="https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.js"></script>
76
+
77
+ <script>
78
+ //JS
79
+ layui.use(['element', 'layer', 'util', 'table', 'laydate'], function () {
80
+ var element = layui.element;
81
+ var layer = layui.layer;
82
+ var util = layui.util;
83
+ var table = layui.table;
84
+ var laydate = layui.laydate;
85
+ var $ = layui.$;
86
+
87
+ $(function () {
88
+ if ((sessionStorage.getItem("qdtime") == null)){
89
+ $("#record").hide();
90
+ }
91
+ else{
92
+ $("#record").show();
93
+ }
94
+ $('#qdtime').val(sessionStorage.getItem("qdtime"));
95
+ });
96
+
97
+ laydate.render({
98
+ elem: '#qdtime'
99
+ , type: 'time'
100
+ , done: function (value, date) {
101
+ sessionStorage.setItem("qdtime", value);
102
+ $.ajaxSetup({
103
+ data: {
104
+ sign: 0
105
+ }
106
+ });
107
+ $.ajax({
108
+ type: 'post',
109
+ url: '/api/timesearchrt',
110
+ data: {
111
+ time_h: ("0" + date.hours).slice(-2),
112
+ time_m: ("0" + date.minutes).slice(-2),
113
+ time_s: ("0" + date.seconds).slice(-2),
114
+ et: ("0" + date.hours).slice(-2) + ':' + ("0" + date.minutes).slice(-2) + ':' + ("0" + date.seconds).slice(-2),
115
+ sign: 2
116
+ },
117
+ success: function (data) {
118
+ layer.msg('签到截止时间 ' + sessionStorage.getItem("qdtime") + ' 设置成功!');
119
+ top.location.href = '/';
120
+ top.location.reload();
121
+ }
122
+ });
123
+ }
124
+ });
125
+
126
+ //头部事件
127
+ util.event('lay-header-event', {
128
+ menuLeft: function (othis) { // 左侧菜单事件
129
+ layer.msg('展开左侧菜单的操作', { icon: 0 });
130
+ },
131
+ menuRight: function () { // 右侧菜单事件
132
+ layer.open({
133
+ type: 1,
134
+ title: '作者',
135
+ content: '<div style="padding: 15px;">信息工程学院<br/>祝乙文,姜莱</div>',
136
+ area: ['150px', '100%'],
137
+ offset: 'rt', // 右上角
138
+ anim: 'slideLeft', // 从右侧抽屉滑出
139
+ shadeClose: true,
140
+ scrollbar: false
141
+ });
142
+ }
143
+ });
144
+
145
+ table.render({
146
+ elem: '#record',
147
+ url: '/api/recordlistrt',
148
+ toolbar: true,
149
+ title: '签到记录',
150
+ totalRow: true,
151
+ page: true,
152
+ id: 'abc',
153
+ limit: 10,
154
+ limits: [5, 10, 20, 30],
155
+ initSort: {
156
+ field: 'time',
157
+ type: 'desc'
158
+ },
159
+ parseData: function (res) { //res 即为原始返回的数据
160
+ var current_pages;
161
+ if (this.page === true) current_pages = 1;
162
+ else current_pages = this.page.curr;
163
+ var data = res.data.slice(this.limit * (current_pages - 1), this.limit * current_pages);
164
+ return {
165
+ "code": res.code,
166
+ "msg": res.msg,
167
+ "count": res.data.length,
168
+ "data": data
169
+ }
170
+ },
171
+ sort: true,
172
+ cols: [
173
+ [{
174
+ field: 'stuid',
175
+ title: '学号',
176
+ width: 200,
177
+ sort: true
178
+ }, {
179
+ field: 'name',
180
+ title: '姓名',
181
+ width: 200
182
+ }, {
183
+ field: 'type',
184
+ title: '类型',
185
+ width: 200,
186
+ sort: true
187
+ }, {
188
+ field: 'room',
189
+ title: '教室',
190
+ width: 200
191
+ }, {
192
+ field: 'time',
193
+ title: '签到时间',
194
+ sort: true,
195
+ }]
196
+ ]
197
+ });
198
+
199
+ setInterval(function myrefresh() {
200
+ $.ajax({
201
+ url: '/api/check',
202
+ method: 'get',
203
+ data: {},
204
+ success: function (data) {
205
+ if (data.flag1 == 0) {
206
+ sessionStorage.setItem("qdtime", "");
207
+ sessionStorage.setItem("timerange", "");
208
+ sessionStorage.setItem("username", "");
209
+ }
210
+ if (data.flag == 1) {
211
+ // table.reload('/');
212
+ top.location.href = '/';
213
+ top.location.reload();
214
+ layer.msg(data.id + ' 签到成功!');
215
+ }
216
+ else if (data.flag == 2) {
217
+ // table.reload('/');
218
+ top.location.href = '/';
219
+ top.location.reload();
220
+ layer.msg(data.id + ' 重复刷卡!');
221
+ }
222
+ },
223
+ error: function (data) {
224
+ alert("调用失败!");
225
+ }
226
+ });
227
+ }, 1000);
228
+
229
+ });
230
+ </script>
231
+
232
+ </body>
233
+
234
+ </html>