v2.2更新
This commit is contained in:
@@ -94,7 +94,7 @@ include __DIR__ . '/../includes/header.php';
|
||||
<div class="stat-value" id="studentRank">--</div>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<div class="stat-label">缺交次数</div>
|
||||
<div class="stat-label">作业扣分</div>
|
||||
<div class="stat-value" id="homeworkRate">--</div>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
@@ -140,11 +140,10 @@ include __DIR__ . '/../includes/header.php';
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>科目</th>
|
||||
<th>时间</th>
|
||||
<th>分值</th>
|
||||
<th>备注</th>
|
||||
<th>作业</th>
|
||||
<th>原因</th>
|
||||
<th>操作人</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="homeworkList"></tbody>
|
||||
@@ -319,14 +318,13 @@ include __DIR__ . '/../includes/header.php';
|
||||
document.getElementById('studentRank').textContent = '--';
|
||||
}
|
||||
}
|
||||
// 获取作业统计 - 缺交次数
|
||||
// 获取作业扣分统计
|
||||
const homeworkRes = await apiGet(`/api/student/homework/${STUDENT_ID}`);
|
||||
if (homeworkRes && homeworkRes.success) {
|
||||
const stats = homeworkRes.data.statistics;
|
||||
const notSubmitted = (stats.not_submitted || 0) + (stats.late || 0);
|
||||
const deductions = stats.deductions || 0;
|
||||
const total = stats.total || 0;
|
||||
document.getElementById('homeworkRate').textContent = `缺交 ${notSubmitted}/${total} 次`;
|
||||
}
|
||||
document.getElementById('homeworkRate').textContent = `${deductions} 次扣分`;
|
||||
}
|
||||
|
||||
// 获取考勤统计
|
||||
@@ -394,25 +392,24 @@ include __DIR__ . '/../includes/header.php';
|
||||
const res = await apiGet(`/api/student/homework/${STUDENT_ID}`);
|
||||
if (res && res.success) {
|
||||
let html = '';
|
||||
res.data.homework.forEach(hw => {
|
||||
const pointsDisplay = hw.points ? hw.points + '分' : '-';
|
||||
res.data.homework.forEach(record => {
|
||||
const pointsClass = record.points_change > 0 ? 'plus' : 'minus';
|
||||
html += `
|
||||
<tr>
|
||||
<td>${escapeHtml(hw.subject_name)}</td>
|
||||
<td>${hw.deadline || hw.created_at}</td>
|
||||
<td>${pointsDisplay}</td>
|
||||
<td>${escapeHtml(hw.comments || '-')}</td>
|
||||
<td>${escapeHtml(hw.title)}</td>
|
||||
<td>${formatDateTime(record.created_at)}</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>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
if (res.data.homework.length === 0) {
|
||||
html = '<tr><td colspan="5" style="text-align:center;">暂无作业</td></tr>';
|
||||
html = '<tr><td colspan="4" style="text-align:center;">暂无作业扣分记录</td></tr>';
|
||||
}
|
||||
document.getElementById('homeworkList').innerHTML = html;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载作业失败:', error);
|
||||
console.error('加载作业记录失败:', error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ include __DIR__ . '/../includes/header.php';
|
||||
<div class="table-wrapper">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr><th>作业名称</th><th>科目</th><th>截止时间</th><th>提交状态</th><th>扣分</th></tr>
|
||||
<tr><th>时间</th><th>分值</th><th>原因</th><th>操作人</th></tr>
|
||||
</thead>
|
||||
<tbody id="homeworkList"></tbody>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user