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,28 @@
1
+ var express = require('express');
2
+ var router = express.Router();
3
+ var EventEmitter = require('events').EventEmitter;
4
+ var event = new EventEmitter();
5
+
6
+ /* GET home page. */
7
+ router.get('/', function(req, res, next) {
8
+ res.render('login');
9
+ });
10
+
11
+ router.post('/', function(req, res, next) {
12
+ // let data = '';
13
+ // req.on('data', chunk => {
14
+ // data += chunk;
15
+ // console.log(data);
16
+ // });
17
+
18
+ // req.on('end', () => {
19
+ // const jsonData = JSON.parse(data);
20
+
21
+ // var mac = jsonData.mac;
22
+ // var uid = jsonData.uid;
23
+
24
+ // event.emit('MyJsonData', mac, uid);
25
+ // });
26
+ });
27
+
28
+ module.exports = router;
@@ -0,0 +1,25 @@
1
+ var express = require('express');
2
+ var router = express.Router();
3
+ var mysql = require('mysql');
4
+
5
+ /* GET home page. */
6
+ router.get('/', function (req, res, next) {
7
+ res.render('index', { title: 'Express' });
8
+ });
9
+
10
+ const connection = mysql.createConnection({
11
+ host: 'localhost',
12
+ user: 'root',
13
+ password: '123', /* 123456 */
14
+ database: 'example'
15
+ });
16
+
17
+ connection.connect(function (err) {
18
+ if (err) {
19
+ console.error('连接错误: ' + err.stack);
20
+ return;
21
+ }
22
+ console.log('连接ID:' + connection.threadId);
23
+ });
24
+
25
+ module.exports = connection;
@@ -0,0 +1,25 @@
1
+ var express = require('express');
2
+ var router = express.Router();
3
+ var mysql = require('mysql');
4
+
5
+ /* GET home page. */
6
+ router.get('/', function (req, res, next) {
7
+ res.render('index', { title: 'Express' });
8
+ });
9
+
10
+ const connection = mysql.createConnection({
11
+ host: 'localhost',
12
+ user: 'root',
13
+ password: '123456', /* 123456 */
14
+ database: 'example'
15
+ });
16
+
17
+ connection.connect(function (err) {
18
+ if (err) {
19
+ console.error('连接错误: ' + err.stack);
20
+ return;
21
+ }
22
+ console.log('连接ID:' + connection.threadId);
23
+ });
24
+
25
+ module.exports = connection;
package/routes/sql.js ADDED
@@ -0,0 +1,25 @@
1
+ var express = require('express');
2
+ var router = express.Router();
3
+ var mysql = require('mysql');
4
+
5
+ /* GET home page. */
6
+ router.get('/', function (req, res, next) {
7
+ res.render('index', { title: 'Express' });
8
+ });
9
+
10
+ const connection = mysql.createConnection({
11
+ host: 'localhost',
12
+ user: 'root',
13
+ password: '3628jljl',
14
+ database: 'example'
15
+ });
16
+
17
+ connection.connect(function (err) {
18
+ if (err) {
19
+ console.error('连接错误: ' + err.stack);
20
+ return;
21
+ }
22
+ console.log('连接ID:' + connection.threadId);
23
+ });
24
+
25
+ module.exports = connection;
@@ -0,0 +1,28 @@
1
+ var express = require('express');
2
+ var router = express.Router();
3
+
4
+ /* GET home page. */
5
+
6
+ router.get('/', function(req, res, next) {
7
+ res.render('rtinfo');
8
+ });
9
+
10
+ router.get('/hisinfo', function(req, res, next) {
11
+ res.render('hisinfo');
12
+ });
13
+
14
+ router.get('/modstu', function(req, res, next) {
15
+ res.render('modstu');
16
+ });
17
+
18
+ router.get('/addstu', function(req, res, next) {
19
+ res.render('addstu');
20
+ });
21
+
22
+ router.get('/modroom', function(req, res, next) {
23
+ res.render('modroom');
24
+ });
25
+
26
+
27
+
28
+ module.exports = router;
@@ -0,0 +1,12 @@
1
+ var express = require('express');
2
+ var router = express.Router();
3
+
4
+ router.get('/', function(req, res, next) {
5
+ res.render('rtinfo1');
6
+ });
7
+
8
+ router.get('/hisinfo1', function(req, res, next) {
9
+ res.render('hisinfo1');
10
+ });
11
+
12
+ module.exports = router;
@@ -0,0 +1,276 @@
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="javascript:;">提示</a>
21
+ <dl class="layui-nav-child">
22
+ <!-- 移动来的表单内容 -->
23
+ <div class="layui-form" style="width: 500px; padding: 10px;">
24
+ <div class="layui-form-item">
25
+ <label class="layui-form-label"
26
+ style="margin-top: center; color: black;text-align: center;">新增完信息后可再次点击“用户管理”查询所有用户信息</label>
27
+ </div>
28
+ </dl>
29
+ </li>
30
+ <!-- 可以继续添加更多的导航项 -->
31
+ </ul>
32
+
33
+ <ul class="layui-nav layui-layout-right">
34
+ <li class="layui-nav-item layui-hide layui-show-sm-inline-block">
35
+ <a href="javascript:;">
36
+ <img src="/css/lizhi.webp" class="layui-nav-img">
37
+ <!-- tester -->
38
+ </a>
39
+ <dl class="layui-nav-child">
40
+ <!-- <dd><a href="javascript:;">修改登录密码</a></dd>
41
+ <dd><a href="javascript:;">修改绑定手机</a></dd>
42
+ <dd><a href="javascript:;">登出</a></dd> -->
43
+ <dd><a href="/">退出登录</a></dd>
44
+ </dl>
45
+ </li>
46
+ <li class="layui-nav-item" lay-header-event="menuRight" lay-unselect>
47
+ <a href="javascript:;">
48
+ <i class="layui-icon layui-icon-more-vertical"></i>
49
+ </a>
50
+ </li>
51
+ </ul>
52
+ </div>
53
+
54
+ <div class="layui-side "style="background-color: rgb(146, 151, 209)" >
55
+ <div class="layui-side-scroll">
56
+ <!-- 左侧导航区域(可配合layui已有的垂直导航) -->
57
+
58
+ <ul class="layui-nav layui-nav-tree" lay-filter="test" style="background-color:rgb(146, 151, 209) ">
59
+ <!-- Swipe -->
60
+ <li class="layui-nav-item"><a href="/switch" style="color:rgb(0, 0, 0)">实时签到信息</a></li>
61
+ <!-- 实时签到信息只统计当天的 -->
62
+ <li class="layui-nav-item "><a href="hisinfo" style="color:rgb(0, 0, 0)">历史签到信息</a></li>
63
+
64
+ <li class="layui-nav-item layui-this"><a href="modstu" style="color:rgb(0, 0, 0)">用户管理</a></li>
65
+ <li class="layui-nav-item " ><a href="modroom" style = "color: black;">房间管理</a></li>
66
+ </ul>
67
+ </div>
68
+ </div>
69
+ <div class="layui-body" style="height: 100%">
70
+ <div class="layui-row" id="insert_stu">
71
+ <div class="layui-col-md11">
72
+ <form class="layui-form" id="insertstu" name="insertstu" action="">
73
+ <div class="layui-form-item layui-row" style="margin-top: 40px;">
74
+ <label class="layui-form-label">学号:</label>
75
+ <div class="layui-input-inline">
76
+ <input type="text" id="insertstuid" name="insertstuid" class="layui-input"
77
+ lay-verify="required|number|stuid" autocomplete="off" style="width: 350px">
78
+ </div>
79
+ </div>
80
+ <div class="layui-form-item layui-row">
81
+ <label class="layui-form-label">姓名:</label>
82
+ <div class="layui-input-inline">
83
+ <input type="text" id="insertname" name="insertname" class="layui-input" autocomplete="off" style="width: 350px">
84
+ </div>
85
+ </div>
86
+ <div class="layui-form-item layui-row">
87
+ <label class="layui-form-label">卡号:</label>
88
+ <div class="layui-input-inline">
89
+ <input type="text" id="insertcardid" name="insertcardid" class="layui-input"
90
+ lay-verify="number|cardid" autocomplete="off" style="width: 350px">
91
+ </div>
92
+ </div>
93
+ <div class="layui-form-item layui-row">
94
+ <label class="layui-form-label">类型:</label>
95
+ <div class="layui-input-block" style="width: 350px">
96
+ <select name="inserttype" lay-verify="required">
97
+ <option value=201>本科生</option>
98
+ <option value=204>教职工</option>
99
+ </select>
100
+ </div>
101
+ </div>
102
+ <div class="layui-form-item layui-row">
103
+ <div class="layui-input-block">
104
+ <button class="layui-btn" lay-submit lay-filter="formDemo1"style="background-color:rgb(100, 109, 214);">提交</button>
105
+ </div>
106
+ </div>
107
+ </form>
108
+ </div>
109
+ </div>
110
+ </div>
111
+ <div class="layui-footer">
112
+ 学习是一种信仰。
113
+ </div>
114
+ </div>
115
+
116
+ <script src="/layui.js"></script>
117
+ <script src="https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.js"></script>
118
+
119
+ <script>
120
+ //JS
121
+ layui.use(['element', 'layer', 'util', 'table', 'laydate', 'form'], function () {
122
+ var element = layui.element;
123
+ var layer = layui.layer;
124
+ var util = layui.util;
125
+ var table = layui.table;
126
+ var laydate = layui.laydate;
127
+ var $ = layui.$;
128
+ var form = layui.form;
129
+
130
+ $(function () {
131
+ $('#idinput').val(sessionStorage.getItem("stuidsearch"));
132
+ });
133
+
134
+ table.render({
135
+ elem: '#numbers',
136
+ url: '/api/list',
137
+ id: 'def',
138
+ toolbar: true,
139
+ title: '个人信息',
140
+ totalRow: true,
141
+ page: true,
142
+ limit: 10,
143
+ limits: [5, 10, 20, 30],
144
+ parseData: function (res) {
145
+ console.log(res);
146
+ var current_pages;
147
+ if (this.page === true) current_pages = 1;
148
+ else current_pages = this.page.curr;
149
+ var data = res.data.slice(this.limit * (current_pages - 1), this.limit * current_pages);
150
+ return {
151
+ "code": res.code,
152
+ "msg": res.msg,
153
+ "count": res.data.length,
154
+ "data": data
155
+ }
156
+ },
157
+ cols: [
158
+ [{
159
+ field: 'stuid',
160
+ title: '学号',
161
+ width: 200,
162
+ sort: true
163
+ }, {
164
+ field: 'name',
165
+ title: '姓名',
166
+ width: 200,
167
+ edit: true
168
+ }, {
169
+ field: 'cardid',
170
+ title: '卡号',
171
+ width: 350,
172
+ edit: true,
173
+ sort: true
174
+ }, {
175
+ field: 'type',
176
+ title: '类型',
177
+ width: 200,
178
+ sort: true
179
+ }, {
180
+ title: '操作',
181
+ toolbar: '#barDemo',
182
+ fixed: 'right'
183
+ }]
184
+ ]
185
+ });
186
+
187
+ form.verify({
188
+ stuid: function (value, item) { //value:表单的值、item:表单的DOM对象
189
+ var checkResult = "";
190
+ $.ajax({
191
+ url: "/api/inputcheck0",
192
+ type: "POST",
193
+ data: {
194
+ n: 0,
195
+ idinput: value
196
+ },
197
+ async: false,
198
+ success: function (result) {
199
+ if ((result.sign == 0) && (value != "")) {
200
+ checkResult = "该学号已存在";
201
+ }
202
+ },
203
+ error: function () {
204
+ }
205
+ });
206
+ if (checkResult != '')
207
+ return checkResult;
208
+ }
209
+ , cardid: function (value, item) { //value:表单的值、item:表单的DOM对象
210
+ var checkResult = "";
211
+ $.ajax({
212
+ url: "/api/inputcheck1",
213
+ type: "POST",
214
+ data: {
215
+ n: 1,
216
+ idinput: value
217
+ },
218
+ async: false,
219
+ success: function (result) {
220
+ if (result.sign == 0) {
221
+ checkResult = "该卡号已存在";
222
+ }
223
+ }
224
+ });
225
+ if (checkResult != '')
226
+ return checkResult;
227
+ }
228
+ });
229
+
230
+
231
+
232
+ //头部事件
233
+ util.event('lay-header-event', {
234
+ menuLeft: function (othis) { // 左侧菜单事件
235
+ layer.msg('展开左侧菜单的操作', { icon: 0 });
236
+ },
237
+ menuRight: function () { // 右侧菜单事件
238
+ layer.open({
239
+ type: 1,
240
+ title: '作者',
241
+ content: '<div style="padding: 15px;">信息工程学院<br/>祝乙文,姜莱</div>',
242
+ area: ['150px', '100%'],
243
+ offset: 'rt', // 右上角
244
+ anim: 'slideLeft', // 从右侧抽屉滑出
245
+ shadeClose: true,
246
+ scrollbar: false
247
+ });
248
+ }
249
+ });
250
+
251
+ form.on('submit(formDemo1)', function (data) {
252
+ if (data.field.inserttype === '201') {
253
+ data.field.inserttype = '本科生';
254
+ } else if (data.field.inserttype === '204') {
255
+ data.field.inserttype = '教职工';
256
+ }
257
+ $.ajax({
258
+ type: 'post',
259
+ url: '/db/insert_user',
260
+ data: data.field,
261
+ success: function (data) {
262
+ if (data.status == 'ok') {
263
+ layer.msg('添加成功!');
264
+ } else if (data.status == 'error') {
265
+ layer.msg('添加失败! 原因是:' + data.err);
266
+ }
267
+ }
268
+ });
269
+ return false;
270
+ });
271
+ });
272
+ </script>
273
+
274
+ </body>
275
+
276
+ </html>
@@ -0,0 +1,4 @@
1
+ <h1><%= message %></h1>
2
+ <h2><%= error.status %></h2>
3
+ <pre><%= error.stack %></pre>
4
+