fix: 说明/仓位列错位纠正+说明改模态框展示(替代alert)
This commit is contained in:
+25
-4
@@ -1975,9 +1975,30 @@ const ASC_DEFAULT = new Set(['max_dd']); // 回撤类:小=好,默认升序
|
||||
function showDesc(version) {
|
||||
const s = (window._strats || []).find(x => x.version === version);
|
||||
const d = s && s.description;
|
||||
if (!d || !d.title) return alert('暂无说明');
|
||||
const text = `【${d.title}】\n\n【算法】${d.algorithm || ''}\n\n【思路】${d.rationale || ''}\n\n【证据】${d.evidence || ''}`;
|
||||
alert(text);
|
||||
if (!d || !d.title) { showToast('暂无说明'); return; }
|
||||
const modal = document.createElement('div');
|
||||
modal.className = 'fixed inset-0 z-50 flex items-center justify-center bg-black/70 backdrop-blur-sm';
|
||||
modal.onclick = () => modal.remove();
|
||||
modal.innerHTML = `
|
||||
<div class="bg-slate-900 border border-slate-700 rounded-xl max-w-2xl w-full mx-4 p-6 shadow-2xl" onclick="event.stopPropagation()">
|
||||
<div class="flex items-start justify-between mb-4">
|
||||
<h3 class="text-lg font-bold text-blue-300">${d.title}</h3>
|
||||
<button onclick="this.closest('.fixed').remove()" class="text-slate-500 hover:text-white text-xl leading-none">×</button>
|
||||
</div>
|
||||
<div class="space-y-4 text-sm text-slate-300">
|
||||
<div><div class="text-xs font-semibold text-blue-400 mb-1">算法</div><p class="leading-relaxed">${d.algorithm || ''}</p></div>
|
||||
<div><div class="text-xs font-semibold text-blue-400 mb-1">思路</div><p class="leading-relaxed">${d.rationale || ''}</p></div>
|
||||
<div><div class="text-xs font-semibold text-blue-400 mb-1">证据</div><p class="leading-relaxed">${d.evidence || ''}</p></div>
|
||||
</div>
|
||||
</div>`;
|
||||
document.body.appendChild(modal);
|
||||
}
|
||||
function showToast(msg) {
|
||||
const t = document.createElement('div');
|
||||
t.className = 'fixed top-4 right-4 z-50 bg-slate-800 border border-slate-600 rounded-lg px-4 py-2 text-sm text-slate-200 shadow-lg';
|
||||
t.textContent = msg;
|
||||
document.body.appendChild(t);
|
||||
setTimeout(() => t.remove(), 2000);
|
||||
}
|
||||
|
||||
function sortBy(key) {
|
||||
@@ -2132,8 +2153,8 @@ function renderStrategyTable(strategies) {
|
||||
html += '<tr class="' + rowCls + '" onclick="showStrategyDetail(\'' + s.version + '\')">' +
|
||||
'<td class="px-2 py-1.5 font-mono font-bold ' + (isCurrent ? 'text-emerald-400' : 'text-blue-400') + '">' + s.version + (isCurrent ? ' <span class="text-[10px] bg-emerald-500/20 text-emerald-300 px-1 rounded">当前</span>' : '') + ((s.market && s.market !== 'all') ? ' <span class="text-[10px] bg-cyan-500/20 text-cyan-300 px-1 rounded">' + (s.market === 'hk' ? '港' : 'A') + '</span>' : '') + '</td>' +
|
||||
'<td class="px-2 py-1.5" title="' + (s.hypothesis || s.summary || '').replace(/"/g, '"') + '">' + (s.name || '') + (smallSample ? ' <span class="text-amber-500" title="样本<40笔">⚠️</span>' : '') + '</td>' +
|
||||
'<td class="text-center px-2 py-1.5">' + ((s.description && s.description.title) ? '<button onclick="event.stopPropagation();showDesc(\'' + s.version + '\')" class="text-blue-400 hover:text-blue-300" title="查看策略说明">📖</button>' : '<span class="text-slate-700">—</span>') + '</td>' +
|
||||
'<td class="text-center px-2 py-1.5 font-mono text-cyan-300">' + (st.sizing_slots ? st.sizing_slots + '仓' : '10仓') + '</td>' +
|
||||
'<td class="text-center px-2 py-1.5">' + ((s.description && s.description.title) ? '<button onclick="event.stopPropagation();showDesc(\'' + s.version + '\')" class="text-blue-400 hover:text-blue-300" title="查看策略说明">📖</button>' : '<span class="text-slate-700">—</span>') + '</td>' +
|
||||
cell('composite', s._composite, v => v + (s._confidence != null && s._confidence < 1 ? '<span class="text-slate-500 text-[10px]">×' + s._confidence.toFixed(2) + '</span>' : ''), 'font-bold text-amber-300') +
|
||||
cell('universality_score', (st.universality || {}).score, v => v + '<span class="text-slate-500">/' + (st.universality || {}).months + '月</span>') +
|
||||
cell('full_return_pct', (st.portfolio_full || {}).total_return_pct, v => v + '%' + ((st.portfolio_full||{}).std ? '<span class="text-slate-500 text-[10px]">±' + (st.portfolio_full||{}).std + '</span>' : ''), 'font-bold text-amber-300') +
|
||||
|
||||
Reference in New Issue
Block a user