v2.9update

This commit is contained in:
2026-06-08 10:40:59 +08:00
parent 8d497d73d2
commit 70e7ad8e5e
20 changed files with 162 additions and 74 deletions

View File

@@ -140,10 +140,11 @@ include __DIR__ . '/../includes/header.php';
<table>
<thead>
<tr>
<th>时间</th>
<th>类型</th>
<th>分值</th>
<th>原因</th>
<th>操作人</th>
<th>时间</th>
</tr>
</thead>
<tbody id="homeworkList"></tbody>
@@ -351,21 +352,23 @@ include __DIR__ . '/../includes/header.php';
if (res && res.success) {
document.getElementById('conductTotalPoints').textContent = res.data.total_points;
let html = '<div class="table-wrapper"><table><thead><tr><th>时间</th><th>分数变动</th><th>原因</th><th>操作人</th></tr></thead><tbody>';
let html = '<div class="table-wrapper"><table><thead><tr><th>类型</th><th>分</th><th>原因</th><th>操作人</th><th>时间</th></tr></thead><tbody>';
res.data.records.forEach(record => {
const pointsClass = record.points_change > 0 ? 'plus' : 'minus';
const recorderDisplay = record.points_change < 0 ? '班主任' : escapeHtml(record.recorder_name || '班主任');
const typeLabel = { manual: '手动', homework: '作业', attendance: '考勤' }[record.related_type] || '手动';
html += `
<tr>
<td>${formatDateTime(record.created_at)}</td>
<td>${typeLabel}</td>
<td class="record-points ${pointsClass}">${record.points_change > 0 ? '+' : ''}${record.points_change}</td>
<td>${escapeHtml(record.reason)}</td>
<td>${recorderDisplay}</td>
<td>${formatDateTime(record.created_at)}</td>
</tr>
`;
});
if (res.data.records.length === 0) {
html += '<tr><td colspan="4" style="text-align:center;">暂无记录</td></tr>';
html += '<tr><td colspan="5" style="text-align:center;">暂无记录</td></tr>';
}
html += '</tbody></table></div>';
document.getElementById('conductRecords').innerHTML = html;
@@ -391,20 +394,22 @@ include __DIR__ . '/../includes/header.php';
try {
const res = await apiGet(`/api/student/homework/${STUDENT_ID}`);
if (res && res.success) {
let html = '';
res.data.homework.forEach(record => {
const pointsClass = record.points_change > 0 ? 'plus' : 'minus';
const typeLabel = { manual: '手动', homework: '作业', attendance: '考勤' }[record.related_type] || '作业';
html += `
<tr>
<td>${formatDateTime(record.created_at)}</td>
<td>${typeLabel}</td>
<td class="record-points ${pointsClass}">${record.points_change > 0 ? '+' : ''}${record.points_change}</td>
<td>${escapeHtml(record.reason)}</td>
<td>${escapeHtml(record.recorder_name || '-')}</td>
<td>${formatDateTime(record.created_at)}</td>
</tr>
`;
});
if (res.data.homework.length === 0) {
html = '<tr><td colspan="4" style="text-align:center;">暂无作业扣分记录</td></tr>';
html = '<tr><td colspan="5" style="text-align:center;">暂无作业扣分记录</td></tr>';
}
}
document.getElementById('homeworkList').innerHTML = html;
}