From ec0cae46229c582089659566f77840efd6646178 Mon Sep 17 00:00:00 2001 From: 732642856 <732642856@qq.com> Date: Thu, 11 Jun 2026 21:01:05 +0800 Subject: [PATCH] =?UTF-8?q?v6.7.3:=20Web=20Remedies+KP=20Tab=E5=AE=8C?= =?UTF-8?q?=E6=88=90=E6=B8=B2=E6=9F=93=20=E2=80=94=20=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=8F=AF=E8=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Web应用 - main.js: +renderRemediesTab() — 宝石/咒语/捐赠/Dosha卡片式展示 - main.js: +renderKPTab() — 12宫Significator+KP Sublord概览表 - 两个新Tab现在有实际内容(从API获取数据) ## 构建 - HTML 23KB | JS 327KB | 构建 2.3s --- jyotish-app/main.js | 112 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) diff --git a/jyotish-app/main.js b/jyotish-app/main.js index dac38ebe..f9c3f595 100644 --- a/jyotish-app/main.js +++ b/jyotish-app/main.js @@ -378,11 +378,123 @@ function renderAll() { renderAVPinda(pinda); renderExtraDasas(extraDasas); + // 🔥 v6.7.2: API数据渲染 Recovery & KP tabs + renderRemediesTab(chartData); + renderKPTab(chartData); + // 绑定术语 Tooltip(延迟确保所有异步渲染完成) setTimeout(() => bindTerms(document.querySelector('#page-chart')), 200); setTimeout(() => bindTerms(document.querySelector('#page-chart')), 800); } +// ============================================================================ +// Remedies Tab 渲染 +// ============================================================================ +function renderRemediesTab(chartData) { + const sec = document.getElementById('remedies-section'); + if (!sec) return; + const ext = chartData._extended; + if (!ext?.remedies) { + sec.innerHTML = '

补救建议将在API返回后展示

'; + return; + } + const { recommendations, summary } = ext.remedies; + let html = `

${summary}

`; + + // Gems + const gems = recommendations?.gems || []; + if (gems.length > 0) { + html += '

💎 宝石建议

'; + for (const g of gems.slice(0, 4)) { + html += `
+ ${g.planet}: ${g.gem}
${g.metal || ''} · ${g.finger || ''} · ${g.day || ''}
`; + } + html += '
'; + } + + // Mantras + const mantras = recommendations?.mantras || []; + if (mantras.length > 0) { + html += '

🕉️ 咒语建议

'; + for (const m of mantras.slice(0, 5)) { + html += `
+ ${m.mantra} × ${m.repetitions} — ${m.note || ''}
`; + } + } + + // Donations + const donations = recommendations?.donations || []; + if (donations.length > 0) { + html += '

🙏 捐赠建议

'; + for (const d of donations.slice(0, 3)) { + html += `
${d.note || ''}
`; + } + } + + // Dosha remedies + const dr = recommendations?.dosha_remedies || []; + if (dr.length > 0) { + html += '

⚠️ Dosha专项补救

'; + for (const d of dr) { + html += `
+ ${d.dosha}: ${d.note || ''}
`; + } + } + + sec.innerHTML = html; +} + +// ============================================================================ +// KP Tab 渲染 +// ============================================================================ +function renderKPTab(chartData) { + const sec = document.getElementById('kp-section'); + if (!sec) return; + const ext = chartData._extended; + if (!ext?.kp?.houses) { + sec.innerHTML = '

KP分析将在API返回后展示

'; + return; + } + + let html = '
'; + + // House significators + for (let h = 1; h <= 12; h++) { + const hd = ext.kp.houses[h]; + if (!hd) continue; + const sig = hd.significators || {}; + html += `
+ ${h}宫 (${hd.sign || ''})
+ A: ${(sig.A || []).join(', ') || '—'}
+ B: ${(sig.B || []).join(', ') || '—'}
+ C: ${(sig.C || []).join(', ') || '—'}
+ D: ${sig.D || '—'} +
`; + } + html += '
'; + + // KP lords summary + const planets = ext.kp.planets || {}; + if (Object.keys(planets).length > 0) { + html += '

KP Sublord 概览

'; + html += ''; + for (const [pn, pd] of Object.entries(planets).slice(0, 9)) { + const kl = pd.kp_lords || {}; + const sig = pd.significators || {}; + html += ` + + + + + + `; + } + html += '
行星Sub LordSubSub LordAB
${pn}${kl.sub_lord || '—'}${kl.sub_sub_lord || '—'}${sig.A || '—'}${sig.B || '—'}
'; + } + + sec.innerHTML = html; +} + // ============================================================================ // 星盘中心摘要构建 // ============================================================================