1. 独立页(登录/安装/错误)套上 HTML 骨架 —— 修「首页为什么没有样式」: 新增 templates/layout-bare.php,View::render 对独立页也走完整 <head> + CSS。 2. 以个人为中心:Kinship::label() 现算称呼、Auth::homeTitle() 出「X的家书」; 同一批人在不同登录者眼里自动变成公公婆婆 / 岳父岳母(不存一次性称谓)。 3. 附件存储可配置:Storage 门面(local / 阿里云 OSS),库里只存相对键, 云端失败自动回退本地;设置页可选驱动并填 OSS 参数(照 MovieLog 的方案)。 4. 三种角色:admin / member / guest,访客只读、写操作一律 403; accounts.role 枚举扩容,老库靠 Schema::ensure() 自动升级。 5. 家谱:只存相邻两代的边(parent / spouse),其余称呼全部推导 —— 兄弟姐妹不存边(共同父母 + birth_rank 排行推长子/次女、哥哥/妹妹), 认不清的人用虚拟人物 is_placeholder 占位,关系天然双向。 顺带修掉本地 e2e 挖出的 8 个线上级 bug(性别写死、长幼方向反、关系方向静默写反、 birth_rank 不从表单取回、隐式可空参数致响应头失效、无文件字段被误判为上传失败、 layout 变量撞车覆盖 $me、世代 0 显示成「下 0 代」)。 验证:kinship 单测 37/0 · HTTP e2e 81/0 · 老库升级专测 14/0 · 反向验证 11/11(把每个修复改回旧写法,对应断言都会变红)。
90 lines
3.6 KiB
PHP
90 lines
3.6 KiB
PHP
<div class="page-head">
|
|
<h1>邀请访客</h1>
|
|
<span class="sub">朋友只读 —— 能看,不能改</span>
|
|
</div>
|
|
|
|
<div class="card card-pad">
|
|
<h2 class="section-title">三种身份 <span class="hint">决定能看到多少、能不能改</span></h2>
|
|
<div class="role-cards">
|
|
<div class="role-card">
|
|
<div class="rc-name">管理员</div>
|
|
<p class="rc-desc">一个家庭通常只有一位。改家庭名称、附件存哪儿、谁能登录,都在他手里。</p>
|
|
</div>
|
|
<div class="role-card">
|
|
<div class="rc-name">家庭成员</div>
|
|
<p class="rc-desc">正常使用的人。可以建自己的通讯录、日历本,维护家里的名册与亲属关系。</p>
|
|
</div>
|
|
<div class="role-card">
|
|
<div class="rc-name">访客</div>
|
|
<p class="rc-desc">一起旅行、一起看过电影的朋友。能登录进来看,但改不了任何东西,也不出现在家谱里。</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card card-pad" style="margin-top:16px">
|
|
<h2 class="section-title">开通一个访客账号</h2>
|
|
|
|
<?php if (!empty($errors['_'] ?? null)): ?>
|
|
<div class="flash"><div class="flash-item err"><?= e($errors['_']) ?></div></div>
|
|
<?php endif; ?>
|
|
|
|
<form method="post" action="<?= e(url('accounts/invite_create')) ?>">
|
|
<?= csrf_field() ?>
|
|
<div class="form-grid">
|
|
<div class="field">
|
|
<label for="v_name">对方的名字</label>
|
|
<input class="input" id="v_name" name="name" value="<?= e(old('name')) ?>" required>
|
|
<?php if (!empty($errors['name'])): ?><span class="err"><?= e($errors['name']) ?></span><?php endif; ?>
|
|
</div>
|
|
<div class="field">
|
|
<label for="v_phone">手机号(登录名)</label>
|
|
<input class="input" id="v_phone" name="phone" value="<?= e(old('phone')) ?>"
|
|
inputmode="numeric" required>
|
|
<?php if (!empty($errors['phone'])): ?><span class="err"><?= e($errors['phone']) ?></span><?php endif; ?>
|
|
</div>
|
|
<div class="field">
|
|
<label for="v_password">初始密码</label>
|
|
<input class="input" id="v_password" name="password" type="password" required>
|
|
<span class="tip">至少 8 位,含字母和数字。把手机号和密码告诉他即可登录。</span>
|
|
<?php if (!empty($errors['password'])): ?><span class="err"><?= e($errors['password']) ?></span><?php endif; ?>
|
|
</div>
|
|
<div class="field">
|
|
<label for="v_note">备注</label>
|
|
<input class="input" id="v_note" name="note" value="<?= e(old('note')) ?>"
|
|
placeholder="比如:2026 年一起去青海的朋友">
|
|
</div>
|
|
</div>
|
|
<div class="btn-row">
|
|
<button class="btn" type="submit">开通访客账号</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<?php
|
|
// 已有访客
|
|
$guests = [];
|
|
foreach ($people as $pp) {
|
|
if (($pp['account_role'] ?? '') === 'guest') {
|
|
$guests[] = $pp;
|
|
}
|
|
}
|
|
?>
|
|
<?php if ($guests): ?>
|
|
<div class="card card-pad" style="margin-top:16px">
|
|
<h2 class="section-title">已有访客 <span class="hint"><?= count($guests) ?> 位</span></h2>
|
|
<ul class="plain-list">
|
|
<?php foreach ($guests as $g): ?>
|
|
<li>
|
|
<a href="<?= e(url('people/show', ['id' => (int)$g['id']])) ?>"><?= e($g['name']) ?></a>
|
|
<span class="muted small">
|
|
<?= e(\App\Crypto::maskPhone((string)($g['phone_encrypted'] ?? ''))) ?>
|
|
· <?= $g['account_status'] === 'active' ? '正常' : '已停用' ?>
|
|
</span>
|
|
</li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
<p class="small muted" style="margin:14px 0 0">
|
|
要停用或删除,点进对方的名字,在「登录账号」里操作。
|
|
</p>
|
|
</div>
|
|
<?php endif; ?>
|