This repository has been archived on 2024-09-30. You can view files and clone it, but cannot push or open issues/pull-requests.
SmartRollCall/app/templates/attendance-reminder.html

186 lines
6.1 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>签到提醒</title>
<meta name="renderer" content="webkit"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link href="static/css/layui.css" rel="stylesheet"/>
<style>
.calendar-table {
width: 100%;
text-align: center;
border-collapse: collapse;
}
.calendar-table td {
font-size: 20px; /* 增加日期的字体大小 */
}
.signed {
color: #fff; /* 白色文字 */
background-color: green; /* 已签到日期的背景色 */
}
#current-time {
color: #16baaa;
margin-bottom: 15px;
}
#attendance-reminder {
color: #16baaa;
margin-bottom: 15px;
}
.reminder {
margin-top: 20px;
font-size: 16px;
text-align: center;
}
.calendar-table th {
background-color: #f2f2f2;
}
.color-box {
display: inline-block;
width: 20px;
height: 20px;
vertical-align: middle;
margin-right: 5px;
}
.required-sign {
background-color: #FFA07A; /* 需要签到日期的背景色 */
}
</style>
</head>
<body>
<div class="layui-layout layui-layout-admin">
<div class="layui-header">
<div class="layui-logo layui-hide-xs layui-bg-black">网上上课点名系统</div>
<!-- 头部区域可配合layui 已有的水平导航) -->
<ul class="layui-nav layui-layout-right">
<li class="layui-nav-item layui-hide layui-show-sm-inline-block">
<a href="javascript:;">
<img
src="//unpkg.com/outeres@0.0.10/img/layui/icon-v2.png"
class="layui-nav-img"
/>
{{ session.name }}
</a>
<dl class="layui-nav-child">
<dd><a href="/home/profile">资料</a></dd> <!-- 修改这里的href指向/profile -->
<dd><a href="javascript:;" id="logoutLink">登出</a></dd>
</dl>
</li>
<li
class="layui-nav-item"
lay-header-event="menuRight"
lay-unselect
></li>
</ul>
</div>
<div class="layui-side layui-bg-black">
<div class="layui-side-scroll">
<!-- 动态加载菜单栏 -->
<ul class="layui-nav layui-nav-tree" lay-filter="test">
</ul>
</div>
</div>
<div class="layui-body">
<div>
<!-- 动态显示当前时间的标题 -->
<h2 id="attendance-reminder">签到提醒 </h2>
<h2 id="current-time">当前时间</h2>
<table class="layui-table calendar-table" id="calendar">
<!-- 日历的头部 -->
<thead>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<!-- 日历的主体部分 -->
<tbody id="calendar-body">
<!-- 动态生成日历的日期部分 -->
</tbody>
</table>
<!-- 提醒内容 -->
<div class="reminder">
<span><span class="color-box" style="background-color: green;"></span>绿色代表当月已签到</span><br>
<span><span class="color-box" style="background-color: #FFA07A;"></span>颜色代表本月需要签到</span>
</div>
</div>
</div>
</div>
<script src="static/jquery.min.js"></script> <!-- 确保已经引入jQuery -->
<script src="static/layui.js"></script>
<script src="/static/js/menu.js"></script>
<script src="/static/js/logout.js"></script>
<script>
layui.use(['layer'], function () {
var layer = layui.layer;
// 假设的已签到日期数据
var signedDays = [1, 5, 9]; // 这里仅为示例,实际应从服务器获取
var requiredSignDays = [2, 6, 15, 23];
// 动态生成日历
function generateCalendar() {
var today = new Date();
var currentMonth = today.getMonth();
var currentYear = today.getFullYear();
var firstDay = new Date(currentYear, currentMonth, 1).getDay();
var daysInMonth = new Date(currentYear, currentMonth + 1, 0).getDate();
var calendarHtml = '';
var day = 1;
for (var i = 0; i < 6; i++) {
calendarHtml += '<tr>';
for (var j = 0; j < 7; j++) {
if (i === 0 && j < firstDay) {
calendarHtml += '<td></td>';
} else if (day > daysInMonth) {
break;
} else {
var classes = '';
if (signedDays.includes(day)) classes += 'signed '; // 已签到
if (requiredSignDays.includes(day)) classes += 'required-sign'; // 需要签到
calendarHtml += `<td class="${classes}">${day}</td>`;
day++;
}
}
calendarHtml += '</tr>';
if (day > daysInMonth) {
break;
}
}
document.getElementById('calendar-body').innerHTML = calendarHtml;
}
function updateTime() {
var now = new Date();
var timeStr = now.getFullYear() + '年' + (now.getMonth() + 1) + '月' + now.getDate() + '日';
document.getElementById('current-time').innerText = '当前时间: ' + timeStr;
}
// 页面加载时生成日历
generateCalendar();
updateTime();
});
</script>
</body>
</html>