84 lines
5.7 KiB
HTML
84 lines
5.7 KiB
HTML
{% extends "base_tailwind.html" %}
|
|
{% block title %}毕业论文选题 - {{ brand_name }}{% endblock %}
|
|
{% block extra_css %}
|
|
<style>
|
|
@keyframes fadeSlideIn {
|
|
from { opacity: 0; transform: translateY(8px); }
|
|
to { opacity: 1; transform: translateY(0); }
|
|
}
|
|
.row-animate { animation: fadeSlideIn 0.3s ease both; }
|
|
@media (prefers-reduced-motion: reduce) {
|
|
.row-animate { animation: none !important; opacity: 1 !important; }
|
|
.list-item-enter { animation: none !important; opacity: 1 !important; }
|
|
}
|
|
</style>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<div>
|
|
<div class="flex flex-col md:flex-row justify-between items-start md:items-center gap-4 mb-6 list-item-enter">
|
|
<div>
|
|
<h2 class="text-2xl font-bold flex items-center gap-2">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"/><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"/><line x1="8" y1="7" x2="16" y2="7"/><line x1="8" y1="11" x2="14" y2="11"/></svg>
|
|
学生选题
|
|
</h2>
|
|
<p class="text-sm text-gray-500 dark:text-gray-400 mt-1">毕业论文(设计)选题</p>
|
|
</div>
|
|
<button onclick="loadData()" class="px-4 py-2 rounded-lg border"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="23 4 23 10 17 10"/><path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/></svg>刷新</button>
|
|
</div>
|
|
<div class="glass rounded-2xl p-4 mb-4">
|
|
<div class="flex items-center gap-2 text-sm">
|
|
<span class="text-xs font-medium text-gray-500 dark:text-gray-400 mr-2">选题状态</span>
|
|
<span id="topicStatus" class="px-2 py-0.5 rounded text-xs bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400">加载中...</span>
|
|
</div>
|
|
</div>
|
|
<div id="loadingIndicator" class="text-center py-12 hidden"><div class="w-10 h-10 border-2 border-black dark:border-white border-t-transparent rounded-full animate-spin mx-auto mb-4"></div><p class="text-gray-500 dark:text-gray-400">加载中...</p></div>
|
|
<div id="errorMessage" class="glass rounded-2xl p-6 mb-4 text-center hidden"><p id="errorText" class="text-red-500"></p></div>
|
|
<div id="dataContainer" class="hidden">
|
|
<div class="glass rounded-2xl overflow-hidden">
|
|
<div class="overflow-x-auto">
|
|
<table class="w-full text-sm">
|
|
<thead><tr class="border-b border-gray-200 dark:border-gray-700 bg-gray-50/50 dark:bg-gray-800/50"><th class="text-left py-3 px-4 font-semibold">课题名称</th><th class="text-left py-3 px-4 font-semibold">指导教师</th><th class="text-left py-3 px-4 font-semibold">课题来源</th><th class="text-left py-3 px-4 font-semibold">选题状态</th></tr></thead>
|
|
<tbody id="tableBody"></tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="emptyState" class="glass rounded-2xl p-12 text-center hidden"><p class="text-gray-500 dark:text-gray-400 text-lg">暂无选题信息</p></div>
|
|
</div>
|
|
{% endblock %}
|
|
{% block extra_js %}
|
|
<script>
|
|
async function loadData() {
|
|
document.getElementById('loadingIndicator').classList.remove('hidden');
|
|
document.getElementById('errorMessage').classList.add('hidden');
|
|
document.getElementById('dataContainer').classList.add('hidden');
|
|
document.getElementById('emptyState').classList.add('hidden');
|
|
try {
|
|
const res = await fetch('/api/jwxt/thesis-topic');
|
|
const data = await res.json();
|
|
document.getElementById('loadingIndicator').classList.add('hidden');
|
|
if (!data.success) { showError(data.message); return; }
|
|
const items = data.items || data.available_topics || [];
|
|
const statusText = data.status || (items.length > 0 ? '已选题' : '未选题');
|
|
document.getElementById('topicStatus').textContent = statusText;
|
|
document.getElementById('topicStatus').className = 'px-2 py-0.5 rounded text-xs ' + (statusText.includes('已选')?'bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400':'bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400');
|
|
if (!items.length) { document.getElementById('emptyState').classList.remove('hidden'); return; }
|
|
const tbody = document.getElementById('tableBody');
|
|
tbody.innerHTML = items.map((item, i) => {
|
|
return `<tr class="border-b border-gray-100 dark:border-gray-800 hover:bg-gray-50/50 dark:hover:bg-gray-800/30 transition-colors">
|
|
<td class="py-3 px-4">${escHtml(item.ktmc||item.课题名称||'--')}</td>
|
|
<td class="py-3 px-4">${escHtml(item.zdjs||item.指导教师||item.xm||'--')}</td>
|
|
<td class="py-3 px-4 text-gray-500">${escHtml(item.ktlymc||item.课题来源||'--')}</td>
|
|
<td class="py-3 px-4">${escHtml(item.xtztmc||item.选题状态||'--')}</td>
|
|
</tr>`;
|
|
}).join('');
|
|
document.getElementById('dataContainer').classList.remove('hidden');
|
|
} catch(e) { document.getElementById('loadingIndicator').classList.add('hidden'); showError('网络错误: '+e.message); }
|
|
}
|
|
function showError(msg) { document.getElementById('errorText').textContent = msg; document.getElementById('errorMessage').classList.remove('hidden'); }
|
|
function escHtml(s) { if(s==null) return ''; return String(s).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"'); }
|
|
function escAttr(s) { if(s==null) return ''; return String(s).replace(/&/g,'&').replace(/"/g,'"').replace(/</g,'<').replace(/>/g,'>'); }
|
|
document.addEventListener('DOMContentLoaded', () => loadData());
|
|
</script>
|
|
{% endblock %} |