2026-10-02 09:28:07 +08:00
|
|
|
<?php
|
|
|
|
|
/**
|
2026-10-05 13:26:49 +08:00
|
|
|
* 旅程列表(v12 建立;v24 第 16 批 第 9 条把术语**固定下来**)。
|
2026-10-02 09:28:07 +08:00
|
|
|
*
|
2026-10-05 13:26:49 +08:00
|
|
|
* ⚠️ 术语(用户第 9 条原话):「活动都改名吧,改成旅程,新建旅程,旅程包含行程,
|
|
|
|
|
* 这个名字就固定下来。」
|
|
|
|
|
* → **旅程** = 这一页列的东西(容器);**行程** = 旅程里面的一段一段。
|
|
|
|
|
* (第 15 批曾把容器叫"活动",本次按用户要求改成"旅程"。)
|
2026-10-05 10:58:17 +08:00
|
|
|
*
|
2026-10-05 13:26:49 +08:00
|
|
|
* 时间与城市都是从各段**行程**派生出来的(第 15 批第 2 条)——
|
|
|
|
|
* 列表里读的是 Trip::attachDerived() 挂上来的值,不是旅程自己的字段。
|
2026-10-02 09:28:07 +08:00
|
|
|
*/
|
|
|
|
|
$canWrite = \App\Auth::canWrite();
|
|
|
|
|
?>
|
|
|
|
|
<div class="page-head">
|
2026-10-05 13:26:49 +08:00
|
|
|
<h1>旅程</h1>
|
2026-10-05 10:58:17 +08:00
|
|
|
<?php /* 导航条上这个模块仍叫「旅程」(用户就是这么称呼它的),
|
|
|
|
|
但这一页列的顶层单位是**活动** —— 一句副标题把两级关系说清楚,
|
|
|
|
|
否则"导航写旅程、页面写活动"会让人以为点错了地方。 */ ?>
|
2026-10-05 13:26:49 +08:00
|
|
|
<span class="sub">共 <?= (int)$total ?> 个 · 每个旅程里可以有若干段行程</span>
|
2026-10-02 09:28:07 +08:00
|
|
|
<div class="actions">
|
|
|
|
|
<?php if ($canWrite): ?>
|
2026-10-05 13:26:49 +08:00
|
|
|
<a class="btn" href="<?= e(url('trips/new')) ?>">新建旅程</a>
|
2026-10-02 09:28:07 +08:00
|
|
|
<?php else: ?>
|
|
|
|
|
<span class="link-quiet">只读账号</span>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<form class="search" method="get" action="index.php">
|
|
|
|
|
<input type="hidden" name="r" value="trips">
|
2026-10-05 13:26:49 +08:00
|
|
|
<input class="input" type="text" name="keyword" value="<?= e($keyword) ?>" placeholder="搜旅程名 / 去过的城市">
|
2026-10-02 09:28:07 +08:00
|
|
|
<button class="btn" type="submit">搜索</button>
|
|
|
|
|
<?php if ($keyword !== ''): ?>
|
|
|
|
|
<a class="search-clear" href="<?= e(url('trips')) ?>">清除</a>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
</form>
|
|
|
|
|
|
|
|
|
|
<?php if (!$rows): ?>
|
|
|
|
|
<div class="card card-pad empty">
|
2026-10-05 13:26:49 +08:00
|
|
|
<b><?= $keyword !== '' ? '没有匹配的旅程' : '还没有旅程' ?></b>
|
2026-10-02 09:28:07 +08:00
|
|
|
<?= $keyword !== '' ? '换个关键词试试,或清除搜索看全部。'
|
2026-10-05 13:26:49 +08:00
|
|
|
: ($canWrite ? '点右上角「新建旅程」,把一次出行记下来;进去之后再加一段段行程。'
|
|
|
|
|
: '家人还没有记录旅程。') ?>
|
2026-10-02 09:28:07 +08:00
|
|
|
</div>
|
|
|
|
|
<?php else: ?>
|
|
|
|
|
<div class="trip-list">
|
|
|
|
|
<?php foreach ($rows as $t): ?>
|
|
|
|
|
<a class="trip-card" href="<?= e(url('trips/show', ['id' => (int)$t['id']])) ?>">
|
|
|
|
|
<div class="trip-cover">
|
|
|
|
|
<?php if (!empty($t['cover_key'])): ?>
|
|
|
|
|
<img src="<?= e(media_url((string)$t['cover_key'])) ?>" alt="">
|
|
|
|
|
<?php else: ?>
|
|
|
|
|
<span class="trip-cover-empty">🧳</span>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="trip-main">
|
|
|
|
|
<h2 class="trip-title"><?= e((string)$t['title']) ?></h2>
|
|
|
|
|
<div class="trip-meta">
|
2026-10-05 10:58:17 +08:00
|
|
|
<?php /* 时间是从各段旅程算的;一段都没有时如实说"还没有旅程" */ ?>
|
|
|
|
|
<span><?= e(\App\Trip::activitySpan($t['starts_at'] ?? null, $t['ends_at'] ?? null)) ?></span>
|
|
|
|
|
<?php if (!empty($t['city'])): ?>
|
|
|
|
|
<span>📍 <?= e((string)$t['city']) ?></span>
|
2026-10-02 09:28:07 +08:00
|
|
|
<?php endif; ?>
|
2026-10-05 13:26:49 +08:00
|
|
|
<span><?= (int)($t['node_count'] ?? 0) ?> 段行程</span>
|
2026-10-02 09:28:07 +08:00
|
|
|
</div>
|
|
|
|
|
<?php if (!empty($t['summary'])): ?>
|
|
|
|
|
<p class="trip-sum"><?= e(mb_substr((string)$t['summary'], 0, 80, 'UTF-8')) ?></p>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
<?php if (!empty($t['attendees'])): ?>
|
|
|
|
|
<div class="trip-people">
|
|
|
|
|
<?php foreach ($t['attendees'] as $a): ?>
|
|
|
|
|
<?= person_chip($a) ?>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</div>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
</div>
|
|
|
|
|
</a>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</div>
|
|
|
|
|
<?php endif; ?>
|