用户 2026-10-03 提的四条:
① 家谱卡片重做
· 去掉「⇄ 姻亲」按钮,改成**每个人**卡片右下角都有「以 TA 为中心」
(点了以他重画一张家谱,涵盖原来的姻亲场景)。
· 头像外框改**长方形**(96×72,宽度贴合头像),object-fit: contain 不裁切,
姓名/称呼在头像下方。
· 修「点右下角按钮误进成员页」:卡片不再整张是 <a>,
只有姓名是链接,右下角是独立的 <button>(物理上分开,不抢点击)。
② 家谱文案与按钮清理
· 去掉副标题与下方图例说明;整块去掉「看全部 / 回到我 / 回到我的家谱」
(顺带消掉"出现两个回到我的家谱")。镜头由库自动 fit,拖拽/滚轮即可。
③ 首页控制台
· 标题下显示个人 slogan;去掉右侧三个统计;「我的资料/我的家谱」换成图标按钮;
去掉与导航条重复的「名册」按钮。
· 去掉「接下来的日子」(生日归到"未来七天"里,不再重复)。
· 新增统计信息块:按时段随机问候 + 今日天气(Open-Meteo,免 key,可留空不显示)
+ 近七天日程/待办/逾期数。
· 新增各模块小结卡(任务/日程/纪念日/观影/旅程/财务/名册/家谱/资源)。
· 个人设置新增「首页上的模块」:可勾选与拖动排序(每人一份,存 user_settings)。
· 保留「往年的今天」。
④ 名册改列表
· 卡片网格 → **竖向列表**:左头像、中间姓名+与我的关系+手机号+生日。
· 修拖动「只能往后不能往前」:落点改为显式记录"插到谁前面/后面",
并排除被拖元素自身。
· 去掉那句拖动提示(能力保留)。
· 搜索新增**姓名首字母**检索(y / yy / yyq 都命中「杨永全」):
新 app/Pinyin.php,intl 优先 + 内置常用字表兜底(本地无 intl 也能测);
纯字母/数字查询词不走 SQL LIKE(拼音与加密手机号在库里都比不了)。
附带上两轮的收尾:
· 菜单点外部自动关闭(全局事件委托,覆盖所有 details.menu)。
· 旅程 is_public:列表与日历只显示公开的;详情页不拦(不丢数据)。
· 重复日程:新 app/Repeat.php(RRULE 解析/生成/展开,含"工作日"),
新表 calendar_event_skips(RFC 的 EXDATE);日历按规则展开;
编辑支持三档「全部 / 这一次及以后 / 仅此一次」。
· 结束时间可添加/去掉,并随开始时间联动。
验证:端到端 772 项通过 / 0 失败;几何 368、交互 97、移动端 516、家谱 26、
升级 123 全绿;SQL 列名静态校验 0 处可疑;部署 11 条线上探针全过。
136 lines
5.9 KiB
PHP
136 lines
5.9 KiB
PHP
<?php
|
|
/**
|
|
* 记一趟旅程 / 编辑旅程(v12)。
|
|
*
|
|
* 字段分两组:
|
|
* · 骨架(落在 events 上):标题 / 出发 / 回来 / 目的地 / 备注 —— 与观影同一套原语;
|
|
* · 旅程特有(落在 trip_details 上):封面图 + 一段话小结。
|
|
*
|
|
* ⚠️ 同行的人用多选框(人不多,一次性列全比"搜索+联想"快);
|
|
* 显示名一律是「我叫他什么」(person_name),提交的是 person_id。
|
|
*/
|
|
$isEdit = !empty($t);
|
|
$canWrite = \App\Auth::canWrite();
|
|
$selIds = [];
|
|
if ($isEdit) {
|
|
foreach ((array)($t['attendees'] ?? []) as $a) {
|
|
$selIds[] = (int)$a['id'];
|
|
}
|
|
} else {
|
|
$selIds = array_map('intval', (array)($presetAttendees ?? []));
|
|
}
|
|
?>
|
|
<div class="page-head">
|
|
<h1><?= $isEdit ? '编辑旅程' : '记一趟旅程' ?></h1>
|
|
<div class="actions">
|
|
<a class="btn btn-ghost"
|
|
href="<?= e($isEdit ? url('trips/show', ['id' => (int)$t['id']]) : url('trips')) ?>">返回旅程</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card card-pad">
|
|
<form method="post" enctype="multipart/form-data"
|
|
action="<?= e(url($isEdit ? 'trips/update' : 'trips/create')) ?>">
|
|
<?= csrf_field() ?>
|
|
<?php if ($isEdit): ?>
|
|
<input type="hidden" name="id" value="<?= (int)$t['id'] ?>">
|
|
<?php endif; ?>
|
|
|
|
<div class="form-grid">
|
|
<div class="field full">
|
|
<label for="t-title">这趟旅程叫什么 *</label>
|
|
<input class="input" id="t-title" name="title" required
|
|
value="<?= e(old('title', $t['title'] ?? '')) ?>" placeholder="如:青岛三日 · 暑假">
|
|
<?php if (!empty($errors['title'])): ?><span class="err"><?= e($errors['title']) ?></span><?php endif; ?>
|
|
</div>
|
|
|
|
<div class="field">
|
|
<label for="t-start">出发</label>
|
|
<?php $dtName = 'starts_at'; $dtValue = $t['starts_at'] ?? '';
|
|
$dtId = 't-start'; $dtSeconds = true; require __DIR__ . '/../_datetime.php'; ?>
|
|
<?php if (!empty($errors['starts_at'])): ?><span class="err"><?= e($errors['starts_at']) ?></span><?php endif; ?>
|
|
</div>
|
|
|
|
<div class="field">
|
|
<label for="t-end">回来</label>
|
|
<?php $dtName = 'ends_at'; $dtValue = $t['ends_at'] ?? ''; $dtId = 't-end'; $dtSeconds = true;
|
|
require __DIR__ . '/../_datetime.php'; ?>
|
|
<?php if (!empty($errors['ends_at'])): ?><span class="err"><?= e($errors['ends_at']) ?></span><?php endif; ?>
|
|
</div>
|
|
|
|
<div class="field full">
|
|
<label for="t-loc">目的地</label>
|
|
<input class="input" id="t-loc" name="location"
|
|
value="<?= e(old('location', $t['location'] ?? '')) ?>" placeholder="如:青岛">
|
|
</div>
|
|
|
|
<div class="field full">
|
|
<label for="t-sum">一句话小结</label>
|
|
<textarea class="input" id="t-sum" name="summary" rows="3"
|
|
placeholder="回看时最能勾起记忆的那一句"><?= e(old('summary', $t['summary'] ?? '')) ?></textarea>
|
|
</div>
|
|
|
|
<div class="field full">
|
|
<label for="t-note">备注</label>
|
|
<textarea class="input" id="t-note" name="note" rows="3"><?= e(old('note', $t['note'] ?? '')) ?></textarea>
|
|
</div>
|
|
|
|
<?php /* 用户 2026-10-03 第 4 条:旅程列表只显示公开的(is_public=1)。
|
|
默认**勾上**(公开)—— 新建一趟行程却默认藏起来是反直觉的;
|
|
编辑时按库里的值回填,老数据 COALESCE 成 1 也是勾上。
|
|
⚠️ 提交的是 `is_public=1`,不勾则完全不提交这个键,
|
|
saveDetails 里 `!empty($d['is_public'])` 自然得到 0。 */ ?>
|
|
<?php $isPub = old('is_public', (string)($t['is_public'] ?? 1)) !== '0'; ?>
|
|
<div class="field full">
|
|
<label>公开</label>
|
|
<label class="chk-inline">
|
|
<?php /* ⚠️ 先放一个 hidden=0:不勾选时提交的就是"明确的不公开",
|
|
而不是"这个字段没出现" —— 后者会被当成"没传"而默认公开,
|
|
于是"取消勾选"看起来毫无作用(经典 checkbox 陷阱)。 */ ?>
|
|
<input type="hidden" name="is_public" value="0">
|
|
<input type="checkbox" name="is_public" value="1" <?= $isPub ? 'checked' : '' ?>>
|
|
<span>在旅程列表与日历里显示这趟行程</span>
|
|
</label>
|
|
<span class="tip">不勾 = 只留着自己看:不进列表、不上日历,但有链接仍能打开。</span>
|
|
</div>
|
|
|
|
<div class="field full">
|
|
<label>同行的人</label>
|
|
<?php /* v24 第 11 条:与全局选人组件统一(原来是平铺的 checkbox 网格,
|
|
名册一多就变成"在一长串里瞪眼找",也搜不了拼音) */ ?>
|
|
<?php if (!$people): ?>
|
|
<p class="empty-hint">名册里还没有人。</p>
|
|
<?php else: ?>
|
|
<?php
|
|
$ppName = 'attendees[]';
|
|
$ppPeople = $people;
|
|
$ppSelected = $selIds;
|
|
$ppMode = 'multi';
|
|
$ppOpenBtn = '+ 添加同行人';
|
|
$ppTitle = '选择同行的人';
|
|
$ppTip = '';
|
|
require __DIR__ . '/../_person_picker.php';
|
|
?>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<div class="field full">
|
|
<label for="t-cover">封面图</label>
|
|
<?php if ($isEdit && !empty($t['cover_key'])): ?>
|
|
<div class="cover-now">
|
|
<img src="<?= e(media_url((string)$t['cover_key'])) ?>" alt="">
|
|
<span class="tip">不换图就不用管这里;选一张新图会替换它。</span>
|
|
</div>
|
|
<?php endif; ?>
|
|
<input class="input" type="file" id="t-cover" name="cover" accept="image/*">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="btn-row">
|
|
<button class="btn" type="submit"><?= $isEdit ? '保存' : '记下来' ?></button>
|
|
<a class="btn btn-ghost"
|
|
href="<?= e($isEdit ? url('trips/show', ['id' => (int)$t['id']]) : url('trips')) ?>">取消</a>
|
|
</div>
|
|
</form>
|
|
</div>
|