46 lines
1.3 KiB
JavaScript
46 lines
1.3 KiB
JavaScript
/**
|
|
* 班级操行分管理系统 - 学生端作业情况JS
|
|
*
|
|
* 开发者: Canglan
|
|
* 版权归属: Sea Network Technology Studio
|
|
*
|
|
* 版权所有 © Sea Network Technology Studio
|
|
*/
|
|
|
|
(function() {
|
|
'use strict';
|
|
|
|
const STUDENT_ID = window.PAGE_CONFIG.studentId;
|
|
|
|
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 style="color: #e53e3e;">${hw.points}分</span>` : '-';
|
|
|
|
html += `<tr>
|
|
<td>${escapeHtml(hw.title)}</td>
|
|
<td>${escapeHtml(hw.subject_name)}</td>
|
|
<td>${hw.deadline || '-'}</td>
|
|
<td>${statusDisplay}</td>
|
|
<td>${pointsDisplay}</td>
|
|
</tr>`;
|
|
});
|
|
if (res.data.homework.length === 0) {
|
|
html = '<tr><td colspan="5" style="text-align:center; padding: 40px; color: #999;">📝 暂无作业记录</td></tr>';
|
|
}
|
|
document.getElementById('homeworkList').innerHTML = html;
|
|
}
|
|
}
|
|
|
|
loadHomework();
|
|
|
|
})();
|