add:教师端新增删除课程,增加并更换footer-brief模板

This commit is contained in:
2025-12-25 15:52:29 +08:00
parent f3c30a80a3
commit 68493d6a62
8 changed files with 120 additions and 22 deletions

View File

@@ -292,6 +292,43 @@ function closeAddCourseModal() {
document.getElementById('add-course-modal').style.display = 'none';
}
// 显示删除课程确认弹窗
function showDeleteCourseConfirmation() {
if (!material_id) {
alert('无法删除课程未找到课程ID');
return;
}
if (confirm('确定要删除这个课程吗?此操作无法撤销!')) {
deleteCourse(material_id);
}
}
// 删除课程
function deleteCourse(courseId) {
fetch(`/materials/${courseId}`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(data => {
if (data.message) {
alert(data.message);
if (data.success) {
// 关闭侧边栏并刷新页面
closeCourseDetails();
location.reload();
}
}
})
.catch(error => {
console.error('删除课程时出错:', error);
alert('删除课程失败,请稍后再试!');
});
}
function onTeacherboardPageLoad(){
// 提交表单处理
document.getElementById('add-course-form').addEventListener('submit', function(event) {