/* 股票池 */ let page = 1, total = 0, industries = []; async function loadIndustries() { try { const d = await api('/api/overview'); industries = d.heat.map(h => h.industry); const sel = $('#industry'); industries.forEach(i => { const o = document.createElement('option'); o.textContent = i; sel.appendChild(o); }); } catch (e) {} } async function load(p) { if (p) page = p; const q = new URLSearchParams({ keyword: $('#kw').value.trim(), industry: $('#industry').value, board: $('#board').value, rating: $('#rating').value, sort: $('#sort').value, order: $('#sort').value === 'score' ? 'desc' : 'desc', page: page, per: 20 }); try { const d = await api('/api/stocks?' + q.toString()); total = d.total; render(d.items); $('#pageInfo').textContent = `第 ${page} / ${Math.max(1, Math.ceil(total / 20))} 页 · 共 ${total} 只`; $('#stCount').textContent = `共 ${total} 只`; $('#prevBtn').disabled = page <= 1; $('#nextBtn').disabled = page * 20 >= total; } catch (e) { $('#tb').innerHTML = '