|
@@ -92,13 +92,42 @@
|
|
|
|
|
|
|
|
<!-- 右侧题目列表区域 -->
|
|
<!-- 右侧题目列表区域 -->
|
|
|
<div class="flex-1">
|
|
<div class="flex-1">
|
|
|
|
|
+ <!-- 筛选栏 -->
|
|
|
|
|
+ <div id="filter-bar" class="apple-card p-4 mb-4">
|
|
|
|
|
+ <div class="flex items-center gap-4 flex-wrap">
|
|
|
|
|
+ <span class="text-sm font-medium text-gray-700">筛选:</span>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 创建人筛选 -->
|
|
|
|
|
+ <div class="flex items-center gap-2">
|
|
|
|
|
+ <label class="text-sm text-gray-600">创建人:</label>
|
|
|
|
|
+ <select id="filter-create-by" class="px-3 py-1.5 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent">
|
|
|
|
|
+ <option value="">全部</option>
|
|
|
|
|
+ {% for creator in creators|default([]) %}
|
|
|
|
|
+ <option value="{{ creator }}">{{ creator }}</option>
|
|
|
|
|
+ {% endfor %}
|
|
|
|
|
+ </select>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 创建时间筛选 -->
|
|
|
|
|
+ <div class="flex items-center gap-2">
|
|
|
|
|
+ <label class="text-sm text-gray-600">创建时间:</label>
|
|
|
|
|
+ <input type="date" id="filter-created-at" class="px-3 py-1.5 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent" />
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 重置按钮 -->
|
|
|
|
|
+ <button onclick="resetFilters()" class="px-4 py-1.5 bg-gray-100 text-gray-700 rounded-lg text-sm hover:bg-gray-200 transition-colors">
|
|
|
|
|
+ 重置
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
<div id="questions-container" class="space-y-4">
|
|
<div id="questions-container" class="space-y-4">
|
|
|
<div class="apple-card p-12 text-center">
|
|
<div class="apple-card p-12 text-center">
|
|
|
<div class="text-gray-400 mb-4">
|
|
<div class="text-gray-400 mb-4">
|
|
|
<i class="ri-file-check-line text-6xl"></i>
|
|
<i class="ri-file-check-line text-6xl"></i>
|
|
|
</div>
|
|
</div>
|
|
|
- <h3 class="text-lg font-bold text-gray-600 mb-2">请选择左侧知识点</h3>
|
|
|
|
|
- <p class="text-sm text-gray-500 mb-6">点击知识点查看该知识点下的未审核题目</p>
|
|
|
|
|
|
|
+ <h3 class="text-lg font-bold text-gray-600 mb-2">请选择左侧知识点或设置筛选条件</h3>
|
|
|
|
|
+ <p class="text-sm text-gray-500 mb-6">点击知识点查看该知识点下的未审核题目,或使用筛选条件查看所有题目</p>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -136,7 +165,7 @@ function toggleKpNode(kpCode) {
|
|
|
let currentKpCode = null;
|
|
let currentKpCode = null;
|
|
|
let currentKpName = null;
|
|
let currentKpName = null;
|
|
|
|
|
|
|
|
-// 加载指定知识点的未审核题目列表(支持分页)
|
|
|
|
|
|
|
+// 加载指定知识点的未审核题目列表(支持分页和筛选)
|
|
|
function loadPendingQuestionsByKp(kpCode, kpName, linkElement, page = null) {
|
|
function loadPendingQuestionsByKp(kpCode, kpName, linkElement, page = null) {
|
|
|
const container = document.getElementById('questions-container');
|
|
const container = document.getElementById('questions-container');
|
|
|
if (!container) return;
|
|
if (!container) return;
|
|
@@ -170,10 +199,24 @@ function loadPendingQuestionsByKp(kpCode, kpName, linkElement, page = null) {
|
|
|
page = pageParam ? parseInt(pageParam) : 1;
|
|
page = pageParam ? parseInt(pageParam) : 1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 构建请求URL(添加分页参数)
|
|
|
|
|
|
|
+ // 获取筛选参数
|
|
|
|
|
+ const createByFilter = document.getElementById('filter-create-by')?.value || '';
|
|
|
|
|
+ const createdAtFilter = document.getElementById('filter-created-at')?.value || '';
|
|
|
|
|
+
|
|
|
|
|
+ // 构建请求URL(添加分页和筛选参数)
|
|
|
let apiUrl = `/api/pending_questions_by_kp/${encodeURIComponent(kpCode)}`;
|
|
let apiUrl = `/api/pending_questions_by_kp/${encodeURIComponent(kpCode)}`;
|
|
|
|
|
+ const params = new URLSearchParams();
|
|
|
if (page > 1) {
|
|
if (page > 1) {
|
|
|
- apiUrl += `?page=${page}`;
|
|
|
|
|
|
|
+ params.append('page', page);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (createByFilter) {
|
|
|
|
|
+ params.append('create_by', createByFilter);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (createdAtFilter) {
|
|
|
|
|
+ params.append('created_at', createdAtFilter);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (params.toString()) {
|
|
|
|
|
+ apiUrl += '?' + params.toString();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 请求未审核题目列表
|
|
// 请求未审核题目列表
|
|
@@ -389,6 +432,315 @@ function loadPendingQuestionsByKpPage(kpCode, page) {
|
|
|
loadPendingQuestionsByKp(kpCode, kpName, linkElement, page);
|
|
loadPendingQuestionsByKp(kpCode, kpName, linkElement, page);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 加载所有题目(根据筛选条件)
|
|
|
|
|
+function loadAllQuestionsByFilter(page = 1) {
|
|
|
|
|
+ const container = document.getElementById('questions-container');
|
|
|
|
|
+ if (!container) return;
|
|
|
|
|
+
|
|
|
|
|
+ // 获取筛选参数
|
|
|
|
|
+ const createByFilter = document.getElementById('filter-create-by')?.value || '';
|
|
|
|
|
+ const createdAtFilter = document.getElementById('filter-created-at')?.value || '';
|
|
|
|
|
+
|
|
|
|
|
+ // 如果没有筛选条件,不加载
|
|
|
|
|
+ if (!createByFilter && !createdAtFilter) {
|
|
|
|
|
+ // 如果有选择的知识点,加载该知识点;否则显示提示
|
|
|
|
|
+ if (currentKpCode !== null) {
|
|
|
|
|
+ const linkElement = document.querySelector(`.kp-link[data-kp-code="${currentKpCode}"]`);
|
|
|
|
|
+ const kpName = linkElement ? (linkElement.getAttribute('data-kp-name') || currentKpCode) : currentKpCode;
|
|
|
|
|
+ loadPendingQuestionsByKp(currentKpCode, kpName, linkElement, page);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ container.innerHTML = `
|
|
|
|
|
+ <div class="apple-card p-12 text-center">
|
|
|
|
|
+ <div class="text-gray-400 mb-4">
|
|
|
|
|
+ <i class="ri-file-check-line text-6xl"></i>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <h3 class="text-lg font-bold text-gray-600 mb-2">请选择左侧知识点或设置筛选条件</h3>
|
|
|
|
|
+ <p class="text-sm text-gray-500 mb-6">点击知识点查看该知识点下的未审核题目,或使用筛选条件查看所有题目</p>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ `;
|
|
|
|
|
+ }
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 清除左侧选中状态
|
|
|
|
|
+ document.querySelectorAll('.kp-link').forEach(link => {
|
|
|
|
|
+ link.classList.remove('bg-orange-50', 'border-orange-400');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ // 显示加载状态
|
|
|
|
|
+ container.innerHTML = `
|
|
|
|
|
+ <div class="apple-card p-12 text-center">
|
|
|
|
|
+ <div class="text-orange-500 mb-4">
|
|
|
|
|
+ <i class="ri-loader-4-line text-6xl animate-spin"></i>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <p class="text-gray-600">正在加载未审核题目...</p>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ `;
|
|
|
|
|
+
|
|
|
|
|
+ // 构建请求URL(使用'all'表示所有题目)
|
|
|
|
|
+ let apiUrl = `/api/pending_questions_by_kp/all`;
|
|
|
|
|
+ const params = new URLSearchParams();
|
|
|
|
|
+ if (page > 1) {
|
|
|
|
|
+ params.append('page', page);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (createByFilter) {
|
|
|
|
|
+ params.append('create_by', createByFilter);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (createdAtFilter) {
|
|
|
|
|
+ params.append('created_at', createdAtFilter);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (params.toString()) {
|
|
|
|
|
+ apiUrl += '?' + params.toString();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 请求题目列表
|
|
|
|
|
+ fetch(apiUrl)
|
|
|
|
|
+ .then(response => response.json())
|
|
|
|
|
+ .then(data => {
|
|
|
|
|
+ if (!data.success) {
|
|
|
|
|
+ throw new Error(data.error || '加载失败');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const questions = data.questions || [];
|
|
|
|
|
+ const kpName = data.kp_name || '全部题目';
|
|
|
|
|
+
|
|
|
|
|
+ // 获取分页信息
|
|
|
|
|
+ const pagination = data.pagination || {};
|
|
|
|
|
+ const currentPage = pagination.page || 1;
|
|
|
|
|
+ const totalPages = pagination.total_pages || 1;
|
|
|
|
|
+ const totalCount = pagination.total_count || questions.length;
|
|
|
|
|
+ const pageSize = pagination.page_size || 20;
|
|
|
|
|
+ const startIndex = (currentPage - 1) * pageSize;
|
|
|
|
|
+ const endIndex = Math.min(startIndex + pageSize, totalCount);
|
|
|
|
|
+
|
|
|
|
|
+ // 渲染题目列表(复用相同的渲染逻辑)
|
|
|
|
|
+ let html = '';
|
|
|
|
|
+
|
|
|
|
|
+ html += `<div class="space-y-3 mt-6">`;
|
|
|
|
|
+
|
|
|
|
|
+ if (questions.length === 0) {
|
|
|
|
|
+ html += `
|
|
|
|
|
+ <div class="apple-card p-12 text-center">
|
|
|
|
|
+ <div class="text-gray-400 mb-4">
|
|
|
|
|
+ <i class="ri-file-list-line text-6xl"></i>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <h3 class="text-lg font-bold text-gray-600 mb-2">没有找到符合条件的题目</h3>
|
|
|
|
|
+ <p class="text-sm text-gray-500">请尝试调整筛选条件</p>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ `;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ questions.forEach(q => {
|
|
|
|
|
+ let auditBadge = '<span class="bg-orange-100 text-orange-700 px-2 py-0.5 rounded text-xs font-bold whitespace-nowrap">待审核</span>';
|
|
|
|
|
+
|
|
|
|
|
+ let difficultyBadge = '';
|
|
|
|
|
+ if (q.difficulty !== null && q.difficulty !== undefined) {
|
|
|
|
|
+ const diff = parseFloat(q.difficulty);
|
|
|
|
|
+ if (diff === 0.2 || Math.abs(diff - 0.2) < 0.1) {
|
|
|
|
|
+ difficultyBadge = '<span class="px-2 py-0.5 rounded-full text-xs font-bold bg-green-100 text-green-700 border border-green-200 whitespace-nowrap">筑基</span>';
|
|
|
|
|
+ } else if (diff === 0.4 || Math.abs(diff - 0.4) < 0.1) {
|
|
|
|
|
+ difficultyBadge = '<span class="px-2 py-0.5 rounded-full text-xs font-bold bg-yellow-100 text-yellow-700 border border-yellow-200 whitespace-nowrap">提分</span>';
|
|
|
|
|
+ } else if (diff === 0.7 || Math.abs(diff - 0.7) < 0.1) {
|
|
|
|
|
+ difficultyBadge = '<span class="px-2 py-0.5 rounded-full text-xs font-bold bg-orange-100 text-orange-700 border border-orange-200 whitespace-nowrap">培优</span>';
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const typeMap = {'choice': '选择题', 'fill': '填空题', 'answer': '解答题'};
|
|
|
|
|
+ const questionTypeText = typeMap[q.question_type] || q.question_type || '未分类';
|
|
|
|
|
+
|
|
|
|
|
+ let gradeBadge = '';
|
|
|
|
|
+ if (q.grade !== null && q.grade !== undefined) {
|
|
|
|
|
+ const grade = parseInt(q.grade);
|
|
|
|
|
+ if (grade === 1) {
|
|
|
|
|
+ gradeBadge = '<span class="px-2 py-0.5 rounded-full text-xs font-bold bg-pink-100 text-pink-700 border border-pink-200 whitespace-nowrap">小学</span>';
|
|
|
|
|
+ } else if (grade === 2) {
|
|
|
|
|
+ gradeBadge = '<span class="px-2 py-0.5 rounded-full text-xs font-bold bg-blue-100 text-blue-700 border border-blue-200 whitespace-nowrap">初中</span>';
|
|
|
|
|
+ } else if (grade === 3) {
|
|
|
|
|
+ gradeBadge = '<span class="px-2 py-0.5 rounded-full text-xs font-bold bg-purple-100 text-purple-700 border border-purple-200 whitespace-nowrap">高中</span>';
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const stemText = (q.stem || '').replace(/<[^>]*>/g, '').substring(0, 150);
|
|
|
|
|
+
|
|
|
|
|
+ html += `
|
|
|
|
|
+ <a href="/detail/${q.question_code}"
|
|
|
|
|
+ class="apple-card p-4 block group hover:shadow-lg transition-all border-l-4 border-transparent hover:border-blue-500">
|
|
|
|
|
+ <div class="flex items-center gap-4">
|
|
|
|
|
+ <div class="flex-shrink-0">
|
|
|
|
|
+ <span class="text-xs font-mono text-gray-500 bg-gray-100 px-3 py-1.5 rounded font-semibold">${q.question_code}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="flex-1 min-w-0">
|
|
|
|
|
+ <div class="text-sm text-gray-800 group-hover:text-blue-600 transition-colors line-clamp-1">
|
|
|
|
|
+ ${stemText}${stemText.length >= 150 ? '...' : ''}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="flex items-center gap-3 flex-shrink-0">
|
|
|
|
|
+ <span class="text-xs text-gray-500 bg-gray-50 px-2 py-1 rounded">${questionTypeText}</span>
|
|
|
|
|
+ ${gradeBadge}
|
|
|
|
|
+ ${difficultyBadge}
|
|
|
|
|
+ ${auditBadge}
|
|
|
|
|
+ <span class="text-xs text-blue-600 font-medium opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap">查看详情 →</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </a>
|
|
|
|
|
+ `;
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ // 添加分页控件
|
|
|
|
|
+ if (totalPages > 1) {
|
|
|
|
|
+ html += `
|
|
|
|
|
+ <div class="mt-6 flex items-center justify-between">
|
|
|
|
|
+ <div class="text-sm text-gray-600">
|
|
|
|
|
+ 显示第 ${startIndex + 1}-${endIndex} 题,共 ${totalCount} 题
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="flex items-center gap-2">
|
|
|
|
|
+ <button
|
|
|
|
|
+ onclick="loadAllQuestionsByFilterPage(${currentPage - 1})"
|
|
|
|
|
+ ${currentPage === 1 ? 'disabled' : ''}
|
|
|
|
|
+ class="px-4 py-2 rounded-lg text-sm font-medium transition-all border-2 ${
|
|
|
|
|
+ currentPage === 1
|
|
|
|
|
+ ? 'border-gray-200 bg-gray-50 text-gray-400 cursor-not-allowed'
|
|
|
|
|
+ : 'border-blue-300 bg-white text-blue-700 hover:bg-blue-50'
|
|
|
|
|
+ }">
|
|
|
|
|
+ <i class="ri-arrow-left-s-line"></i> 上一页
|
|
|
|
|
+ </button>
|
|
|
|
|
+ <div class="flex items-center gap-1">
|
|
|
|
|
+ ${Array.from({length: totalPages}, (_, i) => i + 1).map(p => {
|
|
|
|
|
+ if (p === 1 || p === totalPages || (p >= currentPage - 2 && p <= currentPage + 2)) {
|
|
|
|
|
+ return `
|
|
|
|
|
+ <button
|
|
|
|
|
+ onclick="loadAllQuestionsByFilterPage(${p})"
|
|
|
|
|
+ class="px-3 py-2 rounded-lg text-sm font-medium transition-all border-2 ${
|
|
|
|
|
+ p === currentPage
|
|
|
|
|
+ ? 'border-blue-500 bg-blue-500 text-white'
|
|
|
|
|
+ : 'border-gray-300 bg-white text-gray-700 hover:bg-gray-50'
|
|
|
|
|
+ }">
|
|
|
|
|
+ ${p}
|
|
|
|
|
+ </button>
|
|
|
|
|
+ `;
|
|
|
|
|
+ } else if (p === currentPage - 3 || p === currentPage + 3) {
|
|
|
|
|
+ return '<span class="px-2 text-gray-400">...</span>';
|
|
|
|
|
+ }
|
|
|
|
|
+ return '';
|
|
|
|
|
+ }).join('')}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <button
|
|
|
|
|
+ onclick="loadAllQuestionsByFilterPage(${currentPage + 1})"
|
|
|
|
|
+ ${currentPage === totalPages ? 'disabled' : ''}
|
|
|
|
|
+ class="px-4 py-2 rounded-lg text-sm font-medium transition-all border-2 ${
|
|
|
|
|
+ currentPage === totalPages
|
|
|
|
|
+ ? 'border-gray-200 bg-gray-50 text-gray-400 cursor-not-allowed'
|
|
|
|
|
+ : 'border-blue-300 bg-white text-blue-700 hover:bg-blue-50'
|
|
|
|
|
+ }">
|
|
|
|
|
+ 下一页 <i class="ri-arrow-right-s-line"></i>
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ `;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ html += '</div>';
|
|
|
|
|
+ container.innerHTML = html;
|
|
|
|
|
+
|
|
|
|
|
+ // 渲染数学公式
|
|
|
|
|
+ if (window.renderMathInElement) {
|
|
|
|
|
+ container.querySelectorAll('.math-render').forEach(el => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ window.renderMathInElement(el, {
|
|
|
|
|
+ delimiters: [
|
|
|
|
|
+ {left: "$$", right: "$$", display: true},
|
|
|
|
|
+ {left: "$", right: "$", display: false},
|
|
|
|
|
+ {left: "\\(", right: "\\)", display: false},
|
|
|
|
|
+ {left: "\\[", right: "\\]", display: true}
|
|
|
|
|
+ ],
|
|
|
|
|
+ throwOnError: false
|
|
|
|
|
+ });
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ console.warn('数学公式渲染失败:', e);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(error => {
|
|
|
|
|
+ container.innerHTML = `
|
|
|
|
|
+ <div class="apple-card p-12 text-center">
|
|
|
|
|
+ <div class="text-red-400 mb-4">
|
|
|
|
|
+ <i class="ri-error-warning-line text-6xl"></i>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <h3 class="text-lg font-bold text-gray-600 mb-2">加载失败</h3>
|
|
|
|
|
+ <p class="text-sm text-red-500">${error.message || '未知错误'}</p>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ `;
|
|
|
|
|
+ });
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// 分页加载所有题目(根据筛选条件)
|
|
|
|
|
+function loadAllQuestionsByFilterPage(page) {
|
|
|
|
|
+ loadAllQuestionsByFilter(page);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// 重置筛选条件
|
|
|
|
|
+function resetFilters() {
|
|
|
|
|
+ document.getElementById('filter-create-by').value = '';
|
|
|
|
|
+ const dateInput = document.getElementById('filter-created-at');
|
|
|
|
|
+ if (dateInput) {
|
|
|
|
|
+ dateInput.value = '';
|
|
|
|
|
+ }
|
|
|
|
|
+ // 重新加载当前知识点的题目,如果没有选择知识点则显示提示
|
|
|
|
|
+ if (currentKpCode !== null) {
|
|
|
|
|
+ const linkElement = document.querySelector(`.kp-link[data-kp-code="${currentKpCode}"]`);
|
|
|
|
|
+ const kpName = linkElement ? (linkElement.getAttribute('data-kp-name') || currentKpCode) : currentKpCode;
|
|
|
|
|
+ loadPendingQuestionsByKp(currentKpCode, kpName, linkElement, 1);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ const container = document.getElementById('questions-container');
|
|
|
|
|
+ if (container) {
|
|
|
|
|
+ container.innerHTML = `
|
|
|
|
|
+ <div class="apple-card p-12 text-center">
|
|
|
|
|
+ <div class="text-gray-400 mb-4">
|
|
|
|
|
+ <i class="ri-file-check-line text-6xl"></i>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <h3 class="text-lg font-bold text-gray-600 mb-2">请选择左侧知识点或设置筛选条件</h3>
|
|
|
|
|
+ <p class="text-sm text-gray-500 mb-6">点击知识点查看该知识点下的未审核题目,或使用筛选条件查看所有题目</p>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ `;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// 监听筛选条件变化
|
|
|
|
|
+document.addEventListener('DOMContentLoaded', function() {
|
|
|
|
|
+ const createByFilter = document.getElementById('filter-create-by');
|
|
|
|
|
+ const createdAtFilter = document.getElementById('filter-created-at');
|
|
|
|
|
+
|
|
|
|
|
+ // 检查是否有筛选条件的函数
|
|
|
|
|
+ function checkAndLoad() {
|
|
|
|
|
+ const createBy = createByFilter?.value || '';
|
|
|
|
|
+ const createdAt = createdAtFilter?.value || '';
|
|
|
|
|
+
|
|
|
|
|
+ // 如果有筛选条件,加载所有题目
|
|
|
|
|
+ if (createBy || createdAt) {
|
|
|
|
|
+ loadAllQuestionsByFilter(1);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 如果没有筛选条件,加载当前知识点的题目
|
|
|
|
|
+ if (currentKpCode !== null) {
|
|
|
|
|
+ const linkElement = document.querySelector(`.kp-link[data-kp-code="${currentKpCode}"]`);
|
|
|
|
|
+ const kpName = linkElement ? (linkElement.getAttribute('data-kp-name') || currentKpCode) : currentKpCode;
|
|
|
|
|
+ loadPendingQuestionsByKp(currentKpCode, kpName, linkElement, 1);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (createByFilter) {
|
|
|
|
|
+ createByFilter.addEventListener('change', checkAndLoad);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (createdAtFilter) {
|
|
|
|
|
+ // 日期选择器支持 change 和 input 事件
|
|
|
|
|
+ createdAtFilter.addEventListener('change', checkAndLoad);
|
|
|
|
|
+ createdAtFilter.addEventListener('input', checkAndLoad);
|
|
|
|
|
+ }
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
// 页面加载完成后,初始化知识点目录
|
|
// 页面加载完成后,初始化知识点目录
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
|
// 默认展开第一级节点
|
|
// 默认展开第一级节点
|