2026-09-30 00:49:53 +08:00
|
|
|
<?php
|
2026-09-30 08:13:07 +08:00
|
|
|
/**
|
2026-10-02 09:28:07 +08:00
|
|
|
* 首页 —— 一块 dashboard(用户 2026-10-01 第 13 条)。
|
2026-09-30 08:13:07 +08:00
|
|
|
*
|
2026-10-02 09:28:07 +08:00
|
|
|
* 现在首页只回答三个问题:**最近有什么事**、**手头在做什么**、**往年这时候我们在干嘛**。
|
|
|
|
|
* · 接下来的日子(两个月内的生日)
|
|
|
|
|
* · 未来七天的日程(自定义 + 观影 + 旅行 + 有截止时间的任务,一次汇总)
|
|
|
|
|
* · 进行中的任务(含已过期的待办)
|
|
|
|
|
* · 往年今日(往年的这一天看过的电影 / 走过的旅程)
|
2026-09-30 09:44:55 +08:00
|
|
|
*
|
2026-10-02 09:28:07 +08:00
|
|
|
* ⚠️ **家人卡片已经不在首页了**(用户明确要求):看人去「名册」、看关系去「家谱」,
|
|
|
|
|
* 首页留给"今天该关心什么"。统计数字仍在,因为那是唯一的全局概览。
|
|
|
|
|
*
|
|
|
|
|
* ⚠️ 标题下的那句个人口号已按用户要求撤掉(v8):hero 区只留标题与三个统计。
|
2026-09-30 08:13:07 +08:00
|
|
|
*/
|
|
|
|
|
$kinCount = count($kin);
|
2026-09-30 09:44:55 +08:00
|
|
|
// 生日事件上用简称,卡片才不会一行塞不下;长名字在详情页里出
|
|
|
|
|
$shortKind = ['id' => '身份证生日', 'solar' => '阳历生日', 'lunar' => '农历生日'];
|
2026-10-02 09:28:07 +08:00
|
|
|
$today = date('Y-m-d');
|
2026-09-30 00:49:53 +08:00
|
|
|
?>
|
|
|
|
|
<section class="hero">
|
|
|
|
|
<img class="hero-logo" src="<?= e(asset('/assets/icons/icon-192.png')) ?>" alt="">
|
2026-09-30 09:44:55 +08:00
|
|
|
<div class="hero-main">
|
2026-09-30 08:13:07 +08:00
|
|
|
<h1><?= e(\App\Auth::homeTitle()) ?></h1>
|
2026-09-30 00:49:53 +08:00
|
|
|
</div>
|
|
|
|
|
<div class="hero-stats">
|
2026-09-30 08:13:07 +08:00
|
|
|
<div class="stat"><b><?= (int)$kinCount ?></b><span>与我有关</span></div>
|
|
|
|
|
<div class="stat"><b><?= (int)$allCount ?></b><span>名册总数</span></div>
|
|
|
|
|
<div class="stat"><b><?= (int)$relCount ?></b><span>亲属连线</span></div>
|
2026-09-30 00:49:53 +08:00
|
|
|
</div>
|
2026-10-02 09:28:07 +08:00
|
|
|
<?php /* ⚠️ 这两个链接必须带上真实的 person id:曾经 layout.php 里写
|
|
|
|
|
`$me = Auth::check()` 把模板里的 $me 覆盖成布尔值,链接就变成 id=0
|
|
|
|
|
("补充亲属关系"点进去是空白页)。所以这里显式用 $meId。 */ ?>
|
|
|
|
|
<div class="hero-actions">
|
|
|
|
|
<a class="btn btn-ghost btn-sm" href="<?= e(url('people/show', ['id' => (int)$meId])) ?>">我的资料</a>
|
|
|
|
|
<a class="btn btn-ghost btn-sm" href="<?= e(url('kin')) ?>">我的家谱</a>
|
|
|
|
|
<a class="btn btn-ghost btn-sm" href="<?= e(url('people')) ?>">名册</a>
|
|
|
|
|
</div>
|
2026-09-30 00:49:53 +08:00
|
|
|
</section>
|
|
|
|
|
|
2026-10-02 09:28:07 +08:00
|
|
|
<?php /* ==================== 接下来的日子 ==================== */
|
|
|
|
|
/* ⚠️ 即使近两个月没人过生日,这一块也**照常渲染**(给空态),只是内容为空。
|
|
|
|
|
理由:dashboard 的四块是"每天要看的东西",某一块忽然整块消失会让人以为
|
|
|
|
|
功能坏了 / 数据丢了(旧版就是 `if ($birthdays)` 一省略了之)。
|
|
|
|
|
空态还能顺带告诉用户"系统在盯着生日,只是最近没有"。 */ ?>
|
|
|
|
|
<section class="section">
|
2026-09-30 00:49:53 +08:00
|
|
|
<h2 class="section-title">接下来的日子 <span class="hint">两个月内</span></h2>
|
2026-10-02 09:28:07 +08:00
|
|
|
<?php if (!$birthdays): ?>
|
|
|
|
|
<div class="card card-pad empty"><b>近两个月没有人过生日</b>等到了月份,这里会自动冒出来。</div>
|
|
|
|
|
<?php else: ?>
|
2026-09-30 00:49:53 +08:00
|
|
|
<div class="bdays">
|
|
|
|
|
<?php foreach ($birthdays as $b): ?>
|
2026-09-30 09:44:55 +08:00
|
|
|
<?php
|
|
|
|
|
// 同一个人可能出两条(农历与阳历不在同一天);落在同一天时后端已经并成一条,
|
|
|
|
|
// kinds 里会有多项 —— 这里照着列出来,用户才知道"今天过的是哪个生日"。
|
|
|
|
|
$bkinds = (array)($b['kinds'] ?? []);
|
|
|
|
|
$bwords = [];
|
|
|
|
|
foreach ($bkinds as $k) {
|
|
|
|
|
$bwords[] = $shortKind[$k] ?? (string)$k;
|
|
|
|
|
}
|
|
|
|
|
$bshown = (string)($b['shown'] ?? $b['name'] ?? '');
|
|
|
|
|
?>
|
|
|
|
|
<a class="bday" href="<?= e(url('people/show', ['id' => (int)$b['id']])) ?>">
|
2026-09-30 08:13:07 +08:00
|
|
|
<img src="<?= e(avatar_url($b['avatar'])) ?>" alt="">
|
2026-09-30 00:49:53 +08:00
|
|
|
<div>
|
2026-09-30 09:44:55 +08:00
|
|
|
<b><?= e($bshown) ?></b>
|
2026-09-30 08:13:07 +08:00
|
|
|
<?php if (!empty($b['label']) && $b['label'] !== '我'): ?>
|
|
|
|
|
<span class="badge"><?= e($b['label']) ?></span>
|
|
|
|
|
<?php endif; ?>
|
2026-09-30 00:49:53 +08:00
|
|
|
<div class="d">
|
2026-09-30 09:44:55 +08:00
|
|
|
<?php if ((int)$b['days_left'] === 0): ?>
|
2026-09-30 00:49:53 +08:00
|
|
|
就是今天,生日快乐
|
|
|
|
|
<?php else: ?>
|
|
|
|
|
还有 <?= (int)$b['days_left'] ?> 天过生日
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
</div>
|
2026-09-30 09:44:55 +08:00
|
|
|
<div class="bday-meta">
|
|
|
|
|
<span class="bday-date"><?= e((string)$b['date']) ?></span>
|
|
|
|
|
<?php foreach ($bwords as $w): ?>
|
|
|
|
|
<span class="bd-kind"><?= e($w) ?></span>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
<?php if (!empty($b['lunar_label'])): ?>
|
|
|
|
|
<span class="muted small">农历<?= e((string)$b['lunar_label']) ?></span>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
</div>
|
2026-09-30 00:49:53 +08:00
|
|
|
</div>
|
2026-09-30 09:44:55 +08:00
|
|
|
</a>
|
2026-09-30 00:49:53 +08:00
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</div>
|
2026-10-02 09:28:07 +08:00
|
|
|
<?php endif; ?>
|
2026-09-30 00:49:53 +08:00
|
|
|
</section>
|
|
|
|
|
|
2026-10-02 09:28:07 +08:00
|
|
|
<?php /* ==================== 日程(未来七天) ==================== */ ?>
|
2026-09-30 00:49:53 +08:00
|
|
|
<section class="section">
|
|
|
|
|
<div class="page-head" style="margin-bottom:12px">
|
2026-10-02 09:28:07 +08:00
|
|
|
<h1 style="font-size:15px">未来七天 <span class="sub">日程 · 观影 · 旅行 · 到期任务</span></h1>
|
2026-09-30 00:49:53 +08:00
|
|
|
<div class="actions">
|
2026-10-02 09:28:07 +08:00
|
|
|
<a class="btn btn-ghost btn-sm" href="<?= e(url('calendar')) ?>">看整月</a>
|
2026-09-30 00:49:53 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-10-02 09:28:07 +08:00
|
|
|
<?php if (!$soon): ?>
|
|
|
|
|
<div class="card card-pad empty"><b>这七天还没有安排</b>有事先记一笔,日后再翻才有得看。</div>
|
2026-09-30 00:49:53 +08:00
|
|
|
<?php else: ?>
|
2026-10-02 09:28:07 +08:00
|
|
|
<div class="card card-pad">
|
|
|
|
|
<ul class="dash-list">
|
|
|
|
|
<?php foreach ($soon as $ev): ?>
|
|
|
|
|
<li class="dash-row">
|
|
|
|
|
<span class="dash-dot" style="background: <?= e((string)$ev['color']) ?>;"></span>
|
|
|
|
|
<span class="dash-when">
|
|
|
|
|
<?= e((string)$ev['date'] === $today ? '今天' : substr((string)$ev['date'], 5)) ?>
|
|
|
|
|
<?php if (($ev['time'] ?? '') !== ''): ?><b><?= e((string)$ev['time']) ?></b><?php endif; ?>
|
|
|
|
|
</span>
|
|
|
|
|
<a class="dash-what" href="<?= e((string)$ev['href']) ?>"><?= e((string)$ev['title']) ?></a>
|
|
|
|
|
<span class="dash-tag"><?= e((string)$ev['calname']) ?></span>
|
|
|
|
|
</li>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<?php /* ==================== 进行中的任务 ==================== */ ?>
|
|
|
|
|
<section class="section">
|
|
|
|
|
<div class="page-head" style="margin-bottom:12px">
|
|
|
|
|
<h1 style="font-size:15px">手头在做 <span class="sub">进行中 · 已逾期</span></h1>
|
|
|
|
|
<div class="actions">
|
|
|
|
|
<a class="btn btn-ghost btn-sm" href="<?= e(url('tasks')) ?>">任务看板</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<?php if (!$tasks): ?>
|
|
|
|
|
<div class="card card-pad empty"><b>没有进行中的任务</b>也没有逾期的事,挺好。</div>
|
|
|
|
|
<?php else: ?>
|
|
|
|
|
<div class="card card-pad">
|
|
|
|
|
<ul class="dash-list">
|
|
|
|
|
<?php foreach ($tasks as $t): ?>
|
|
|
|
|
<?php $late = \App\Task::isOverdue($t['due_at'] ?? null); ?>
|
|
|
|
|
<li class="dash-row">
|
|
|
|
|
<span class="dash-dot" style="background: <?= e($late ? 'var(--red)' : 'var(--brand)') ?>;"></span>
|
|
|
|
|
<span class="dash-when">
|
|
|
|
|
<?php if (($t['due_at'] ?? '') !== ''): ?>
|
|
|
|
|
<?= e(\App\Task::dueWord($t['due_at'] ?? null)) ?>
|
|
|
|
|
<?php else: ?>
|
|
|
|
|
进行中
|
2026-09-30 00:49:53 +08:00
|
|
|
<?php endif; ?>
|
2026-10-02 09:28:07 +08:00
|
|
|
</span>
|
|
|
|
|
<a class="dash-what" href="<?= e(url('tasks/show', ['id' => (int)$t['id']])) ?>">
|
|
|
|
|
<?= e((string)$t['title']) ?>
|
|
|
|
|
</a>
|
|
|
|
|
<?php if ((int)($t['child_total'] ?? 0) > 0): ?>
|
|
|
|
|
<span class="dash-tag"><?= (int)$t['child_done'] ?>/<?= (int)$t['child_total'] ?></span>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
</li>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<?php /* ==================== 往年今日 ==================== */ ?>
|
|
|
|
|
<section class="section">
|
|
|
|
|
<div class="page-head" style="margin-bottom:12px">
|
|
|
|
|
<h1 style="font-size:15px">
|
|
|
|
|
<?= !empty($memories['exact']) ? '往年今日' : '往年这个月' ?>
|
|
|
|
|
<span class="sub"><?= e(date('n 月 j 日')) ?></span>
|
|
|
|
|
</h1>
|
|
|
|
|
</div>
|
|
|
|
|
<?php if (empty($memories['rows'])): ?>
|
|
|
|
|
<div class="card card-pad empty">
|
|
|
|
|
<b><?= !empty($memories['exact']) ? '往年的这一天还没有记录' : '往年的这个月还没有记录' ?></b>
|
|
|
|
|
日子还长,等有了第一次,明年这时候就会自己冒出来。
|
|
|
|
|
</div>
|
|
|
|
|
<?php else: ?>
|
|
|
|
|
<div class="card card-pad">
|
|
|
|
|
<ul class="dash-list">
|
|
|
|
|
<?php foreach ($memories['rows'] as $mm): ?>
|
|
|
|
|
<li class="dash-row">
|
|
|
|
|
<span class="dash-dot" style="background: <?= $mm['kind'] === 'trip' ? '#3F7D5A' : '#7A4E8C' ?>;"></span>
|
|
|
|
|
<span class="dash-when"><?= (int)$mm['years_ago'] ?> 年前</span>
|
|
|
|
|
<a class="dash-what" href="<?= e((string)$mm['href']) ?>">
|
|
|
|
|
<?= $mm['kind'] === 'trip' ? '🧳 ' : '🎬 ' ?><?= e((string)$mm['title']) ?>
|
|
|
|
|
</a>
|
|
|
|
|
<span class="dash-tag"><?= e(substr((string)$mm['starts_at'], 0, 10)) ?></span>
|
|
|
|
|
</li>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</ul>
|
2026-09-30 00:49:53 +08:00
|
|
|
</div>
|
|
|
|
|
<?php endif; ?>
|
2026-09-30 09:44:55 +08:00
|
|
|
</section>
|