名册每人一份 · 分组两层 · 拖动排序 · 表单合一 · 裁剪可缩放
按用户十点反馈逐条落地(v5,Schema::VERSION = 5): - 名册改成每人一份:新表 person_roster(owner_id, person_id, group_id, sort_order, source)。默认只看「我添加的 + 别人分享给我的」; source='seeded' 是升级时从老 persons.group_id 播进来的(先播数据再删列)。 - 排序不再手填:名册页直接拖动卡片(整版提交,一次 applyLayout 落库), 无 JS 时卡片上的「调整分组」表单照旧可用。 - 分组分两层:管理员在「系统设置」维护公共分组(owner_id=0), 用户在「个人设置」加自己的分组;显示顺序各人各定、互不影响。 - 名册可共享:把名片分享给别的用户(people/share);添加成员时若系统里 已有这个人,可直接复用(people/pick),不必重复录入。 - 「编辑成员」与「改我自己的资料」合并为同一张表(templates/people/form.php), 两个入口 href 完全相同,h1 按改谁切换文案;个人设置页只留 资料入口 + 称呼 + 我的分组三块,删除 templates/settings/_profile.php。 - 系统设置收进头像下拉,顶栏只剩 首页/家谱/名册。 - 裁剪器加缩放(滑块 1-4x、Ctrl+滚轮、还原):缩放只改视图大小, 落库的归一化矩形保持不变。 - 权限:管理员可以改任何人的权限(含自己),只拦「最后一位管理员」被降级。 - 去掉首页「我的一句话」后的链接、家谱说明段、以及「还没归到任何分组」提示。 迁移安全:数据回填(PersonRoster::seedFromPersons)先于删列执行、且不进 tryStep 容错;失败步骤记入 settings.schema_upgrade_warning 并在系统设置页提示。 线上已验证:schema_upgrade_warning 为空,person_roster/person_groups.owner_id 就位,persons.group_id / sort_order 已删。 验证:php -l 48 文件;本地 e2e 277/0、老库升级 81/0、桌面几何 108/0、 移动端几何 180/0、交互 96/0;反向验证 38 条注入 + 2 条缩放注入全部命中; 部署静态断言 53/0,站点自检 7/7(--resolve 锁本机走 443,探针真的进 PHP)。
This commit is contained in:
+71
-20
@@ -40,9 +40,7 @@ $shortKind = ['id' => '身份证生日', 'solar' => '阳历生日', 'lunar' =
|
||||
<div class="page-head">
|
||||
<h1><?= e($pShown) ?></h1>
|
||||
<span class="sub">
|
||||
<?php if ($isSelf): ?>
|
||||
这是你自己
|
||||
<?php else: ?>
|
||||
<?php if (!$isSelf): ?>
|
||||
<span class="rel-label"><?= e($labelToMe) ?></span>
|
||||
<?php if ($isMyNick): ?>
|
||||
· 本名 <?= e((string)$p['name']) ?>
|
||||
@@ -51,11 +49,10 @@ $shortKind = ['id' => '身份证生日', 'solar' => '阳历生日', 'lunar' =
|
||||
<?php if (!empty($p['is_placeholder'])): ?><span class="badge">虚拟人物</span><?php endif; ?>
|
||||
</span>
|
||||
<div class="actions">
|
||||
<?php if ($isSelf): ?>
|
||||
<a class="btn btn-sm" href="<?= e(url('settings/me')) ?>#me-profile">改我自己的资料</a>
|
||||
<?php endif; ?>
|
||||
<?php if ($canW): ?>
|
||||
<a class="btn btn-ghost btn-sm" href="<?= e(url('people/edit', ['id' => $pid])) ?>">编辑资料</a>
|
||||
<?php if ($isSelf || $canW): ?>
|
||||
<a class="btn btn-ghost btn-sm" href="<?= e(url('people/edit', ['id' => $pid])) ?>">
|
||||
<?= $isSelf ? '编辑我的资料' : '编辑资料' ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ($admin): ?>
|
||||
<form method="post" action="<?= e(url('people/destroy')) ?>" style="display:inline"
|
||||
@@ -362,6 +359,57 @@ $shortKind = ['id' => '身份证生日', 'solar' => '阳历生日', 'lunar' =
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- ============ 名册归属 / 分享名片 ============ -->
|
||||
<?php if (!$isSelf): ?>
|
||||
<div class="card card-pad" style="margin-top:16px">
|
||||
<h2 class="section-title">名册 <span class="hint">名册是每人一份的</span></h2>
|
||||
<p class="small muted" style="margin:0 0 14px">
|
||||
<?php if (!empty($inMyRoster)): ?>
|
||||
「<?= e($pShown) ?>」在你的名册里。归到哪一组、排第几,只影响你自己看到的名册 ——
|
||||
家里其他人各有一份,互不打搅。
|
||||
<?php else: ?>
|
||||
「<?= e($pShown) ?>」还不在你的名册里。你仍然能在家谱与首页看到他,
|
||||
但名册只列<b>你自己加的人</b>和<b>别人分享给你的名片</b>。
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
<div class="btn-row" style="margin-top:0;flex-wrap:wrap;align-items:center">
|
||||
<?php if (empty($inMyRoster) && $canW): ?>
|
||||
<form method="post" action="<?= e(url('people/pick')) ?>" style="display:inline">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="ids[]" value="<?= $pid ?>">
|
||||
<button class="btn btn-sm" type="submit">加进我的名册</button>
|
||||
</form>
|
||||
<?php elseif (!empty($inMyRoster) && $canW): ?>
|
||||
<form method="post" action="<?= e(url('people/forget')) ?>" style="display:inline">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="person_id" value="<?= $pid ?>">
|
||||
<button class="btn btn-ghost btn-sm" type="submit">从我的名册里移走</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($canW && !empty($options)): ?>
|
||||
<?php /* 需求原话:「我可以把一个人的名片,分享给一个用户,
|
||||
则这个名片,自动出现在这个用户的名册中」。 */ ?>
|
||||
<details class="share-wrap">
|
||||
<summary class="btn btn-ghost btn-sm">分享他的名片给…</summary>
|
||||
<form method="post" action="<?= e(url('people/share')) ?>" class="inline-form">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="person_id" value="<?= $pid ?>">
|
||||
<input type="hidden" name="back" value="<?= $pid ?>">
|
||||
<label class="sr-only" for="shareTo">分享给谁</label>
|
||||
<select class="select" id="shareTo" name="to_id">
|
||||
<?php foreach ($options as $o): $oid = (int)$o['id']; ?>
|
||||
<option value="<?= $oid ?>"><?= e((string)$o['name']) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<button class="btn btn-sm" type="submit">分享</button>
|
||||
</form>
|
||||
</details>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($admin): ?>
|
||||
<div class="card card-pad" style="margin-top:16px">
|
||||
<h2 class="section-title">登录账号</h2>
|
||||
@@ -396,17 +444,22 @@ $shortKind = ['id' => '身份证生日', 'solar' => '阳历生日', 'lunar' =
|
||||
<?= $role === 'guest' ? '—— 只能查看,不能新增或修改任何内容。' : '' ?>
|
||||
</p>
|
||||
<div class="btn-row" style="margin-top:0;flex-wrap:wrap">
|
||||
<form method="post" action="<?= e(url('accounts/role')) ?>" style="display:inline">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="person_id" value="<?= $pid ?>">
|
||||
<select class="select" name="role" style="width:auto;display:inline-block">
|
||||
<option value="member" <?= $role === 'member' ? 'selected' : '' ?>>家庭成员</option>
|
||||
<option value="admin" <?= $role === 'admin' ? 'selected' : '' ?>>管理员</option>
|
||||
<option value="guest" <?= $role === 'guest' ? 'selected' : '' ?>>访客</option>
|
||||
</select>
|
||||
<button class="btn btn-ghost btn-sm" type="submit">改角色</button>
|
||||
<?php if ($isSelf): ?>
|
||||
<?php /* 自己也能改自己的权限(哪怕给自己降级)—— 系统的家可能就一个人用,
|
||||
难道他还不能调自己的权限?唯一拦的是"降完一个管理员都不剩"。 */ ?>
|
||||
<span class="small muted">可以改自己的。只有「把最后一位管理员降级」会被拦下。</span>
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
<?php if (!$isSelf): ?>
|
||||
<form method="post" action="<?= e(url('accounts/role')) ?>" style="display:inline">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="person_id" value="<?= $pid ?>">
|
||||
<select class="select" name="role" style="width:auto;display:inline-block">
|
||||
<option value="member" <?= $role === 'member' ? 'selected' : '' ?>>家庭成员</option>
|
||||
<option value="admin" <?= $role === 'admin' ? 'selected' : '' ?>>管理员</option>
|
||||
<option value="guest" <?= $role === 'guest' ? 'selected' : '' ?>>访客</option>
|
||||
</select>
|
||||
<button class="btn btn-ghost btn-sm" type="submit">改角色</button>
|
||||
</form>
|
||||
<form method="post" action="<?= e(url('accounts/status')) ?>" style="display:inline">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="person_id" value="<?= $pid ?>">
|
||||
@@ -415,8 +468,6 @@ $shortKind = ['id' => '身份证生日', 'solar' => '阳历生日', 'lunar' =
|
||||
<?= $p['account_status'] === 'active' ? '停用账号' : '启用账号' ?>
|
||||
</button>
|
||||
</form>
|
||||
<?php else: ?>
|
||||
<span class="small muted">这是你自己 —— 要改自己的权限,请让另一位管理员来操作。</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
Reference in New Issue
Block a user