486 lines
23 KiB
HTML
486 lines
23 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;
|
|
}
|
|
|
|
.tb-card {
|
|
transition: all 0.25s ease;
|
|
}
|
|
.tb-card:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 8px 25px rgba(0,0,0,0.08);
|
|
}
|
|
.dark .tb-card:hover {
|
|
box-shadow: 0 8px 25px rgba(0,0,0,0.4);
|
|
}
|
|
|
|
.status-badge {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.25rem;
|
|
padding: 0.125rem 0.75rem;
|
|
border-radius: 9999px;
|
|
font-size: 0.75rem;
|
|
font-weight: 600;
|
|
}
|
|
.status-ordered {
|
|
background: #d1fae5;
|
|
color: #065f46;
|
|
}
|
|
.status-unordered {
|
|
background: #fee2e2;
|
|
color: #991b1b;
|
|
}
|
|
.dark .status-ordered {
|
|
background: #064e3b;
|
|
color: #6ee7b7;
|
|
}
|
|
.dark .status-unordered {
|
|
background: #7f1d1d;
|
|
color: #fca5a5;
|
|
}
|
|
|
|
.toast-notification {
|
|
position: fixed; top: 20px; right: 20px; z-index: 9999;
|
|
transition: all 0.3s ease;
|
|
}
|
|
</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="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"/>
|
|
<path d="M8 7h8"/>
|
|
<path d="M8 11h6"/>
|
|
</svg>
|
|
教材预订
|
|
</h2>
|
|
<p class="text-sm text-gray-500 dark:text-gray-400 mt-1">管理已选课程的教材预订与退订</p>
|
|
</div>
|
|
<button onclick="refresh()"
|
|
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 flex-shrink-0">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none"
|
|
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
<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>
|
|
|
|
<!-- Toast 通知 -->
|
|
<div id="toast" class="toast-notification hidden"></div>
|
|
|
|
<!-- 筛选栏 -->
|
|
<div class="flex flex-wrap gap-3 items-center mb-4 list-item-enter" style="animation-delay: 50ms;">
|
|
<select id="filterXnm" onchange="refresh()"
|
|
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 focus:outline-none focus:ring-2 focus:ring-black dark:focus:ring-white">
|
|
<option value="">全部学年</option>
|
|
<option value="2026" selected>2026-2027</option>
|
|
<option value="2025">2025-2026</option>
|
|
<option value="2024">2024-2025</option>
|
|
</select>
|
|
<select id="filterXqm" onchange="refresh()"
|
|
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 focus:outline-none focus:ring-2 focus:ring-black dark:focus:ring-white">
|
|
<option value="">全部学期</option>
|
|
<option value="3">第1学期</option>
|
|
<option value="12">第2学期</option>
|
|
</select>
|
|
<select id="filterStatus" onchange="filterCards()"
|
|
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 focus:outline-none focus:ring-2 focus:ring-black dark:focus:ring-white">
|
|
<option value="">全部状态</option>
|
|
<option value="已订">已预订</option>
|
|
<option value="未订">未预订</option>
|
|
</select>
|
|
</div>
|
|
|
|
<!-- 图表区 -->
|
|
<div id="chartsRow" class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6 hidden list-item-enter" style="animation-delay: 120ms;">
|
|
<div class="glass rounded-2xl p-4">
|
|
<h3 class="text-sm font-semibold text-gray-600 dark:text-gray-400 mb-3">课程性质分布</h3>
|
|
<div id="courseTypeChart" class="h-64"></div>
|
|
</div>
|
|
<div class="glass rounded-2xl p-4">
|
|
<h3 class="text-sm font-semibold text-gray-600 dark:text-gray-400 mb-3">教材信息覆盖</h3>
|
|
<div id="textbookCoverageChart" class="h-64"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 统计卡片 -->
|
|
<div id="statsRow" class="grid grid-cols-2 md:grid-cols-4 gap-3 mb-4 hidden list-item-enter" style="animation-delay: 100ms;">
|
|
<div class="glass rounded-xl p-4 text-center">
|
|
<div class="text-2xl font-bold" id="statTotal">0</div>
|
|
<div class="text-xs text-gray-500 dark:text-gray-400 mt-1">总课程数</div>
|
|
</div>
|
|
<div class="glass rounded-xl p-4 text-center">
|
|
<div class="text-2xl font-bold text-green-600 dark:text-green-400" id="statOrdered">0</div>
|
|
<div class="text-xs text-gray-500 dark:text-gray-400 mt-1">已预订</div>
|
|
</div>
|
|
<div class="glass rounded-xl p-4 text-center">
|
|
<div class="text-2xl font-bold text-red-500 dark:text-red-400" id="statUnordered">0</div>
|
|
<div class="text-xs text-gray-500 dark:text-gray-400 mt-1">未预订</div>
|
|
</div>
|
|
<div class="glass rounded-xl p-4 text-center">
|
|
<div class="text-2xl font-bold text-blue-600 dark:text-blue-400" id="statHasTextbook">0</div>
|
|
<div class="text-xs text-gray-500 dark:text-gray-400 mt-1">有教材信息</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 加载提示 -->
|
|
<div id="loadingIndicator" class="text-center py-12 list-item-enter" style="animation-delay: 100ms;">
|
|
<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 list-item-enter" style="animation-delay: 100ms;">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24" fill="none"
|
|
stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"
|
|
class="mx-auto mb-4 text-red-500">
|
|
<circle cx="12" cy="12" r="10"/>
|
|
<line x1="15" y1="9" x2="9" y2="15"/>
|
|
<line x1="9" y1="9" x2="15" y2="15"/>
|
|
</svg>
|
|
<p id="errorText" class="text-gray-600 dark:text-gray-400"></p>
|
|
</div>
|
|
|
|
<!-- 教材卡片列表 -->
|
|
<div id="cardsContainer" class="hidden grid grid-cols-1 lg:grid-cols-2 gap-4 list-item-enter" style="animation-delay: 150ms;">
|
|
</div>
|
|
|
|
<!-- 空状态 -->
|
|
<div id="emptyState" class="glass rounded-2xl p-12 text-center hidden list-item-enter" style="animation-delay: 150ms;">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 24 24" fill="none"
|
|
stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"
|
|
class="mx-auto mb-4 text-gray-300 dark:text-gray-600">
|
|
<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"/>
|
|
</svg>
|
|
<p class="text-gray-500 dark:text-gray-400 text-lg">暂无教材预订信息</p>
|
|
<p class="text-gray-400 dark:text-gray-500 text-sm mt-1">当前学期可能没有选课或教材数据</p>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block extra_js %}
|
|
<script src="{{ url_for('static', filename='echarts.min.js') }}"></script>
|
|
<script>
|
|
let allItems = [];
|
|
let courseTypeChart = null;
|
|
let textbookCoverageChart = null;
|
|
|
|
function isDarkMode() { return document.documentElement.classList.contains('dark'); }
|
|
|
|
function showToast(message, type) {
|
|
const toast = document.getElementById('toast');
|
|
const colors = {
|
|
success: 'bg-green-500 text-white',
|
|
error: 'bg-red-500 text-white',
|
|
info: 'bg-blue-500 text-white',
|
|
};
|
|
toast.className = `toast-notification ${colors[type] || colors.info} px-6 py-3 rounded-lg shadow-lg text-sm font-medium`;
|
|
toast.textContent = message;
|
|
toast.classList.remove('hidden');
|
|
setTimeout(() => toast.classList.add('hidden'), 3000);
|
|
}
|
|
|
|
async function initSession() {
|
|
try {
|
|
const res = await fetch('/api/jwxt/ping');
|
|
const data = await res.json();
|
|
if (!data.success) { console.warn('Session ping 失败:', data.message); return false; }
|
|
if (data.refreshed) console.log('🔄 Session 已自动刷新');
|
|
return true;
|
|
} catch (e) { console.error('Session ping 异常:', e); return false; }
|
|
}
|
|
|
|
async function refresh() {
|
|
document.getElementById('loadingIndicator').classList.remove('hidden');
|
|
document.getElementById('errorMessage').classList.add('hidden');
|
|
document.getElementById('cardsContainer').classList.add('hidden');
|
|
document.getElementById('emptyState').classList.add('hidden');
|
|
document.getElementById('statsRow').classList.add('hidden');
|
|
document.getElementById('chartsRow').classList.add('hidden');
|
|
|
|
await initSession();
|
|
|
|
const xnm = document.getElementById('filterXnm').value;
|
|
const xqm = document.getElementById('filterXqm').value;
|
|
const params = new URLSearchParams({ page_size: 1500 });
|
|
if (xnm) params.set('xnm', xnm);
|
|
if (xqm) params.set('xqm', xqm);
|
|
|
|
try {
|
|
const res = await fetch('/api/jwxt/textbook-orders?' + params.toString());
|
|
const data = await res.json();
|
|
document.getElementById('loadingIndicator').classList.add('hidden');
|
|
|
|
if (!data.success) {
|
|
document.getElementById('errorText').textContent = data.message || '查询失败';
|
|
document.getElementById('errorMessage').classList.remove('hidden');
|
|
return;
|
|
}
|
|
|
|
allItems = data.items || [];
|
|
if (!allItems.length) {
|
|
document.getElementById('emptyState').classList.remove('hidden');
|
|
document.getElementById('chartsRow').classList.add('hidden');
|
|
return;
|
|
}
|
|
|
|
renderStats(allItems);
|
|
renderCards(allItems);
|
|
document.getElementById('cardsContainer').classList.remove('hidden');
|
|
document.getElementById('statsRow').classList.remove('hidden');
|
|
document.getElementById('chartsRow').classList.remove('hidden');
|
|
// 确保容器可见后再初始化 ECharts(避免 display:none 下 0 尺寸)
|
|
setTimeout(() => renderCharts(allItems), 50);
|
|
} catch (e) {
|
|
document.getElementById('loadingIndicator').classList.add('hidden');
|
|
document.getElementById('errorText').textContent = '网络错误: ' + e.message;
|
|
document.getElementById('errorMessage').classList.remove('hidden');
|
|
}
|
|
}
|
|
|
|
function renderStats(items) {
|
|
const total = items.length;
|
|
const ordered = items.filter(i => i.zdzt === '已订').length;
|
|
const unordered = total - ordered;
|
|
const hasTextbook = items.filter(i => i.jcxx && i.jcxx.trim()).length;
|
|
document.getElementById('statTotal').textContent = total;
|
|
document.getElementById('statOrdered').textContent = ordered;
|
|
document.getElementById('statUnordered').textContent = unordered;
|
|
document.getElementById('statHasTextbook').textContent = hasTextbook;
|
|
}
|
|
|
|
function filterCards() {
|
|
const status = document.getElementById('filterStatus').value;
|
|
if (!status) {
|
|
renderCards(allItems);
|
|
} else {
|
|
renderCards(allItems.filter(i => i.zdzt === status));
|
|
}
|
|
}
|
|
|
|
function renderCards(items) {
|
|
const container = document.getElementById('cardsContainer');
|
|
container.innerHTML = '';
|
|
|
|
items.forEach((item, idx) => {
|
|
const ordered = item.zdzt === '已订';
|
|
const statusClass = ordered ? 'status-ordered' : 'status-unordered';
|
|
const statusLabel = ordered ? '✓ 已预订' : '✗ 未预订';
|
|
|
|
const textbookInfo = item.jcxx || '';
|
|
// 解析教材信息: "书名/作者/出版社/版次"
|
|
const tbParts = textbookInfo.split('/');
|
|
const tbName = tbParts[0] || '';
|
|
const tbAuthor = tbParts[1] || '';
|
|
const tbPublisher = tbParts[2] || '';
|
|
|
|
const delay = idx * 60;
|
|
const hasTextbook = textbookInfo.trim().length > 0;
|
|
|
|
const card = document.createElement('div');
|
|
card.className = 'tb-card glass rounded-2xl p-5 row-animate';
|
|
card.style.animationDelay = delay + 'ms';
|
|
|
|
card.innerHTML = `
|
|
<div class="flex flex-col sm:flex-row sm:items-start justify-between gap-3">
|
|
<!-- 左侧信息 -->
|
|
<div class="flex-1 min-w-0">
|
|
<div class="flex items-start gap-3 mb-3">
|
|
<div class="w-10 h-10 rounded-xl bg-gray-100 dark:bg-gray-800 flex items-center justify-center flex-shrink-0">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none"
|
|
stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"
|
|
class="text-gray-600 dark:text-gray-400">
|
|
<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"/>
|
|
</svg>
|
|
</div>
|
|
<div class="min-w-0">
|
|
<h3 class="text-base font-semibold truncate">${escHtml(item.kcmc || '--')}</h3>
|
|
<div class="flex flex-wrap gap-x-4 gap-y-1 mt-1 text-xs text-gray-500 dark:text-gray-400">
|
|
<span>${escHtml(item.kcxzmc || '--')}</span>
|
|
<span>${escHtml(item.jsxx || '--')}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="grid grid-cols-2 sm:grid-cols-3 gap-3">
|
|
<div>
|
|
<div class="text-xs text-gray-400 dark:text-gray-500 mb-0.5">上课地点</div>
|
|
<div class="text-sm font-medium truncate">${escHtml(item.jxdd || '--')}</div>
|
|
</div>
|
|
<div>
|
|
<div class="text-xs text-gray-400 dark:text-gray-500 mb-0.5">选课时间</div>
|
|
<div class="text-sm font-medium">${item.xksj || '--'}</div>
|
|
</div>
|
|
<div>
|
|
<div class="text-xs text-gray-400 dark:text-gray-500 mb-0.5">预订时间</div>
|
|
<div class="text-sm font-medium">${item.jcydsj || '--'}</div>
|
|
</div>
|
|
</div>
|
|
|
|
${hasTextbook ? `
|
|
<div class="mt-3 pt-3 border-t border-gray-100 dark:border-gray-800">
|
|
<div class="text-xs text-gray-400 dark:text-gray-500 mb-1">教材信息</div>
|
|
<div class="text-sm text-gray-700 dark:text-gray-300">
|
|
<span class="font-medium">${escHtml(tbName)}</span>
|
|
${tbAuthor ? `<span class="text-gray-400 mx-1">/</span><span class="text-gray-500 dark:text-gray-400 text-xs">${escHtml(tbAuthor)}</span>` : ''}
|
|
${tbPublisher ? `<span class="text-gray-400 mx-1">/</span><span class="text-gray-500 dark:text-gray-400 text-xs">${escHtml(tbPublisher)}</span>` : ''}
|
|
</div>
|
|
</div>
|
|
` : ''}
|
|
</div>
|
|
|
|
<!-- 右侧操作区域 -->
|
|
<div class="flex sm:flex-col items-center sm:items-end gap-3 sm:gap-2 flex-shrink-0">
|
|
<span class="status-badge ${statusClass}">${statusLabel}</span>
|
|
${ordered
|
|
? `<button onclick="toggleOrder('${item.jxb_id}', 'cancel')" class="px-4 py-1.5 rounded-lg text-xs font-medium border border-orange-300 dark:border-orange-700 text-orange-600 dark:text-orange-400 hover:bg-orange-50 dark:hover:bg-orange-900/30 transition-colors whitespace-nowrap">退订</button>`
|
|
: `<button onclick="toggleOrder('${item.jxb_id}', 'order')" class="px-4 py-1.5 rounded-lg text-xs font-medium bg-blue-500 text-white hover:bg-blue-600 transition-colors whitespace-nowrap">预订</button>`
|
|
}
|
|
</div>
|
|
</div>
|
|
`;
|
|
container.appendChild(card);
|
|
});
|
|
}
|
|
|
|
function escHtml(str) {
|
|
return String(str).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"');
|
|
}
|
|
|
|
async function toggleOrder(jxbId, action) {
|
|
const actionName = action === 'order' ? '预订' : '退订';
|
|
if (!confirm(`确定${actionName}该课程的教材吗?`)) return;
|
|
|
|
try {
|
|
const res = await fetch('/api/jwxt/textbook-order', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ jxb_id: jxbId, action: action }),
|
|
});
|
|
const data = await res.json();
|
|
if (data.success) {
|
|
showToast(data.message || `${actionName}成功`, 'success');
|
|
refresh();
|
|
} else {
|
|
showToast(data.message || `${actionName}失败`, 'error');
|
|
}
|
|
} catch (e) {
|
|
showToast('网络错误: ' + e.message, 'error');
|
|
}
|
|
}
|
|
|
|
// ── ECharts 图表渲染 ──
|
|
|
|
function renderCharts(items) {
|
|
renderCourseTypeChart(items);
|
|
renderTextbookCoverageChart(items);
|
|
setupDarkObserver(items);
|
|
}
|
|
|
|
function renderCourseTypeChart(items) {
|
|
const dom = document.getElementById('courseTypeChart');
|
|
if (!dom) return;
|
|
if (courseTypeChart) courseTypeChart.dispose();
|
|
|
|
const counts = {};
|
|
items.forEach(it => {
|
|
const k = it.kcxzmc || '其他';
|
|
counts[k] = (counts[k] || 0) + 1;
|
|
});
|
|
const entries = Object.entries(counts).sort((a, b) => b[1] - a[1]);
|
|
|
|
const dark = isDarkMode();
|
|
const colors = dark
|
|
? ['#60a5fa', '#34d399', '#fbbf24', '#f87171', '#a78bfa', '#f472b6', '#38bdf8']
|
|
: ['#3b82f6', '#10b981', '#f59e0b', '#ef4444', '#8b5cf6', '#ec4899', '#0ea5e9'];
|
|
|
|
courseTypeChart = echarts.init(dom);
|
|
courseTypeChart.setOption({
|
|
tooltip: { trigger: 'item', formatter: '{b}: {c} 门 ({d}%)' },
|
|
legend: { bottom: 0, type: 'scroll', textStyle: { fontSize: 11, color: dark ? '#d1d5db' : '#374151' } },
|
|
series: [{
|
|
type: 'pie', radius: ['40%', '70%'], center: ['50%', '45%'],
|
|
itemStyle: { borderRadius: 4, borderColor: dark ? '#1f2937' : '#fff', borderWidth: 2 },
|
|
label: { fontSize: 11, color: dark ? '#d1d5db' : '#374151' },
|
|
data: entries.map(([name, value], i) => ({ name, value, itemStyle: { color: colors[i % colors.length] } }))
|
|
}]
|
|
}, true);
|
|
}
|
|
|
|
function renderTextbookCoverageChart(items) {
|
|
const dom = document.getElementById('textbookCoverageChart');
|
|
if (!dom) return;
|
|
if (textbookCoverageChart) textbookCoverageChart.dispose();
|
|
|
|
const has = items.filter(i => i.jcxx && i.jcxx.trim()).length;
|
|
const none = items.length - has;
|
|
|
|
const dark = isDarkMode();
|
|
const colors = dark ? ['#34d399', '#6b7280'] : ['#10b981', '#9ca3af'];
|
|
|
|
textbookCoverageChart = echarts.init(dom);
|
|
textbookCoverageChart.setOption({
|
|
tooltip: { trigger: 'item', formatter: '{b}: {c} 门 ({d}%)' },
|
|
legend: { bottom: 0, textStyle: { fontSize: 11, color: dark ? '#d1d5db' : '#374151' } },
|
|
series: [{
|
|
type: 'pie', radius: ['45%', '70%'], center: ['50%', '45%'],
|
|
itemStyle: { borderRadius: 4, borderColor: dark ? '#1f2937' : '#fff', borderWidth: 2 },
|
|
label: { fontSize: 11, color: dark ? '#d1d5db' : '#374151' },
|
|
data: [
|
|
{ name: '有教材信息', value: has, itemStyle: { color: colors[0] } },
|
|
{ name: '无教材信息', value: none, itemStyle: { color: colors[1] } }
|
|
]
|
|
}]
|
|
}, true);
|
|
}
|
|
|
|
// ── 深色模式观察 ──
|
|
let _darkObserverTextbook = null;
|
|
function setupDarkObserver(items) {
|
|
if (_darkObserverTextbook) _darkObserverTextbook.disconnect();
|
|
_darkObserverTextbook = new MutationObserver(() => {
|
|
if (courseTypeChart) { courseTypeChart.dispose(); courseTypeChart = null; }
|
|
if (textbookCoverageChart) { textbookCoverageChart.dispose(); textbookCoverageChart = null; }
|
|
renderCharts(items);
|
|
});
|
|
_darkObserverTextbook.observe(document.documentElement, { attributes: true, attributeFilter: ['class'] });
|
|
}
|
|
|
|
window.addEventListener('resize', () => {
|
|
courseTypeChart?.resize();
|
|
textbookCoverageChart?.resize();
|
|
});
|
|
|
|
// 初始化
|
|
initSession().then(sessionOk => {
|
|
if (!sessionOk) {
|
|
document.getElementById('errorText').innerHTML = '教务系统 Session 已失效,请尝试<a href="/dashboard" class="underline">重新配置教务账号</a>';
|
|
document.getElementById('errorMessage').classList.remove('hidden');
|
|
return;
|
|
}
|
|
refresh();
|
|
});
|
|
</script>
|
|
{% endblock %}
|