mirror of
https://github.com/ZeroCatDev/ClassworksKV.git
synced 2025-07-03 05:19:22 +00:00
1
This commit is contained in:
parent
8ad86c103f
commit
70284200d1
131
views/test.ejs
131
views/test.ejs
@ -1,131 +0,0 @@
|
|||||||
<!-- views/index.ejs -->
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="zh">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>作业板</title>
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
||||||
<style>
|
|
||||||
.homework-card {
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
padding: 15px;
|
|
||||||
margin: 10px;
|
|
||||||
border-radius: 5px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.homework-row {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.attendance-area {
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
padding: 15px;
|
|
||||||
margin: 10px;
|
|
||||||
border-radius: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.student-checkbox {
|
|
||||||
margin: 5px;
|
|
||||||
padding: 8px;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.student-checkbox input {
|
|
||||||
margin-right: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
pre {
|
|
||||||
white-space: pre-wrap;
|
|
||||||
margin: 0;
|
|
||||||
font-family: inherit;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="row">
|
|
||||||
<!-- 作业区域 -->
|
|
||||||
<div class="col-md-8">
|
|
||||||
<h1>作业 <small class="text-muted"><%= date %></small></h1>
|
|
||||||
<div id="homeworkContainer">
|
|
||||||
<% config.homeworkArrange.forEach(function(row) { %>
|
|
||||||
<div class="homework-row">
|
|
||||||
<% row.forEach(function(subject) { %>
|
|
||||||
<div class="col">
|
|
||||||
<div class="homework-card" onclick="openHomeworkModal('<%= subject %>')">
|
|
||||||
<h3><%= subject %></h3>
|
|
||||||
<pre><%= homeworkData[subject]?.content || '' %></pre>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% }); %>
|
|
||||||
</div>
|
|
||||||
<% }); %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 考勤区域 -->
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="attendance-area">
|
|
||||||
<h2>出勤</h2>
|
|
||||||
<p>应到: <%= studentList.length %> 人</p>
|
|
||||||
<p>实到: <%= studentList.length - selectedStudent.size %> 人</p>
|
|
||||||
<p>请假: <%= selectedStudent.size %> 人</p>
|
|
||||||
|
|
||||||
<form action="/updateAttendance" method="POST">
|
|
||||||
<input type="hidden" name="date" value="<%= date %>">
|
|
||||||
<% studentList.forEach(function(student, index) { %>
|
|
||||||
<div class="student-checkbox">
|
|
||||||
<label>
|
|
||||||
<input type="checkbox"
|
|
||||||
name="selectedStudents"
|
|
||||||
value="<%= index %>"
|
|
||||||
<%= selectedStudent.has(index) ? 'checked' : '' %>>
|
|
||||||
<%= `${index + 1}. ${student}` %>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<% }); %>
|
|
||||||
<button type="submit" class="btn btn-primary mt-3">保存考勤</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 作业编辑模态框 -->
|
|
||||||
<div class="modal fade" id="homeworkModal" tabindex="-1">
|
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h5 class="modal-title"></h5>
|
|
||||||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<form action="/updateHomework" method="POST">
|
|
||||||
<input type="hidden" name="date" value="<%= date %>">
|
|
||||||
<input type="hidden" name="subject" id="modalSubject">
|
|
||||||
<textarea class="form-control" name="content" rows="5"></textarea>
|
|
||||||
<button type="submit" class="btn btn-primary mt-3">保存</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
|
|
||||||
<script>
|
|
||||||
// 最小化的JavaScript代码
|
|
||||||
function openHomeworkModal(subject) {
|
|
||||||
const modal = $('#homeworkModal');
|
|
||||||
modal.find('.modal-title').text(subject + '作业');
|
|
||||||
modal.find('#modalSubject').val(subject);
|
|
||||||
modal.find('textarea').val($(`#homeworkContainer .homework-card:contains('${subject}') pre`).text());
|
|
||||||
new bootstrap.Modal(modal).show();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Loading…
x
Reference in New Issue
Block a user