v1.7版本更新
This commit is contained in:
38
frontend/assets/js/student-homework.js
Normal file
38
frontend/assets/js/student-homework.js
Normal file
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* 班级操行分管理系统 - 学生端作业情况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 => {
|
||||
const pointsDisplay = hw.points ? hw.points + '分' : '-';
|
||||
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>
|
||||
</tr>`;
|
||||
});
|
||||
if (res.data.homework.length === 0) {
|
||||
html = '<tr><td colspan="5" style="text-align:center;">暂无作业</td></tr>';
|
||||
}
|
||||
document.getElementById('homeworkList').innerHTML = html;
|
||||
}
|
||||
}
|
||||
|
||||
loadHomework();
|
||||
|
||||
})();
|
||||
Reference in New Issue
Block a user