feat(首页头图): 点星座小牌弹出星座宝宝——幸运色、性格、可能喜欢的职业,交界可切换 (v26100425)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-04 08:44:28 +00:00
parent d01a617ec5
commit 038207d585
4 changed files with 140 additions and 4 deletions

View File

@@ -78,6 +78,9 @@
const zEl = document.createElement('span');
zEl.className = 'hero-zod'; zEl.setAttribute('aria-hidden', 'true');
box.appendChild(zEl);
zEl.setAttribute('role', 'button'); zEl.removeAttribute('aria-hidden');
let zNames = [];
zEl.addEventListener('click', e => { e.stopPropagation(); if (zNames.length) window.dispatchEvent(new CustomEvent('mb-zodiac', { detail: { names: zNames } })); });
function renderZod(d) {
const due = d && !d.empty && !d.postpartum && d.due;
if (!due) { zEl.classList.remove('is-on'); return; }
@@ -86,6 +89,8 @@
// 图标用自绘四角星:星座符号(♋ 之类)在部分安卓上没有字形,会显示成方框
zEl.innerHTML = '<i><svg viewBox="0 0 12 12" width="8" height="8"><path d="M6 .6c.4 2.9 1.5 4 4.4 4.4v.1C7.5 5.5 6.4 6.6 6 9.4h-.1C5.5 6.6 4.4 5.5 1.6 5.1V5C4.4 4.6 5.5 3.5 5.9.6z" fill="currentColor"/></svg></i>' +
'<b>' + pair.map(x => x[2]).join('·') + '宝宝</b>';
zNames = pair.map(x => x[2]);
zEl.setAttribute('aria-label', zNames.join('·') + '宝宝,点开看看');
zEl.classList.add('is-on');
}
function onPreg(d) { show(stageOf(force != null ? +force : (d && d.week))); renderZod(d); }