fix: 完整九维分析显示链接

This commit is contained in:
知微
2026-07-09 20:55:27 +08:00
parent 778b2137f6
commit 93dd2f8732
+25 -1
View File
@@ -287,9 +287,28 @@ function renderRec(s) {
}
// ── Watchlist Tab ──
function showFullAnalysis(code) {
const text = window._fullAnalysisMap[code] || '暂无完整分析';
const modal = document.createElement('div');
modal.id = 'analysisModal';
modal.style.cssText = 'position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.7);z-index:9999;display:flex;align-items:center;justify-content:center';
modal.innerHTML = `<div style="background:#1e293b;border:1px solid #334155;border-radius:12px;max-width:700px;width:90%;max-height:80vh;overflow-y:auto;padding:24px">
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:16px">
<span style="font-size:16px;font-weight:bold;color:#e2e8f0">📋 九维分析</span>
<span onclick="this.closest('#analysisModal').remove()" style="cursor:pointer;font-size:24px;color:#94a3b8">&times;</span>
</div>
<pre style="font-size:12px;color:#cbd5e1;line-height:1.6;white-space:pre-wrap;font-family:inherit;margin:0">${text}</pre>
</div>`;
modal.addEventListener('click', function(e) { if (e.target === this) this.remove(); });
document.body.appendChild(modal);
}
function renderWatchlist() {
const el = document.getElementById('tab-watchlist');
const stocks = watchlistData.stocks || [];
// 构建 code→full_analysis 映射
window._fullAnalysisMap = {};
stocks.forEach(s => { window._fullAnalysisMap[s.code] = s.full_analysis || ''; });
el.innerHTML = `
<div class="card overflow-hidden">
<div class="p-3 border-b border-slate-800/50 flex justify-between items-center">
@@ -321,6 +340,11 @@ function renderWatchlist() {
if (tech) detailLines.push('📊 ' + tech);
if (sector) detailLines.push('🏭 ' + sector);
const detailText = detailLines.join(' | ');
// 完整分析(点击展开)
const fullAnalysis = s.full_analysis || '';
const detailDisplay = fullAnalysis ?
detailText + '<br><span class="text-blue-400 cursor-pointer" onclick="showFullAnalysis(\'' + s.code + '\')">📋 查看完整九维分析</span>' :
detailText;
return `
<tr class="border-b border-slate-800/30 hover:bg-slate-800/20 cursor-pointer" onclick="openStock('${s.code}')">
<td class="p-3"><div class="font-medium text-white">${s.name}</div><div class="text-slate-500 text-[10px]">${s.code}</div></td>
@@ -331,7 +355,7 @@ function renderWatchlist() {
<td class="p-3 text-right"><span class="text-xs px-2 py-1 rounded ${signal.includes('买入')?'bg-green-900/50 text-green-300':signal.includes('关注')?'bg-yellow-900/50 text-yellow-300':'bg-slate-800 text-slate-400'}">${signal||'—'}</span></td>
</tr>
<tr class="border-b border-slate-800/20 hover:bg-slate-800/10 cursor-pointer" onclick="openStock('${s.code}')">
<td colspan="6" class="p-2 pl-3 text-xs text-slate-400 leading-relaxed">${detailText || '—'}</td>
<td colspan="6" class="p-2 pl-3 text-xs text-slate-400 leading-relaxed">${detailDisplay || '—'}</td>
</tr>`;
}).join('')}</tbody>
</table>