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,291 @@
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-right">
52
+ <li class="layui-nav-item layui-hide layui-show-sm-inline-block">
53
+ <a href="javascript:;">
54
+ <img src="https://pic.rmb.bdstatic.com/bjh/gallery/7673bb43bb01190ce0886b7b5dfbfc6a9451.jpeg" class="layui-nav-img">
55
+ <!-- tester -->
56
+ </a>
57
+ <dl class="layui-nav-child">
58
+ <!-- <dd><a href="javascript:;">修改登录密码</a></dd>
59
+ <dd><a href="javascript:;">修改绑定手机</a></dd> -->
60
+ <dd><a href="/">登出</a></dd>
61
+ </dl>
62
+ </li>
63
+ <li class="layui-nav-item" lay-header-event="menuRight" lay-unselect>
64
+ <a href="javascript:;">
65
+ <i class="layui-icon layui-icon-more-vertical"></i>
66
+ </a>
67
+ </li>
68
+ </ul>
69
+ </div>
70
+ </div>
71
+
72
+ <!-- 左侧导航栏 -->
73
+ <div class="layui-side layui-bg-black">
74
+ <ul class="layui-nav layui-nav-tree" lay-filter="test">
75
+ <li class="layui-nav-item">
76
+ <a href="/switch1"><i class="layui-icon layui-icon-ok"></i> 实时签到信息</a>
77
+ </li>
78
+ <li class="layui-nav-item layui-this">
79
+ <a href="switch1/hisinfo"><i class="layui-icon layui-icon-chart"></i> 历史签到信息</a>
80
+ </li>
81
+ </ul>
82
+ </div>
83
+
84
+ <div class="layui-body" style="height: 100%">
85
+ <div class="layui-form-item">
86
+ <div class="layui-inline">
87
+ <label class="layui-form-label" style="white-space: nowrap; margin-top: 25px;">日期时间范围</label>
88
+ <div class="layui-input-inline" style="width: 300px; margin-top: 25px;">
89
+ <input type="text" class="layui-input" id="timerange" placeholder=" - ">
90
+ </div>
91
+ </div>
92
+ <div class="layui-inline" style="float: right; margin-top: 25px;">
93
+ <button id="chartshow" class="layui-btn" type="button"
94
+ lay-filter="chartshow">迟到情况统计
95
+ </button>
96
+ </div>
97
+ </div>
98
+
99
+ <table class="layui-table" id="record" lay-filter="demot1">
100
+ </table>
101
+ </div>
102
+
103
+ <div class="layui-footer">
104
+ 不积跬步,无以至千里。
105
+ </div>
106
+ </div>
107
+
108
+ <div class="layui-row layui-col-md3" style="width:550px;margin:auto;display:none;" id="chart">
109
+ <canvas id="myChart"></canvas>
110
+ <table lay-even lay-skin="nob" style="float: right">
111
+ <tbody>
112
+ <tr>
113
+ <td>正常:</td>
114
+ <td><label name="normalper" id="normalper" style="float: right"></label></td>
115
+ </tr>
116
+ <tr>
117
+ <td>迟到:</td>
118
+ <td><label name="lateper" id="lateper" style="float: right"></label></td>
119
+ </tr>
120
+ </tbody>
121
+ </table>
122
+ </div>
123
+
124
+ <script src="/layui.js"></script>
125
+ <script src="https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.js"></script>
126
+ <script src="https://cdn.bootcss.com/Chart.js/2.7.3/Chart.js"></script>
127
+
128
+ <script>
129
+ //JS
130
+ layui.use(['element', 'layer', 'util', 'table', 'laydate'], function () {
131
+ var element = layui.element;
132
+ var layer = layui.layer;
133
+ var util = layui.util;
134
+ var table = layui.table;
135
+ var laydate = layui.laydate;
136
+ var $ = layui.$;
137
+ var returnMessage;
138
+ // var $ = layui.jquery;
139
+ var ctx = document.getElementById('myChart').getContext('2d');
140
+
141
+ $(function () {
142
+ $('#timerange').val(sessionStorage.getItem("timerange"));
143
+ });
144
+
145
+ laydate.render({
146
+ elem: '#timerange'
147
+ , type: 'datetime'
148
+ , range: true
149
+ , done: function (value, date, endDate) {
150
+ sessionStorage.setItem("timerange", value);
151
+ value = value.split(" - ");
152
+ $.ajax({
153
+ type: 'post',
154
+ url: '/api/timesearch',
155
+ data: {
156
+ bt: value[0],
157
+ et: value[1],
158
+ sign: 1
159
+ },
160
+ success: function (data) {
161
+ top.location.href = '';
162
+ top.location.reload();
163
+ }
164
+ });
165
+ }
166
+ });
167
+
168
+ $(document).on('click', '#chartshow', function () {
169
+ var myChart = new Chart(ctx, {
170
+ type: 'pie',
171
+ data: {
172
+ labels: ['正常', '迟到'],
173
+ datasets: [{
174
+ label: '示例',
175
+ data: [sessionStorage.getItem("normal"), sessionStorage.getItem("late")],
176
+ backgroundColor: ['#58D3F7', '#FA8258'],
177
+ borderWidth: 1
178
+ }]
179
+ }
180
+ })
181
+ $('#normalper').html(((parseInt(sessionStorage.getItem("normal")) / (parseInt(sessionStorage.getItem("normal")) + parseInt(sessionStorage.getItem("late")))) * 100).toFixed(2) + '%');
182
+ $('#lateper').html(((parseInt(sessionStorage.getItem("late")) / (parseInt(sessionStorage.getItem("normal")) + parseInt(sessionStorage.getItem("late")))) * 100).toFixed(2) + '%');
183
+ layer.open({
184
+ type: 1,
185
+ id: 5,
186
+ title: "迟到情况统计",
187
+ area: ['35%', '50%'],
188
+ content: $("#chart"),
189
+ });
190
+ });
191
+
192
+ //头部事件
193
+ util.event('lay-header-event', {
194
+ menuLeft: function (othis) { // 左侧菜单事件
195
+ layer.msg('展开左侧菜单的操作', { icon: 0 });
196
+ },
197
+ menuRight: function () { // 右侧菜单事件
198
+ layer.open({
199
+ type: 1,
200
+ title: '作者',
201
+ content: '<div style="padding: 15px;">信息工程学院<br/>王璐、孙佳雨</div>',
202
+ area: ['150px', '100%'],
203
+ offset: 'rt', // 右上角
204
+ anim: 'slideLeft', // 从右侧抽屉滑出
205
+ shadeClose: true,
206
+ scrollbar: false
207
+ });
208
+ }
209
+ });
210
+
211
+ table.render({
212
+ elem: '#record',
213
+ url: '/api/recordlist',
214
+ toolbar: true,
215
+ title: '签到记录',
216
+ totalRow: true,
217
+ page: true,
218
+ id: 'abc',
219
+ limit: 10,
220
+ limits: [5, 10, 20, 30],
221
+ initSort: {
222
+ field: 'time',
223
+ type: 'desc'
224
+ },
225
+ parseData: function (res) { //res 即为原始返回的数据
226
+ var current_pages;
227
+ if (this.page === true) current_pages = 1;
228
+ else current_pages = this.page.curr;
229
+ var data = res.data.slice(this.limit * (current_pages - 1), this.limit * current_pages);
230
+ return {
231
+ "code": res.code,
232
+ "msg": res.msg,
233
+ "count": res.data.length,
234
+ "data": data
235
+ }
236
+ },
237
+ sort: true,
238
+ cols: [
239
+ [{
240
+ field: 'stuid',
241
+ title: '学号',
242
+ width: 130,
243
+ sort: true
244
+ }, {
245
+ field: 'name',
246
+ title: '姓名',
247
+ width: 130
248
+ }, {
249
+ field: 'type',
250
+ title: '类型',
251
+ width: 130,
252
+ sort: true
253
+ }, {
254
+ field: 'room',
255
+ title: '教室',
256
+ width: 130
257
+ }, {
258
+ field: 'time',
259
+ title: '签到时间',
260
+ sort: true
261
+ }, {
262
+ field: 'qd',
263
+ title: '签到情况',
264
+ sort: true
265
+ }]
266
+ ],
267
+ done: function (res, curr, count) {
268
+ $.ajax({
269
+ type: 'get',
270
+ url: '/api/chartcheck',
271
+ success: function (data) {
272
+ sessionStorage.setItem("late", data.la);
273
+ sessionStorage.setItem("normal", data.no);
274
+ }
275
+ });
276
+ $.each(res.data, function (index, item) {
277
+ if (item.qd == '迟到') {
278
+ $("#record").next().find('tbody tr[data-index="' + index +
279
+ '"]').css("background-color", "#FFA07A");
280
+ }
281
+ });
282
+ }
283
+ });
284
+
285
+
286
+ });
287
+ </script>
288
+
289
+ </body>
290
+
291
+ </html>
@@ -0,0 +1,227 @@
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, maximum-scale=1">
10
+ <link rel="stylesheet" href="/css/layui.css" media="all">
11
+ </head>
12
+
13
+ <body
14
+ style="background-image: url('https://p2.ssl.qhimgs1.com/t017677196113fc982c.jpg'); background-size: cover; background-repeat: no-repeat; background-position: center; background-attachment: fixed;">
15
+ <div style="height: 1024px; width: 1024px; margin-top: 240px; margin-left: auto;">
16
+ <div>
17
+ <h1>首都师范大学刷卡签到系统欢迎您!</h1>
18
+ </div>
19
+ <br />
20
+ <div>
21
+ <form class="layui-form" style="margin-top: 40px;" action="/user/logincheck">
22
+ <div class="layui-form-item">
23
+ <div class="layui-inline">
24
+ <label class="layui-form-label" style="width: 100px">用户名:</label>
25
+ <div class="layui-input-inline">
26
+ <input type="text" name="usernameinput" id="usernameinput" required value=""
27
+ style="width: 240px;" lay-verify="required" placeholder="请输入用户名" autocomplete="off"
28
+ class="layui-input">
29
+ </div>
30
+ </div>
31
+ </div>
32
+
33
+ <div class="layui-form-item">
34
+ <div class="layui-inline">
35
+ <label class="layui-form-label" style="width:100px">密 码:</label>
36
+ <div class="layui-input-inline">
37
+ <input type="password" name="passwordinput" id="passwordinput" required value=""
38
+ style="width: 240px" lay-verify="required" placeholder="请输入密码" autocomplete="off"
39
+ class="layui-input">
40
+ </div>
41
+ </div>
42
+ </div>
43
+
44
+ <!-- 新增用户类型选择 -->
45
+ <div class="layui-form-item">
46
+ <div class="layui-inline">
47
+ <label class="layui-form-label" style="width:100px">用户类型:</label>
48
+ <div class="layui-input-inline">
49
+ <select name="usertype" id="usertype" lay-filter="usertype">
50
+ <option value="0">管理员</option>
51
+ <option value="1">普通用户</option>
52
+ </select>
53
+ </div>
54
+ </div>
55
+ </div>
56
+
57
+ <div class="layui-form-item">
58
+ <div class="layui-input-block">
59
+ <button class="layui-btn" id="formDemo4" name="formDemo4" lay-submit
60
+ lay-filter="formDemo4">登录</button>
61
+ <button class="layui-btn layui-btn-primary" type="reset" id="reset"
62
+ style="background-color: #69f009; color: white;">重置</button>
63
+ <!-- <button class="layui-btn" id="registerBtn">注册</button> -->
64
+ </div>
65
+ </div>
66
+ </form>
67
+ <div style="text-align: left; margin-top: 20px;">
68
+ <button class="layui-btn" id="registerBtn" style="width: 150px; margin-left: 110px;">新用户注册</button>
69
+ </div>
70
+ </div>
71
+ </div>
72
+
73
+ <!-- 注册窗口 -->
74
+ <div id="registerWindow"
75
+ style="display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background-color: white; padding: 20px; border-radius: 5px; box-shadow: 0 0 10px rgba(0,0,0,0.5);">
76
+ <h3>注册</h3>
77
+ <button class="layui-btn layui-btn-primary" style="float: right;" id="closeRegisterBtn">关闭</button>
78
+ <form class="layui-form" id="registerForm">
79
+ <div class="layui-form-item">
80
+ <label class="layui-form-label">用户名:</label>
81
+ <div class="layui-input-block">
82
+ <input type="text" name="username" required lay-verify="required" placeholder="请输入用户名"
83
+ autocomplete="off" class="layui-input">
84
+ </div>
85
+ </div>
86
+ <div class="layui-form-item">
87
+ <label class="layui-form-label">密码:</label>
88
+ <div class="layui-input-block">
89
+ <input type="password" name="password" required lay-verify="required" placeholder="请输入密码"
90
+ autocomplete="off" class="layui-input">
91
+ </div>
92
+ </div>
93
+ <div class="layui-form-item">
94
+ <label class="layui-form-label">确认密码:</label>
95
+ <div class="layui-input-block">
96
+ <input type="password" name="confirmPassword" required lay-verify="required" placeholder="请确认密码"
97
+ autocomplete="off" class="layui-input">
98
+ </div>
99
+ </div>
100
+ <div class="layui-form-item">
101
+ <label class="layui-form-label">用户类型:</label>
102
+ <div class="layui-input-block">
103
+ <select name="usertype" lay-filter="usertype">
104
+ <option value="0">管理员</option>
105
+ <option value="1">普通用户</option>
106
+ </select>
107
+ </div>
108
+ </div>
109
+ <div class="layui-form-item">
110
+ <div class="layui-input-block">
111
+ <button class="layui-btn" lay-submit lay-filter="registerForm">注册</button>
112
+ </div>
113
+ </div>
114
+ </form>
115
+ </div>
116
+
117
+ <script src="/layui.js"></script>
118
+ <script>
119
+ layui.use(['form', 'layer', 'element', 'table', 'laypage', 'jquery'], function () {
120
+ var layer = layui.layer,
121
+ form = layui.form,
122
+ element = layui.element,
123
+ table = layui.table,
124
+ laypage = layui.laypage,
125
+ $ = layui.jquery;
126
+
127
+ // 监听注册按钮
128
+ $('#registerBtn').on('click', function () {
129
+ $('#registerWindow').show();
130
+ });
131
+
132
+ // 监听关闭按钮
133
+ $('#closeRegisterBtn').on('click', function () {
134
+ $('#registerWindow').hide();
135
+ });
136
+
137
+ // 登录逻辑
138
+ form.on('submit(formDemo4)', function (data) {
139
+ $.ajax({
140
+ type: 'post',
141
+ url: '/api/login',
142
+ data: data.field,
143
+ success: function (result) {
144
+ if (result.sign == 0) {
145
+ sessionStorage.setItem("username", data.field.usernameinput);
146
+ $('#username').html("您好,超级管理员 " + data.field.usernameinput + " !");
147
+ top.location.href = '/switch';
148
+ // top.location.reload();
149
+ }
150
+ else if (result.sign == 1) {
151
+ layer.msg('密码错误!');
152
+ }
153
+ else if (result.sign == 2) {
154
+ layer.msg('用户名错误!');
155
+ }
156
+ else if (result.sign == 3) {
157
+ layer.msg('普通用户登录!');
158
+ sessionStorage.setItem("username", '');
159
+ $('#username').html("您好,普通用户" + data.field.usernameinput + " !");
160
+ top.location.href = '/switch1';
161
+ }
162
+ }
163
+ });
164
+ return false; // 阻止表单默认提交行为
165
+ });
166
+
167
+ // 注册逻辑
168
+ $('#registerBtn').on('click', function () {
169
+ $('#registerWindow').show();
170
+ });
171
+
172
+ form.on('submit(registerForm)', function (data) {
173
+ var username = data.field.username;
174
+ var password = data.field.password;
175
+ var confirmPassword = data.field.confirmPassword;
176
+ var usertype = data.field.usertype;
177
+
178
+ if (password !== confirmPassword) {
179
+ layer.msg('密码和确认密码不一致!');
180
+ return false;
181
+ }
182
+
183
+ $.ajax({
184
+ type: 'post',
185
+ url: '/api/inputcheck4',
186
+ data: { usernameinput: username },
187
+ success: function (result) {
188
+ if (result.sign === 0) {
189
+ layer.msg('用户名已存在!');
190
+ return false;
191
+ }
192
+
193
+ $.ajax({
194
+ type: 'post',
195
+ url: '/api/register',
196
+ data: { username: username, password: password, type: usertype },
197
+ success: function (result) {
198
+ if (result.status === 'success') {
199
+ layer.msg('注册成功!');
200
+ $('#registerWindow').hide();
201
+ } else {
202
+ layer.msg('注册失败:' + result.message);
203
+ }
204
+ },
205
+ error: function () {
206
+ layer.msg('注册失败!');
207
+ }
208
+ });
209
+ },
210
+ error: function () {
211
+ layer.msg('检查用户名时发生错误!');
212
+ }
213
+ });
214
+
215
+ return false;
216
+ });
217
+
218
+ // 监听用户类型选择
219
+ form.on('select(usertype)', function (data) {
220
+ console.log(data.value); // 当前选中的值
221
+ });
222
+ });
223
+
224
+ </script>
225
+ </body>
226
+
227
+ </html>