38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
// admin-quiz.js - 面试题库页面功能
|
|
|
|
function generateQuestions() {
|
|
showCustomAlert('info', '生成中', '正在生成面试题目,请稍候...');
|
|
}
|
|
|
|
function filterFavorites() {
|
|
showCustomAlert('info', '筛选收藏', '已筛选收藏的题目');
|
|
}
|
|
|
|
function filterWrong() {
|
|
showCustomAlert('info', '筛选错题', '已筛选错题');
|
|
}
|
|
|
|
function clearAllRecords() {
|
|
if (!confirm('确定要清空所有答题记录吗?')) return;
|
|
showCustomAlert('success', '清空成功', '记录已清空');
|
|
}
|
|
|
|
function deleteFavorite(id) {
|
|
if (!confirm('确定要删除该收藏吗?')) return;
|
|
|
|
fetch(`/api/admin/favorites/${id}`, {
|
|
method: 'DELETE'
|
|
})
|
|
.then(response => response.json())
|
|
.then(result => {
|
|
if (result.success) {
|
|
showCustomAlert('success', '删除成功', '收藏已删除');
|
|
window.location.reload();
|
|
} else {
|
|
showCustomAlert('error', '删除失败', result.message || '操作失败');
|
|
}
|
|
})
|
|
.catch(error => {
|
|
showCustomAlert('error', '删除失败', '网络请求失败');
|
|
});
|
|
} |