v2.2更新
This commit is contained in:
@@ -16,25 +16,18 @@ async function loadHomework() {
|
||||
const res = await apiGet(`/api/student/homework/${STUDENT_ID}`);
|
||||
if (res && res.success) {
|
||||
let html = '';
|
||||
res.data.homework.forEach(hw => {
|
||||
// 提交状态
|
||||
let statusDisplay = '-';
|
||||
if (hw.status) {
|
||||
statusDisplay = getStatusBadge(hw.status, 'homework');
|
||||
}
|
||||
// 扣分显示
|
||||
const pointsDisplay = hw.points ? `<span class="text-danger">${hw.points}分</span>` : '-';
|
||||
|
||||
res.data.homework.forEach(record => {
|
||||
const pointsClass = record.points_change > 0 ? 'plus' : 'minus';
|
||||
const pointsColor = record.points_change > 0 ? '#38a169' : '#e53e3e';
|
||||
html += `<tr>
|
||||
<td>${escapeHtml(hw.title)}</td>
|
||||
<td>${escapeHtml(hw.subject_name)}</td>
|
||||
<td>${hw.deadline || '-'}</td>
|
||||
<td>${statusDisplay}</td>
|
||||
<td>${pointsDisplay}</td>
|
||||
<td>${formatDateTime(record.created_at)}</td>
|
||||
<td style="color: ${pointsColor}; font-weight: bold;">${record.points_change > 0 ? '+' : ''}${record.points_change}</td>
|
||||
<td>${escapeHtml(record.reason)}</td>
|
||||
<td>${escapeHtml(record.recorder_name || '-')}</td>
|
||||
</tr>`;
|
||||
});
|
||||
if (res.data.homework.length === 0) {
|
||||
html = '<tr><td colspan="5" style="text-align:center; padding: 40px; color: #999;">📝 暂无作业记录</td></tr>';
|
||||
html = '<tr><td colspan="4" style="text-align:center; padding: 40px; color: #999;">📝 暂无作业扣分记录</td></tr>';
|
||||
}
|
||||
document.getElementById('homeworkList').innerHTML = html;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user