116 lines
8.1 KiB
HTML
116 lines
8.1 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, .list-item-enter { animation: none !important; opacity: 1 !important; } }
|
|
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 9999px; font-size: 11px; font-weight: 500; }
|
|
.badge-green { background: #dcfce7; color: #166534; }
|
|
.badge-yellow { background: #fef9c3; color: #854d0e; }
|
|
.badge-gray { background: #f3f4f6; color: #4b5563; }
|
|
.dark .badge-green { background: #14532d; color: #bbf7d0; }
|
|
.dark .badge-yellow { background: #713f12; color: #fef08a; }
|
|
.dark .badge-gray { background: #374151; color: #d1d5db; }
|
|
.change-type-btn { display: inline-flex; align-items: center; padding: 6px 14px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 13px; cursor: pointer; transition: all .15s; background: transparent; }
|
|
.change-type-btn:hover { border-color: #000; background: #f5f5f5; }
|
|
.dark .change-type-btn { border-color: #404040; color: #ccc; }
|
|
.dark .change-type-btn:hover { border-color: #fff; background: #262626; color: #fff; }
|
|
</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" style="animation-delay:0ms;">
|
|
<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="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/></svg>
|
|
学籍异动申请
|
|
</h2>
|
|
<p class="text-sm text-gray-500 dark:text-gray-400 mt-1">2025-2026学年2学期的学籍异动申请</p>
|
|
</div>
|
|
<button onclick="loadData()" class="px-4 py-2 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-black/30 text-sm font-medium hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors flex items-center gap-2"><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 list-item-enter" style="animation-delay:50ms;">
|
|
<p class="text-sm font-medium text-gray-700 dark:text-gray-300 mb-3">可申请的异动类别:</p>
|
|
<div id="changeTypesContainer" class="flex flex-wrap gap-2">
|
|
<span class="text-gray-400 text-sm">加载中...</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 list-item-enter" style="animation-delay:100ms;">
|
|
<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 text-gray-700 dark:text-gray-300 whitespace-nowrap">申请状态</th>
|
|
<th class="text-left py-3 px-4 font-semibold text-gray-700 dark:text-gray-300 whitespace-nowrap">审核状态</th>
|
|
<th class="text-left py-3 px-4 font-semibold text-gray-700 dark:text-gray-300 whitespace-nowrap">异动学年</th>
|
|
<th class="text-left py-3 px-4 font-semibold text-gray-700 dark:text-gray-300 whitespace-nowrap">异动学期</th>
|
|
<th class="text-left py-3 px-4 font-semibold text-gray-700 dark:text-gray-300 whitespace-nowrap">异动类别</th>
|
|
<th class="text-left py-3 px-4 font-semibold text-gray-700 dark:text-gray-300 whitespace-nowrap">异动原因</th>
|
|
<th class="text-left py-3 px-4 font-semibold text-gray-700 dark:text-gray-300 whitespace-nowrap">申请理由</th>
|
|
<th class="text-left py-3 px-4 font-semibold text-gray-700 dark:text-gray-300 whitespace-nowrap">联系电话</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/enrollment-change');
|
|
const data = await res.json();
|
|
document.getElementById('loadingIndicator').classList.add('hidden');
|
|
if (!data.success) { showError(data.message); return; }
|
|
|
|
// 显示可申请的异动类型
|
|
const ctContainer = document.getElementById('changeTypesContainer');
|
|
if (data.change_types && data.change_types.length > 0) {
|
|
ctContainer.innerHTML = data.change_types.map(t =>
|
|
`<span class="change-type-btn">${escHtml(t.label||t.value)}</span>`
|
|
).join('');
|
|
} else {
|
|
ctContainer.innerHTML = '<span class="text-gray-400 text-sm">无非当前可申请的异动类型</span>';
|
|
}
|
|
|
|
const items = data.items || [];
|
|
if (!items.length) { document.getElementById('emptyState').classList.remove('hidden'); return; }
|
|
const tbody = document.getElementById('tableBody');
|
|
tbody.innerHTML = items.map((item, i) => {
|
|
const sqzt = item.sqztmc || item.申请状态 || '--';
|
|
const shzt = item.shztmc || item.审核状态 || '--';
|
|
const shBadge = shzt.includes('通过') ? 'badge-green' : shzt.includes('待审') ? 'badge-yellow' : 'badge-gray';
|
|
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 row-animate" style="animation-delay:${i*30}ms;">
|
|
<td class="py-3 px-4 text-xs">${escHtml(sqzt)}</td>
|
|
<td class="py-3 px-4"><span class="badge ${shBadge}">${escHtml(shzt)}</span></td>
|
|
<td class="py-3 px-4 text-xs text-gray-500">${escHtml(item.ydxn||item.异动学年||'--')}</td>
|
|
<td class="py-3 px-4 text-xs text-gray-500">${escHtml(item.ydxq||item.异动学期||'--')}</td>
|
|
<td class="py-3 px-4 text-xs">${escHtml(item.ydlbmc||item.异动类别||'--')}</td>
|
|
<td class="py-3 px-4 text-xs text-gray-500">${escHtml(item.ydyy||item.异动原因||'--')}</td>
|
|
<td class="py-3 px-4 text-xs text-gray-500 max-w-[200px] truncate">${escHtml(item.sqly||item.申请理由||'--')}</td>
|
|
<td class="py-3 px-4 text-xs">${escHtml(item.lxdh||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,'"'); }
|
|
document.addEventListener('DOMContentLoaded', () => loadData());
|
|
</script>
|
|
{% endblock %} |