需求(用户 2026-10-25):必填项原来在标题后面加一个红色星号,排版经常不齐。
改成「标题本身红色 + 加粗」——用户习惯后,看到红色加粗的标题就知道是必填。
CSS(assets/css/app.css):
- :root 新增 --req:#B03A2E、--req-w:700。
· 不用 --red(#C0533F):那是动作红(删除按钮底色),当文字色放在暖纸底
#F7F3EA 上对比度只有 ≈3.4:1,13-14px 标签偏浅;#B03A2E 约 4.6:1。
· --req-w 必须 700 不能 650/600:本站标签基线字重本来就是 600
(.form-grid > .field > label / .card .field > label / .mv-row > .mv-lb /
.dt-range-label 四处都是 600),650 会被取整回 600 = 完全没加粗。
- 文件末尾新增「必填项统一标记」段,覆盖四种标签形态:
label.is-req / .mv-lb.is-req / .dt-inline-lab.is-req / .dt-range-label.is-req,
用 !important 打穿各宿主选择器的特异性(颜色与字重是语义标记,不该被面板样式盖掉)。
- 冒号跟着变红:.mv-lb::after / .dt-inline-lab::after 原本是灰色 400,
只改标签本体会剩「红字 + 灰冒号」的半截效果。
- 包裹层兜底(.field.is-req > label 等),只作用直接子级 ——
不写 .field.is-req label,那会把「提醒」那排 checkbox 的小标签一起染红。
- 深色主题给备用色 #F08A78。
- 保留 .mv-row > .mv-lb > i(万一有没清干净的星号不至于露灰星花,且静态断言会报出来)。
模板(16 个文件 / 30 处):
- _event_fields.php / _datetime.php 的标签闭包第三参数 $star → $req,
$dtLabelStar → $dtLabelReq,删掉死引用 $evLabelStar。
- 其余 14 个模板把 `<i>*</i>` 换成给标签加 is-req 类。
- 用显式 .is-req 而不靠 required 属性反推:CSS 无父选择器,:has() 旧 WebView
不可用,且影院名称/板块名本来就靠 JS 校验没有 required。
验证:
- 静态 _fb_v94_static.py 22/0,反向 9/9(含「--req-w 必须严格大于从 CSS 解析出的
标签基线字重」,不写死 700)。
- 真浏览器 _fb_v94_req.py 63/0,反向 5/5(加粗/必须红/!important 必要性/
星号必须消失/每形态单独覆盖,五类注入各自精确命中预期断言)。
- 全量流水线(含 60+ 套件)通过并部署。
- 线上真实页面 _fb_v94_live.py 31/0:观影「片名」、旅程「旅程名」、
成员「姓名」、导航「网址/所属板块」实测 color=rgb(176,58,46) weight=700,
同页非必填 color=rgb(44,35,29) weight=600,冒号同色,无星号。
164 lines
7.9 KiB
PHP
164 lines
7.9 KiB
PHP
<?php
|
||
/**
|
||
* 影院管理(v9,MovieLog cinemas.php 同款):上面加/编表单,下面列表。
|
||
*
|
||
* 颜色用「取色器 + 50 色预设板」两路输入(内联小段 JS 只是取色联动,
|
||
* 不依赖 JS 也能手填 hex 或直接用取色器)。删除是 POST 小表单 + confirm;
|
||
* 删掉的影院只把关联观影记录的 cinema_id 置空,记录本身不动。
|
||
*
|
||
* ⚠️ $editing 是路由传进来的「被编辑影院的记录数组」(或 null)。
|
||
* 曾经这里写成 `$editing = !empty($editing);` —— 数组被原地变成布尔值,
|
||
* 表面看标题还会显示「编辑影院」,但 hidden id 变 0、四个字段全部回填为空,
|
||
* 点「编辑」就像没带入一样(v9 线上实测)。布尔化结果必须存进**另一个**变量。
|
||
*/
|
||
$isEditing = !empty($editing);
|
||
$canWrite = \App\Auth::canWrite();
|
||
?>
|
||
<div class="page-head">
|
||
<h1>影院管理</h1>
|
||
<span class="sub">共 <?= count($cinemas) ?> 家影院</span>
|
||
<div class="actions">
|
||
<a class="btn btn-ghost" href="<?= e(url('movies')) ?>">返回观影</a>
|
||
<?php $setCurrent = 'cinemas'; $setCanWrite = $canWrite; require __DIR__ . '/_settings_menu.php'; ?>
|
||
</div>
|
||
</div>
|
||
|
||
<?php if (!$canWrite): ?>
|
||
<div class="card card-pad empty"><b>只读账号</b>访客只能查看影院列表。</div>
|
||
<?php else: ?>
|
||
<div class="card card-pad cinema-form-card">
|
||
<h2 class="cinema-h2"><?= $isEditing ? '编辑影院' : '添加影院' ?></h2>
|
||
<form method="post" action="<?= e(url('movies/cinemas_save')) ?>" id="cinemaForm">
|
||
<?= csrf_field() ?>
|
||
<?php if ($isEditing): ?>
|
||
<input type="hidden" name="id" value="<?= (int)$editing['id'] ?>">
|
||
<?php endif; ?>
|
||
<div class="form-grid">
|
||
<div class="field">
|
||
<label class="is-req" for="cname">影院名称</label>
|
||
<input class="input" id="cname" name="name" required
|
||
value="<?= e(old('name', $editing['name'] ?? '')) ?>" placeholder="如:万达影城(IMAX 店)"
|
||
<?php /* 🔴 v47(用户 2026-10-13):「输入影院的名称的时候,应该自动的帮我补齐
|
||
所在的地方和详细地址。」⇒ 名称框挂高德联想,选中后自动填
|
||
`place`(所在地方)与 `address`(详细地址)。
|
||
⚠️ 只填**空白**的字段(见 addr_suggest.js 的注释)——
|
||
用户已经手写过的地址不该被覆盖。 */ ?>
|
||
data-addr data-addr-fill="place,address" data-addr-for="#cinemaForm">
|
||
</div>
|
||
<div class="field">
|
||
<label for="cplace">所在地方</label>
|
||
<input class="input" id="cplace" name="place"
|
||
value="<?= e(old('place', $editing['place'] ?? '')) ?>" placeholder="如:青岛 · 崂山区">
|
||
</div>
|
||
<div class="field full">
|
||
<label for="caddress">详细地址</label>
|
||
<input class="input" id="caddress" name="address"
|
||
value="<?= e(old('address', $editing['address'] ?? '')) ?>">
|
||
</div>
|
||
<div class="field full">
|
||
<label for="ccolor">主题颜色</label>
|
||
<div class="color-row">
|
||
<input type="color" id="ccolor" name="color" class="color-picker"
|
||
value="<?= e(old('color', $editing['color'] ?? '#888888')) ?>">
|
||
<span class="color-hex" id="colorHex"><?= e(old('color', $editing['color'] ?? '#888888')) ?></span>
|
||
<span class="preset-palette">
|
||
<?php foreach (\App\Cinema::PRESET_COLORS as $pc): ?>
|
||
<span class="preset-color" data-color="<?= $pc ?>" style="background: <?= $pc ?>;" title="<?= $pc ?>"></span>
|
||
<?php endforeach; ?>
|
||
</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="btn-row">
|
||
<button type="submit" class="btn"><?= $isEditing ? '保存' : '添加影院' ?></button>
|
||
<?php if ($isEditing): ?>
|
||
<a class="btn btn-ghost" href="<?= e(url('movies/cinemas')) ?>">取消编辑</a>
|
||
<?php endif; ?>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<div class="card card-pad">
|
||
<h2 class="cinema-h2">影院列表</h2>
|
||
<?php if (!$cinemas): ?>
|
||
<p class="empty-hint">还没有影院,先在上面添加一家。</p>
|
||
<?php else: ?>
|
||
<div class="table-wrap">
|
||
<?php /* 🔴 v40(用户 2026-10-10):「影院管理部分,注意控制列的宽度,因为最右侧的
|
||
操作、编辑和删除两个按钮,已经被挤成两行了,尝试让编辑和删除排在一行,
|
||
宽度给它留够。编辑使用蓝色的背景,删除使用红色的背景。」
|
||
⇒ ① 表格加 `.cn-table`:给「操作」列一个**最小宽度 + 不换行**
|
||
(`.cn-ops` 上 `flex-wrap: nowrap` + `white-space: nowrap`)——
|
||
两个按钮被挤成两行正是因为该列没有下限、被长地址挤压;
|
||
② 编辑 → `.btn-edit`(实心蓝)、删除 → `.btn-del`(实心红)。
|
||
⚠️ 用 `.btn-edit` / `.btn-del` 而不是复用 `.btn-danger`:后者是**淡红描边**的
|
||
"危险动作"语义,全站十来处删除都在用;用户这次明确要的是**实心色块**。 */ ?>
|
||
<table class="table table-fixed cn-table">
|
||
<thead>
|
||
<tr>
|
||
<th class="cn-col-name">名称</th>
|
||
<th class="cn-col-place">所在地方</th>
|
||
<th class="cn-col-addr">详细地址</th>
|
||
<th class="cn-col-count">观影</th>
|
||
<?php if ($canWrite): ?><th class="cn-col-ops">操作</th><?php endif; ?>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<?php foreach ($cinemas as $c): ?>
|
||
<tr>
|
||
<td>
|
||
<span class="color-preview" style="background: <?= e((string)($c['color'] ?: '#888888')) ?>;"></span>
|
||
<b><?= e($c['name']) ?></b>
|
||
</td>
|
||
<td><?= e((string)($c['place'] ?? '')) !== '' ? e($c['place']) : '—' ?></td>
|
||
<td class="cn-addr"><?= !empty($c['address']) ? e($c['address']) : '—' ?></td>
|
||
<td><?= (int)$c['movie_count'] ?> 场</td>
|
||
<?php if ($canWrite): ?>
|
||
<td class="cn-col-ops">
|
||
<div class="actions cn-ops">
|
||
<a class="btn btn-edit btn-sm" href="<?= e(url('movies/cinemas', ['edit' => (int)$c['id']])) ?>">编辑</a>
|
||
<form method="post" action="<?= e(url('movies/cinemas_del')) ?>"
|
||
onsubmit="return confirm('确定删除「<?= e($c['name']) ?>」吗?关联观影记录的影院信息将置空。')">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="id" value="<?= (int)$c['id'] ?>">
|
||
<button type="submit" class="btn btn-del btn-sm">删除</button>
|
||
</form>
|
||
</div>
|
||
</td>
|
||
<?php endif; ?>
|
||
</tr>
|
||
<?php endforeach; ?>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<?php endif; ?>
|
||
</div>
|
||
|
||
<?php if ($canWrite): ?>
|
||
<script>
|
||
(function () {
|
||
var picker = document.getElementById('ccolor');
|
||
var hex = document.getElementById('colorHex');
|
||
if (!picker || !hex) return;
|
||
function setActive(color) {
|
||
Array.prototype.forEach.call(document.querySelectorAll('.preset-color'), function (el) {
|
||
el.classList.toggle('active', el.getAttribute('data-color') === color);
|
||
});
|
||
}
|
||
picker.addEventListener('input', function () {
|
||
hex.textContent = picker.value;
|
||
setActive(picker.value);
|
||
});
|
||
Array.prototype.forEach.call(document.querySelectorAll('.preset-color'), function (el) {
|
||
el.addEventListener('click', function () {
|
||
picker.value = el.getAttribute('data-color');
|
||
hex.textContent = picker.value;
|
||
setActive(picker.value);
|
||
});
|
||
});
|
||
setActive(picker.value);
|
||
})();
|
||
</script>
|
||
<?php endif; ?>
|