2026-10-19 12:51:17 +08:00
|
|
|
|
<?php
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 首页卡片 · 概述(v62 从 templates/home.php 拆出来的)。
|
|
|
|
|
|
*
|
|
|
|
|
|
* 内容与 v24 第 24 批 用户第 2 条完全一致(问候 → 日期/星期/农历 → 日子标记 →
|
|
|
|
|
|
* 今日数字 | 右侧彩色天气图标 + 温度/风力 + 地址),只换了外壳:
|
|
|
|
|
|
* 以前是 `section.section > div.card.home-brief`,现在是卡片的 `.hc-body`。
|
|
|
|
|
|
*
|
|
|
|
|
|
* ⚠️ 这块**永远是横贯的**(默认 8 宽):它是"首页第一眼",被挤成一半宽就会折行折得很碎。
|
|
|
|
|
|
* ⚠️ 用到的变量都由 home 路由传进来($hbPart 除外,这里自己按时段算)。
|
|
|
|
|
|
*/
|
|
|
|
|
|
$hbPart = '你好';
|
|
|
|
|
|
$hbH = (int)date('G');
|
|
|
|
|
|
if ($hbH < 5) { $hbPart = '夜深了'; }
|
|
|
|
|
|
elseif ($hbH < 11) { $hbPart = '早上好'; }
|
|
|
|
|
|
elseif ($hbH < 13) { $hbPart = '中午好'; }
|
|
|
|
|
|
elseif ($hbH < 18) { $hbPart = '下午好'; }
|
|
|
|
|
|
else { $hbPart = '晚上好'; }
|
|
|
|
|
|
|
|
|
|
|
|
$nDoing = 0;
|
|
|
|
|
|
$nTodo = 0;
|
|
|
|
|
|
foreach (($tasks ?? []) as $__t) {
|
|
|
|
|
|
if ((string)($__t['status'] ?? 'todo') === 'doing') {
|
|
|
|
|
|
$nDoing++;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$nTodo++;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
?>
|
|
|
|
|
|
<div class="hc-body home-brief">
|
|
|
|
|
|
<div class="hb-left">
|
|
|
|
|
|
<div class="hb-hello">
|
|
|
|
|
|
<b><?= e($hbPart) ?></b><?php if (trim((string)($meName ?? '')) !== ''): ?>,<?= e((string)$meName) ?><?php endif; ?>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="hb-date">
|
|
|
|
|
|
<span class="hb-d"><?= e((string)($todayLabel ?? date('n 月 j 日'))) ?></span>
|
|
|
|
|
|
<span class="hb-w"><?= e((string)($weekday ?? '')) ?></span>
|
|
|
|
|
|
<?php if (($lunarShort ?? '') !== ''): ?>
|
|
|
|
|
|
<span class="hb-lunar" title="<?= e((string)($lunarLine ?? '')) ?>"><?= e((string)$lunarShort) ?></span>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<?php if (!empty($todayMarks['tags'])): ?>
|
|
|
|
|
|
<div class="hb-marks">
|
|
|
|
|
|
<?php foreach ($todayMarks['tags'] as $mk): ?>
|
|
|
|
|
|
<span class="hb-mark is-<?= e((string)$mk['kind']) ?>"><?= e((string)$mk['word']) ?></span>
|
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
<div class="hb-stats">
|
|
|
|
|
|
<a class="hbs" href="<?= e(url('calendar')) ?>">
|
|
|
|
|
|
<b><?= count($todayEvents ?? []) ?></b> 条日程(今天)
|
|
|
|
|
|
</a>
|
|
|
|
|
|
<?php /* 两个数字与右侧「近期任务」卡片**同源**(同一个 $tasks 数组),
|
2026-10-28 18:13:49 +08:00
|
|
|
|
「在做」与「待办」按状态拆开数 —— 见 v53 第 2 条那条注释。
|
|
|
|
|
|
🔴 工单 #20:`data-hbs` 是给首页脚本定位用的 —— 勾完成一条任务后,
|
|
|
|
|
|
这两个数字要跟着减 1(否则与列表自相矛盾)。
|
|
|
|
|
|
⚠️ 不能让脚本去匹配中文「件在做」:文案改一个字就失效,
|
|
|
|
|
|
而且这里是 JS 会读的钩子,写成文案匹配等于把展示文案变成接口。 */ ?>
|
|
|
|
|
|
<a class="hbs" data-hbs="doing" href="<?= e(url('tasks')) ?>" title="近期任务(进行中)">
|
2026-10-19 12:51:17 +08:00
|
|
|
|
<b><?= $nDoing ?></b> 件在做
|
|
|
|
|
|
</a>
|
|
|
|
|
|
<?php if ($nTodo > 0): ?>
|
2026-10-28 18:13:49 +08:00
|
|
|
|
<a class="hbs" data-hbs="todo" href="<?= e(url('tasks')) ?>" title="记下来了、还没动手的那些">
|
2026-10-19 12:51:17 +08:00
|
|
|
|
<b><?= $nTodo ?></b> 件待办
|
|
|
|
|
|
</a>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
<?php if ((int)($stat7['overdue'] ?? 0) > 0): ?>
|
|
|
|
|
|
<a class="hbs is-late" href="<?= e(url('tasks')) ?>">
|
|
|
|
|
|
<b><?= (int)$stat7['overdue'] ?></b> 件逾期
|
|
|
|
|
|
</a>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<?php if (!empty($weather)): ?>
|
|
|
|
|
|
<div class="hb-weather is-<?= e((string)($weather['tone'] ?? 'cloud')) ?>">
|
|
|
|
|
|
<span class="hbw-icon" aria-hidden="true"><?= e((string)($weather['icon'] ?? '')) ?></span>
|
|
|
|
|
|
<div class="hbw-main">
|
|
|
|
|
|
<div class="hbw-temp"><?= e((string)($weather['temp'] ?? '')) ?></div>
|
|
|
|
|
|
<div class="hbw-text"><?= e((string)($weather['text'] ?? '')) ?></div>
|
|
|
|
|
|
<?php if (($weather['wind'] ?? '') !== ''): ?>
|
|
|
|
|
|
<div class="hbw-wind">
|
|
|
|
|
|
<?= $weather['wdir'] !== '' ? e((string)$weather['wdir']) . ' ' : '' ?><?= e((string)$weather['wind']) ?>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<?php if (($weather['place'] ?? '') !== ''): ?>
|
|
|
|
|
|
<div class="hbw-place"><?= e((string)$weather['place']) ?></div>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
</div>
|