v1.2版本更新发布

This commit is contained in:
2026-04-22 00:59:29 +08:00
parent 194c076456
commit 4121e9624f
26 changed files with 1323 additions and 61 deletions

View File

@@ -37,7 +37,7 @@ include __DIR__ . '/../includes/header.php';
<div class="table-wrapper">
<table class="table">
<thead>
<tr><th>排名</th><th>学号</th><th>姓名</th><th>操行分</th></tr>
<tr><th>排名</th><th>学号</th><th>姓名</th><th>操行分</th><th>前%</th></tr>
</thead>
<tbody id="rankingList"></tbody>
</table>
@@ -69,17 +69,25 @@ async function loadDashboard() {
const rankingRes = await apiGet('/api/student/ranking', { limit: 100 });
if (rankingRes && rankingRes.success) {
const totalStudents = rankingRes.data.total_students || 0;
let html = '';
rankingRes.data.ranking.forEach((student, index) => {
const rank = index + 1;
let percentile = '--';
if (totalStudents > 0) {
const pct = Math.floor(rank / totalStudents * 100);
percentile = (pct === 0 ? 1 : pct) + '%';
}
html += `<tr>
<td>${index + 1}</td>
<td>${rank}</td>
<td>${escapeHtml(student.student_no)}</td>
<td>${escapeHtml(student.name)}</td>
<td>${student.total_points}</td>
<td>前${percentile}</td>
</tr>`;
});
if (rankingRes.data.ranking.length === 0) {
html = '<tr><td colspan="4" style="text-align:center;">暂无数据</td></tr>';
html = '<tr><td colspan="5" style="text-align:center;">暂无数据</td></tr>';
}
document.getElementById('rankingList').innerHTML = html;
}