v11: 家谱按户排布(夫妻并排/长幼排序/父母括号/姻亲);观影设置下拉收拢影院·搜索·统计·年度报告;观影人头像
家谱(用户第 2 点,重写模板与 Kinship::tree): - 同代聚成「夫妻单元」(户):血亲当主位、配偶并排在其右,兄弟_姐妹按长幼(长子左) - 血亲可达性判「姻亲」:只走 parent/child 边从「我」可达者为本家血亲,妻子的父母 走不到 → 标「姻亲」并排到本代末尾(旧判据「上无父母且下无子女」对岳父母恒为假,是真 bug) - 父母括号连线:横杆盖住父母列到其子女各列,竖线落父母列中心、每子女列一道下线 - 称呼按长幼定死:姐夫/妹夫、嫂子/弟媳、大/小舅子、大/小姨子、大伯子/小叔子、 大姑子/小姑子、侄子/侄女、外甥/外甥女、堂/表 - 列宽地板 minmax(min-content,1fr):原 minmax(0,1fr) 在窄屏+户数多时把列压到卡片 (96px)以下 → 同代卡片互相重叠;.tnode 加 flex:0 0 auto 防被 flex 压扁 观影(用户第 3~5 点): - 顶栏删「影院」入口(影院是观影模块的子功能);观影列表右侧加「⚙ 设置」下拉, 内含 影院管理 / 高级搜索 / 统计 / 年度报告(后三者从 MovieLog 迁入, app/MovieStats.php + 三个只读路由,MySQL 方言;图表全用纯 CSS,不引 CDN) - 评价区删除「我」的长条徽标(被 flex column stretch 拉成整行宽的丑色带) - 观影人弹窗列表与已选 chips 带头像;syncChips 点名取 .att-name/.att-av (旧写法取「第一个 span」,v11 起那是隐藏占位,chip 上会没名字) 验证:e2e 432/0、桌面几何 268/0、移动几何 464/0、交互几何 97/0、 静态空跑 199/0、反向验证 v11 十条 10抓/0漏。本轮无 DB 变更(Schema 仍 v10)。 移动几何抓出两个真溢出并已修:高级搜索页 select 长选项撑破 .field、 原生 date 输入撑破 .date-range(360/375px)。
This commit is contained in:
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
/**
|
||||
* 年度观影报告(v11,从 MovieLog annual_report.php 迁入)。
|
||||
*
|
||||
* ⚠️ 与 MovieLog 唯一的实质差异:那边月份/星期两张图靠外部图表库脚本渲染,
|
||||
* 家书这边**不引任何外部脚本** —— 图表全部用 CSS 画(月份是竖柱、星期是横条)。
|
||||
* 理由:线上不依赖外网 CDN 是既有纪律(家书连字体都是系统字体),
|
||||
* 而且这两张图的信息量很小,CSS 完全够用。
|
||||
*
|
||||
* 「我」的口径与 MovieLog 一致:报告只统计**登录者参与过**的场次。
|
||||
*/
|
||||
$wd = ['日', '一', '二', '三', '四', '五', '六'];
|
||||
$monthMax = max(1, max(array_values($stats['month_distribution'])));
|
||||
$weekdayMax = max(1, max(array_values($stats['weekday_distribution'])));
|
||||
$hasData = (int)$stats['total'] > 0;
|
||||
$fmtDate = static function (?string $d): string {
|
||||
return ($d !== null && $d !== '') ? date('Y年n月j日', strtotime($d)) : '—';
|
||||
};
|
||||
?>
|
||||
<div class="page-head">
|
||||
<h1><?= (int)$year ?> 年度观影报告</h1>
|
||||
<span class="sub"><?= e($meName) ?> 这一年看了 <?= (int)$stats['total'] ?> 场</span>
|
||||
<div class="actions">
|
||||
<form method="get" action="index.php" class="year-pick">
|
||||
<input type="hidden" name="r" value="movies/report">
|
||||
<select class="select" name="year" onchange="this.form.submit()" aria-label="选择年份">
|
||||
<?php foreach ($years as $y): ?>
|
||||
<option value="<?= (int)$y ?>" <?= (int)$y === (int)$year ? 'selected' : '' ?>><?= (int)$y ?> 年</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</form>
|
||||
<a class="btn btn-ghost btn-sm" href="<?= e(url('movies')) ?>">返回观影</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (!$hasData): ?>
|
||||
<div class="card card-pad empty">
|
||||
<b><?= (int)$year ?> 年还没有你的观影记录</b>
|
||||
换一个年份看看,或者先去记一场电影。
|
||||
</div>
|
||||
<?php else: ?>
|
||||
|
||||
<div class="report-grid">
|
||||
<div class="report-card"><div class="n"><?= (int)$stats['total'] ?></div><div class="l">观影场次</div></div>
|
||||
<div class="report-card"><div class="n"><?= (int)$stats['days'] ?></div><div class="l">看电影的天数</div></div>
|
||||
<div class="report-card"><div class="n"><?= e((string)$stats['avg_per_month']) ?></div><div class="l">月均场次</div></div>
|
||||
<div class="report-card"><div class="n"><?= e((string)$stats['avg_days_between']) ?></div><div class="l">平均几天看一场</div></div>
|
||||
</div>
|
||||
|
||||
<div class="report-grid two">
|
||||
<div class="report-card wide">
|
||||
<div class="l">最常去的影院</div>
|
||||
<div class="v"><?= e((string)$stats['top_cinema']) ?></div>
|
||||
<?php if ((int)$stats['top_cinema_count'] > 0): ?><div class="s">去了 <?= (int)$stats['top_cinema_count'] ?> 次</div><?php endif; ?>
|
||||
</div>
|
||||
<div class="report-card wide">
|
||||
<div class="l">一起看电影最多的人</div>
|
||||
<div class="v"><?= e((string)$stats['top_person']) ?></div>
|
||||
<?php if ((int)$stats['top_person_count'] > 0): ?><div class="s">同场 <?= (int)$stats['top_person_count'] ?> 次</div><?php endif; ?>
|
||||
</div>
|
||||
<div class="report-card wide">
|
||||
<div class="l">同场人最多的一部</div>
|
||||
<div class="v"><?= e((string)$stats['most_viewers_movie']) ?></div>
|
||||
<?php if ((int)$stats['most_viewers_count'] > 0): ?><div class="s"><?= (int)$stats['most_viewers_count'] ?> 人一起看</div><?php endif; ?>
|
||||
</div>
|
||||
<div class="report-card wide">
|
||||
<div class="l">这一年从 <?= e($fmtDate($stats['first_date'])) ?></div>
|
||||
<div class="v">到 <?= e($fmtDate($stats['last_date'])) ?></div>
|
||||
<div class="s"><?= (int)$stats['days'] ?> 个不同的日子走进电影院</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card card-pad">
|
||||
<h3 class="section-title">月份分布 <span class="hint">每个月看几场</span></h3>
|
||||
<div class="vgrid">
|
||||
<?php foreach ($stats['month_distribution'] as $m => $cnt): ?>
|
||||
<div class="vcol" title="<?= (int)$m ?> 月:<?= (int)$cnt ?> 场">
|
||||
<span class="vbar" style="height: <?= e((string)round((int)$cnt / $monthMax * 100, 2)) ?>%"></span>
|
||||
<span class="vlab"><?= (int)$m ?>月</span>
|
||||
<span class="vnum"><?= (int)$cnt ?></span>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card card-pad">
|
||||
<h3 class="section-title">星期分布 <span class="hint">哪天最常去</span></h3>
|
||||
<div class="bar-chart">
|
||||
<?php foreach ($wd as $w): $c = (int)$stats['weekday_distribution'][$w]; ?>
|
||||
<div class="bar-item">
|
||||
<span class="bar-label">周<?= e($w) ?></span>
|
||||
<span class="bar-track"><span class="bar-fill bar-fill-alt" style="width: <?= e((string)round($c / $weekdayMax * 100, 2)) ?>%"></span></span>
|
||||
<span class="bar-count"><?= $c ?></span>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($stats['keywords']): ?>
|
||||
<div class="card card-pad">
|
||||
<h3 class="section-title">这一年常出现的词 <span class="hint">从你的备注里数的</span></h3>
|
||||
<div class="kw-cloud">
|
||||
<?php foreach ($stats['keywords'] as $kw): ?><span class="kw"><?= e((string)$kw) ?></span><?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($stats['my_movies']): ?>
|
||||
<div class="card card-pad">
|
||||
<h3 class="section-title">这一年的片单 <span class="hint"><?= count($stats['my_movies']) ?> 部</span></h3>
|
||||
<div class="waterfall">
|
||||
<?php foreach ($stats['my_movies'] as $mv): ?>
|
||||
<a class="movie-card" href="<?= e(url('movies/show', ['id' => (int)$mv['id']])) ?>">
|
||||
<span class="card-image">
|
||||
<?php if (!empty($mv['poster_key'])): ?>
|
||||
<img src="<?= e(media_url($mv['poster_key'])) ?>" alt="<?= e($mv['title']) ?>" loading="lazy">
|
||||
<?php else: ?>
|
||||
<span class="placeholder-poster">
|
||||
<span class="ph-icon" aria-hidden="true">影</span>
|
||||
<span class="placeholder-title"><?= e($mv['title']) ?></span>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</span>
|
||||
<span class="card-body">
|
||||
<span class="card-title"><?= e($mv['title']) ?></span>
|
||||
<span class="card-meta">
|
||||
<span>📅 <?= e(\App\Movie::formatWatch($mv['starts_at'], null)) ?></span>
|
||||
</span>
|
||||
<?php if (!empty($mv['viewers'])): ?>
|
||||
<span class="card-viewers">
|
||||
<?php foreach ($mv['viewers'] as $vw): ?>
|
||||
<span class="viewer-tag"><img src="<?= e(avatar_url($vw['avatar'] ?? null)) ?>" alt=""><?= e((string)$vw['name']) ?></span>
|
||||
<?php endforeach; ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</span>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
Reference in New Issue
Block a user