v24 第 2 轮:19 条清单收尾(附件预览/CalDAV/任务分类看板/全局选人/家谱/纪念日/财务)
用户 2026-10-02 提的 19 条需求,本轮完成剩下的 8 条 + CalDAV 服务端:
- ③ 附件:图片/视频给缩略图,PDF/Word/Excel 给**同尺寸**图标;可预览的在本页
弹层里看(不再新开标签页),渲染不了的点了直接下载;预览层右上角恒有下载按钮。
- ⑦b CalDAV:把「我的日历本」按 RFC 4791 只读子集分享出去(OPTIONS/PROPFIND/
REPORT/GET,写方法一律 403)。用**专用口令**(库里只存 sha256),不是登录口令。
- ⑨⑩ 任务:分类与看板都由用户自建;已完成的任务从看板消失,改在「已完成」页
按分类查看/搜索;设置入口在「新建任务」旁的 ☰。
- ⑪ 全局人员选择器:一个片段铺到观影/旅程/资源/日历共享/任务共享/财务共享;
修掉了老组件「名字和拼音都搜不动」的 bug —— .att-item 自己声明了 display:flex,
压过了浏览器 [hidden]{display:none},过滤根本没生效。
- ⑫ 家谱:头像改方形不再裁切;姻亲不在图上的卡片给「⇄ 姻亲」入口,
以 TA 为中心重画 + 「返回我的家谱」。
- ⑬ 纪念日:阴历/阳历都能设且按对应历法重复;名册里每个人的生日默认可见
(实时派生,不复制一份);全部作为全天日程进日历。
- ⑮ 财务:账本可共享,双方都能记账、都能看全部账目,资产−负债=净资产;
金额一律以「分」存,不用浮点。
验证:端到端 724 项通过 / 0 失败;几何 368、交互 97、移动端 516、家谱 24、
升级 123 全绿;SQL 列名静态校验 0 处可疑;部署 11 条线上探针全过。
This commit is contained in:
+105
-46
@@ -17,19 +17,55 @@
|
||||
* @param array $people 名册(共享给别人时用)
|
||||
*/
|
||||
$canWrite = \App\Auth::canWrite();
|
||||
$view = (string)($view ?? 'month');
|
||||
$anchor = (string)($anchor ?? date('Y-m-d'));
|
||||
$ts = strtotime($ym . '-01') ?: time();
|
||||
$prevYm = date('Y-m', strtotime('-1 month', $ts));
|
||||
$nextYm = date('Y-m', strtotime('+1 month', $ts));
|
||||
$thisYm = date('Y-m');
|
||||
$writable = array_values(array_filter($cals, static fn($c) => \App\Calendar::canWrite($c, (int)\App\Auth::personId())));
|
||||
|
||||
// 三种看法各自的「上一段 / 下一段」:月按整月走,周按 7 天走,天按 1 天走
|
||||
$step = $view === 'week' ? 7 : ($view === 'day' ? 1 : 0);
|
||||
$prevD = date('Y-m-d', strtotime('-' . $step . ' days', strtotime($anchor)));
|
||||
$nextD = date('Y-m-d', strtotime('+' . $step . ' days', strtotime($anchor)));
|
||||
$todayD = date('Y-m-d');
|
||||
$headText = $view === 'month' ? date('Y 年 n 月', $ts)
|
||||
: ($view === 'week' ? date('Y 年 n 月 j 日', strtotime($anchor)) . ' 起这一周'
|
||||
: date('Y 年 n 月 j 日', strtotime($anchor)));
|
||||
$mkUrl = static function (string $v) use ($ym, $prevD, $nextD, $todayD, $prevYm, $nextYm, $thisYm) {
|
||||
if ($v === 'month') {
|
||||
return url('calendar', ['view' => 'month', 'ym' => $ym]);
|
||||
}
|
||||
return null; // 周/天要把具体哪天传进去,由调用方拼
|
||||
};
|
||||
?>
|
||||
<div class="page-head">
|
||||
<h1>日程</h1>
|
||||
<span class="sub"><?= e(date('Y 年 n 月', $ts)) ?></span>
|
||||
<span class="sub"><?= e($headText) ?></span>
|
||||
<div class="actions">
|
||||
<a class="btn btn-ghost" href="<?= e(url('calendar', ['ym' => $prevYm])) ?>">上一月</a>
|
||||
<a class="btn btn-ghost" href="<?= e(url('calendar', ['ym' => $thisYm])) ?>">今天</a>
|
||||
<a class="btn btn-ghost" href="<?= e(url('calendar', ['ym' => $nextYm])) ?>">下一月</a>
|
||||
<?php /* v24 第 4 条:月 / 周 / 天三选一 */ ?>
|
||||
<span class="seg" role="group" aria-label="看法">
|
||||
<a class="seg-btn<?= $view === 'month' ? ' is-on' : '' ?>"
|
||||
href="<?= e(url('calendar', ['view' => 'month', 'ym' => $ym])) ?>">月</a>
|
||||
<a class="seg-btn<?= $view === 'week' ? ' is-on' : '' ?>"
|
||||
href="<?= e(url('calendar', ['view' => 'week', 'd' => $anchor])) ?>">周</a>
|
||||
<a class="seg-btn<?= $view === 'day' ? ' is-on' : '' ?>"
|
||||
href="<?= e(url('calendar', ['view' => 'day', 'd' => $anchor])) ?>">天</a>
|
||||
</span>
|
||||
<?php if ($view === 'month'): ?>
|
||||
<a class="btn btn-ghost" href="<?= e(url('calendar', ['view' => 'month', 'ym' => $prevYm])) ?>">上一月</a>
|
||||
<a class="btn btn-ghost" href="<?= e(url('calendar', ['view' => 'month', 'ym' => $thisYm])) ?>">今天</a>
|
||||
<a class="btn btn-ghost" href="<?= e(url('calendar', ['view' => 'month', 'ym' => $nextYm])) ?>">下一月</a>
|
||||
<?php else: ?>
|
||||
<a class="btn btn-ghost" href="<?= e(url('calendar', ['view' => $view, 'd' => $prevD])) ?>">
|
||||
<?= $view === 'week' ? '上一周' : '前一天' ?>
|
||||
</a>
|
||||
<a class="btn btn-ghost" href="<?= e(url('calendar', ['view' => $view, 'd' => $todayD])) ?>">今天</a>
|
||||
<a class="btn btn-ghost" href="<?= e(url('calendar', ['view' => $view, 'd' => $nextD])) ?>">
|
||||
<?= $view === 'week' ? '下一周' : '后一天' ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<a class="btn btn-ghost" href="<?= e(url('calendar/calendars')) ?>">日历本</a>
|
||||
<?php if ($canWrite && $writable): ?>
|
||||
<button class="btn" type="button" id="calAddBtn">新建日程</button>
|
||||
@@ -68,7 +104,7 @@ $writable = array_values(array_filter($cals, static fn($c) => \App\Calendar::can
|
||||
<?php if ($canWrite && $writable): ?>
|
||||
<div class="card card-pad cal-add" id="calAddCard" hidden>
|
||||
<h2 class="cinema-h2">新建日程</h2>
|
||||
<form method="post" action="<?= e(url('calendar/event_add')) ?>">
|
||||
<form method="post" action="<?= e(url('calendar/event_add')) ?>" enctype="multipart/form-data">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="ym" value="<?= e($ym) ?>">
|
||||
<div class="form-grid">
|
||||
@@ -80,34 +116,14 @@ $writable = array_values(array_filter($cals, static fn($c) => \App\Calendar::can
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="ce-title">标题 *</label>
|
||||
<input class="input" id="ce-title" name="title" required placeholder="如:家长会">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="ce-date">日期 *</label>
|
||||
<input class="input" type="date" id="ce-date" name="date" required
|
||||
value="<?= e($ym === $thisYm ? date('Y-m-d') : $ym . '-01') ?>">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="ce-end">结束日期(跨天时填)</label>
|
||||
<input class="input" type="date" id="ce-end" name="end_date">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label><input type="checkbox" id="ce-allday" name="all_day" value="1" checked> 全天(不填具体时分)</label>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="ce-note">备注</label>
|
||||
<input class="input" id="ce-note" name="note">
|
||||
</div>
|
||||
<div class="field" id="ce-time-s">
|
||||
<label for="ce-st">开始时刻</label>
|
||||
<input class="input" type="time" id="ce-st" name="start_time">
|
||||
</div>
|
||||
<div class="field" id="ce-time-e">
|
||||
<label for="ce-et">结束时刻</label>
|
||||
<input class="input" type="time" id="ce-et" name="end_time">
|
||||
</div>
|
||||
<?php /* v24 第 6 条:字段按 iCalendar / CalDAV 的 VEVENT 定(见 _event_fields.php)。
|
||||
新建时「全天」默认**不勾**(用户原话),开始时间默认今天 09:00。 */ ?>
|
||||
<?php
|
||||
$evFields = ['starts_at' => ($ym === $thisYm ? date('Y-m-d') : $ym . '-01') . ' 09:00:00',
|
||||
'ends_at' => ($ym === $thisYm ? date('Y-m-d') : $ym . '-01') . ' 10:00:00'];
|
||||
$evAllDay = false;
|
||||
require __DIR__ . '/_event_fields.php';
|
||||
?>
|
||||
</div>
|
||||
<div class="btn-row">
|
||||
<button class="btn btn-sm" type="submit">加上</button>
|
||||
@@ -117,6 +133,60 @@ $writable = array_values(array_filter($cals, static fn($c) => \App\Calendar::can
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($view === 'week' || $view === 'day'): ?>
|
||||
<?php /* ===== 周 / 天:按小时铺的时间网格(全天日程单独挂顶上) ===== */ ?>
|
||||
<div class="card cal-tg-card">
|
||||
<div class="tg-head">
|
||||
<div class="tg-gutter"></div>
|
||||
<?php foreach (($cols ?? []) as $c): ?>
|
||||
<div class="tg-dayname<?= $c['is_today'] ? ' is-today' : '' ?>">
|
||||
<span class="tg-wd"><?= e(['日','一','二','三','四','五','六'][$c['w']]) ?></span>
|
||||
<span class="tg-dd"><?= (int)$c['day'] ?></span>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<?php $tgAll = $tgrid['all_day'] ?? []; ?>
|
||||
<?php if (array_filter($tgAll)): ?>
|
||||
<div class="tg-allday">
|
||||
<div class="tg-gutter"><span class="tg-tag">全天</span></div>
|
||||
<?php foreach (($cols ?? []) as $i => $c): ?>
|
||||
<div class="tg-adcell">
|
||||
<?php foreach (($tgAll[$i] ?? []) as $ev): ?>
|
||||
<a class="cal-ev is-allday" data-cal="<?= (int)$ev['cal'] ?>"
|
||||
style="background: <?= e((string)$ev['color']) ?>;"
|
||||
href="<?= e((string)$ev['href']) ?>"
|
||||
title="<?= e((string)$ev['title']) ?>"><?= e((string)$ev['title']) ?></a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="tg-body">
|
||||
<div class="tg-gutter tg-hours">
|
||||
<?php for ($h = 0; $h < 24; $h++): ?>
|
||||
<span class="tg-hr"><?= sprintf('%02d', $h) ?></span>
|
||||
<?php endfor; ?>
|
||||
</div>
|
||||
<?php foreach (($cols ?? []) as $i => $c): ?>
|
||||
<div class="tg-col<?= $c['is_today'] ? ' is-today' : '' ?>">
|
||||
<?php for ($h = 0; $h < 24; $h++): ?>
|
||||
<span class="tg-line"></span>
|
||||
<?php endfor; ?>
|
||||
<?php foreach (($tgrid['timed'][$i] ?? []) as $ev): ?>
|
||||
<a class="tg-block" data-cal="<?= (int)$ev['cal'] ?>"
|
||||
style="background: <?= e((string)$ev['color']) ?>; top: <?= (float)$ev['top'] ?>%; height: <?= (float)$ev['height'] ?>%;"
|
||||
href="<?= e((string)$ev['href']) ?>"
|
||||
title="<?= e((string)$ev['title']) ?>">
|
||||
<b><?= e((string)$ev['time']) ?></b> <?= e((string)$ev['title']) ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="card cal-grid-card">
|
||||
<div class="cal-head">
|
||||
<?php foreach (['日', '一', '二', '三', '四', '五', '六'] as $wd): ?>
|
||||
@@ -150,6 +220,7 @@ $writable = array_values(array_filter($cals, static fn($c) => \App\Calendar::can
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -180,18 +251,6 @@ $writable = array_values(array_filter($cals, static fn($c) => \App\Calendar::can
|
||||
});
|
||||
}
|
||||
if (cancel && card) { cancel.addEventListener('click', function () { card.hidden = true; }); }
|
||||
|
||||
/* 「全天」勾上就把两个时刻输入框藏掉 —— 没有具体时分就是全天(用户第 7 条) */
|
||||
var allday = document.getElementById('ce-allday');
|
||||
var ts = document.getElementById('ce-time-s');
|
||||
var te = document.getElementById('ce-time-e');
|
||||
if (allday && ts && te) {
|
||||
function syncTime() {
|
||||
var hide = allday.checked;
|
||||
ts.hidden = hide; te.hidden = hide;
|
||||
}
|
||||
allday.addEventListener('change', syncTime);
|
||||
syncTime();
|
||||
}
|
||||
/* 「全天」勾上藏掉时刻那一段的逻辑在 _event_fields.php 里(两个页面共用一份) */
|
||||
})();
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user