35 lines
1.5 KiB
PHP
35 lines
1.5 KiB
PHP
<?php
|
|||
|
|
/**
|
||
|
|
* 首页卡片 · 纪念日(v62 新增)。
|
||
|
|
*
|
||
|
|
* 数据来自 `Anniversary::upcoming($familyId, $me, 60)`(与「纪念日」页面顶上那块**同一份**),
|
||
|
|
* 所以"首页看到的"和"点进去看到的"永远一致 —— 不要在卡片里自己再算一遍农历。
|
||
|
|
*
|
||
|
|
* ⚠️ 图标按**分类**给(v62 第 2 条):走 `AnnivIcon::svg()`,颜色跟着文字色;
|
||
|
|
* 与日历里的 emoji 是同一套 key(见 AnnivIcon 的类注释)。
|
||
|
|
*
|
||
|
|
* @var array $cardData['days'] 每项含 date/title/kind/icon/age/nth/days
|
||
|
|
*/
|
||
|
|
$annRows = (array)($cardData['days'] ?? []);
|
||
|
|
?>
|
||
|
|
<div class="hc-body">
|
||
|
|
<?php if (!$annRows): ?>
|
||
|
|
<p class="empty-hint">未来 60 天里没有纪念日。</p>
|
||
|
|
<?php else: ?>
|
||
|
|
<ul class="ann-up hc-ann">
|
||
|
|
<?php foreach ($annRows as $a): ?>
|
||
|
|
<li class="ann-up-item">
|
||
|
|
<span class="ann-days"><?= (int)$a['days'] === 0 ? '今天' : ((int)$a['days'] . ' 天后') ?></span>
|
||
|
|
<span class="ann-ic"><?= \App\AnnivIcon::svg((string)($a['icon'] ?? ''), 15) ?></span>
|
||
|
|
<span class="ann-title"><?= e((string)$a['title']) ?></span>
|
||
|
|
<?php if (($a['age'] ?? null) !== null): ?>
|
||
|
|
<span class="small muted"><?= (int)$a['age'] ?> 岁</span>
|
||
|
|
<?php elseif (($a['nth'] ?? null) !== null): ?>
|
||
|
|
<span class="small muted">第 <?= (int)$a['nth'] ?> 个</span>
|
||
|
|
<?php endif; ?>
|
||
|
|
</li>
|
||
|
|
<?php endforeach; ?>
|
||
|
|
</ul>
|
||
|
|
<?php endif; ?>
|
||
|
|
</div>
|