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

@@ -34,14 +34,15 @@ include __DIR__ . '/../includes/header.php';
<table class="table">
<thead>
<tr>
<th>日期</th>
<th>原因</th>
<th>类型</th>
<th>分值</th>
<th>原因</th>
<th>记录人</th>
<th>日期</th>
</tr>
</thead>
<tbody id="historyList">
<tr><td colspan="4" style="text-align:center;">加载中...</td></tr>
<tr><td colspan="5" style="text-align:center;">加载中...</td></tr>
</tbody>
</table>
</div>
@@ -73,18 +74,20 @@ const pageSize = 20;
async function loadHistory(page) {
const res = await apiGet('/api/parent/child/history', { page: page, page_size: pageSize });
if (res && res.success) {
let html = '';
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>';
} else {
res.data.records.forEach(record => {
const pointsClass = record.points_change > 0 ? 'plus' : 'minus';
const pointsText = record.points_change > 0 ? `+${record.points_change}` : record.points_change;
const typeLabel = { manual: '手动', homework: '作业', attendance: '考勤' }[record.related_type] || '手动';
html += `<tr>
<td>${formatDateTime(record.created_at)}</td>
<td class="history-reason">${escapeHtml(record.reason || '-')}</td>
<td>${typeLabel}</td>
<td><span class="record-points ${pointsClass}">${pointsText}</span></td>
<td class="history-reason">${escapeHtml(record.reason || '-')}</td>
<td>班主任</td>
<td>${formatDateTime(record.created_at)}</td>
</tr>`;
</tr>`;
});
}