修复学生端不可用问题

This commit is contained in:
2026-06-15 09:15:43 +08:00
parent 5e0052564b
commit 3067542e53

View File

@@ -393,6 +393,7 @@ include __DIR__ . '/../includes/header.php';
async function loadHomework() { async function loadHomework() {
try { try {
const res = await apiGet(`/api/student/homework/${STUDENT_ID}`); const res = await apiGet(`/api/student/homework/${STUDENT_ID}`);
let html = '';
if (res && res.success) { if (res && res.success) {
res.data.homework.forEach(record => { res.data.homework.forEach(record => {
const pointsClass = record.points_change > 0 ? 'plus' : 'minus'; const pointsClass = record.points_change > 0 ? 'plus' : 'minus';
@@ -410,7 +411,6 @@ include __DIR__ . '/../includes/header.php';
if (res.data.homework.length === 0) { if (res.data.homework.length === 0) {
html = '<tr><td colspan="5" style="text-align:center;">暂无作业扣分记录</td></tr>'; html = '<tr><td colspan="5" style="text-align:center;">暂无作业扣分记录</td></tr>';
} }
}
document.getElementById('homeworkList').innerHTML = html; document.getElementById('homeworkList').innerHTML = html;
} }
} catch (error) { } catch (error) {