Merge pull request '扩充整页模板,支持移除首屏和控制页头页脚' (#14) from ChatGPT/laysense.cn:page-layout-controls into main

Reviewed-on: #14
This commit was merged in pull request #14.
This commit is contained in:
2026-11-22 13:45:33 +08:00
27 changed files with 293 additions and 44 deletions
+2 -1
View File
@@ -28,7 +28,8 @@ php bin/admin.php reset admin@example.com
## 后台编辑 ## 后台编辑
- **网站后台**可按名称、地址或发布状态查找页面,从列表打开画布、公开页或草稿预览。 - **网站后台**可按名称、地址或发布状态查找页面,从列表打开画布、公开页或草稿预览。
- **整页模板**可以从后台首页、新建页面或画布打开独立抽屉。先选套系,再选页面,查看缩略图或完整预览后创建草稿。首屏和各个区块可继续使用现有编辑器修改。主题样式只由使用模板的公开页及预览加载,抽屉样式和交互只由有入口的后台页面加载。首批三个套系参考 [Hallmark](https://github.com/nutlope/hallmark) 的 Cobalt、Studio 和 Dusk。 - **整页模板**可以从后台首页、新建页面或画布打开独立抽屉。先选套系,再选页面,查看缩略图或完整预览后创建草稿。主题样式只由使用模板的公开页及预览加载,抽屉资源只由有入口的后台页面加载。六个套系共十二个页面,参考 [Hallmark](https://github.com/nutlope/hallmark) 的 Cobalt、Studio、Dusk、Vantage、Ribbon 和 Furrow。
- **页面显示**可以分别开关页头、首屏和页脚。选中画布里的首屏标题可移除首屏,并在页面设置中恢复。选中普通区块标题可删除整个区块,保存页面后生效。
- **页面设计**支持新建草稿、发布和撤回。首屏标题与简介可在桌面或手机画布中直接编辑。区块支持新增、排序、删除、可视化编辑、媒体插入和 HTML 源码。单击画布元素可用浮动工具条复制或删除。选中媒体后,可拖动边缘手柄调整宽度。浮动工具条可将正文元素、区块标题和首屏元素对齐到左侧、中央或右侧。编辑器左侧分为「组件」「元素」「图层」。先进入分类,再查找并插入模板或基础元素。可在功能分类中复用产品图文、特性组、服务报价等内置模板,徽标、按钮组、面包屑、进度、通知和折叠等元素参考 [Preline UI 免费组件文档](https://preline.co/docs/index.html),用本站样式实现。悬停或键盘聚焦缩略图可放大,点击可打开预览。 - **页面设计**支持新建草稿、发布和撤回。首屏标题与简介可在桌面或手机画布中直接编辑。区块支持新增、排序、删除、可视化编辑、媒体插入和 HTML 源码。单击画布元素可用浮动工具条复制或删除。选中媒体后,可拖动边缘手柄调整宽度。浮动工具条可将正文元素、区块标题和首屏元素对齐到左侧、中央或右侧。编辑器左侧分为「组件」「元素」「图层」。先进入分类,再查找并插入模板或基础元素。可在功能分类中复用产品图文、特性组、服务报价等内置模板,徽标、按钮组、面包屑、进度、通知和折叠等元素参考 [Preline UI 免费组件文档](https://preline.co/docs/index.html),用本站样式实现。悬停或键盘聚焦缩略图可放大,点击可打开预览。
- **媒体库**集中列出项目静态文件及上传文件,支持查找、选取、复制路径、改名和归档。归档资源的已有 URL 保持可访问。上传文件放在 `LAYSENSE_MEDIA_DIR`,由 `/assets/uploads/` 提供。 - **媒体库**集中列出项目静态文件及上传文件,支持查找、选取、复制路径、改名和归档。归档资源的已有 URL 保持可访问。上传文件放在 `LAYSENSE_MEDIA_DIR`,由 `/assets/uploads/` 提供。
- **文章**使用自托管的 TOAST UI Editor 3.2.2(MIT)。Markdown 左侧源码、右侧实时预览,富文本使用所见即所得模式。文章可以加入多个分类,可在「管理分类」创建新分类。 - **文章**使用自托管的 TOAST UI Editor 3.2.2(MIT)。Markdown 左侧源码、右侧实时预览,富文本使用所见即所得模式。文章可以加入多个分类,可在「管理分类」创建新分类。
+3
View File
@@ -58,6 +58,9 @@ final class Database
if (!in_array('theme', $pageColumns, true)) { if (!in_array('theme', $pageColumns, true)) {
$pdo->exec("ALTER TABLE pages ADD COLUMN theme TEXT NOT NULL DEFAULT ''"); $pdo->exec("ALTER TABLE pages ADD COLUMN theme TEXT NOT NULL DEFAULT ''");
} }
if (!in_array('visibility', $pageColumns, true)) {
$pdo->exec("ALTER TABLE pages ADD COLUMN visibility TEXT NOT NULL DEFAULT '{}'");
}
$site = $pdo->prepare('INSERT OR IGNORE INTO site_settings (id, payload) VALUES (1, ?)'); $site = $pdo->prepare('INSERT OR IGNORE INTO site_settings (id, payload) VALUES (1, ?)');
$site->execute([self::json($seed['site'])]); $site->execute([self::json($seed['site'])]);
+7 -3
View File
@@ -62,7 +62,7 @@ final class Repository
if (!$page) { if (!$page) {
return null; return null;
} }
foreach (['actions', 'quicklinks', 'alignments'] as $key) { foreach (['actions', 'quicklinks', 'alignments', 'visibility'] as $key) {
$page[$key] = json_decode($page[$key], true, flags: JSON_THROW_ON_ERROR); $page[$key] = json_decode($page[$key], true, flags: JSON_THROW_ON_ERROR);
} }
$query = $this->pdo->prepare('SELECT * FROM sections WHERE page_slug = ? ORDER BY position, key'); $query = $this->pdo->prepare('SELECT * FROM sections WHERE page_slug = ? ORDER BY position, key');
@@ -88,11 +88,11 @@ final class Repository
{ {
Database::write(function (PDO $pdo) use ($slug, $data, $version, $sections): void { Database::write(function (PDO $pdo) use ($slug, $data, $version, $sections): void {
$query = $pdo->prepare('UPDATE pages SET name = ?, title = ?, description = ?, heading = ?, accent = ?, lead = ?, $query = $pdo->prepare('UPDATE pages SET name = ?, title = ?, description = ?, heading = ?, accent = ?, lead = ?,
image = ?, alt = ?, image_scale = ?, alignments = ?, actions = ?, quicklinks = ?, status = ?, updated_at = ?, version = version + 1 WHERE slug = ? AND version = ?'); image = ?, alt = ?, image_scale = ?, alignments = ?, actions = ?, quicklinks = ?, visibility = ?, status = ?, updated_at = ?, version = version + 1 WHERE slug = ? AND version = ?');
$query->execute([ $query->execute([
$data['name'], $data['title'], $data['description'], $data['heading'], $data['accent'], $data['lead'], $data['name'], $data['title'], $data['description'], $data['heading'], $data['accent'], $data['lead'],
$data['image'], $data['alt'], $data['image_scale'], Database::json($data['alignments']), Database::json($data['actions']), Database::json($data['quicklinks']), $data['image'], $data['alt'], $data['image_scale'], Database::json($data['alignments']), Database::json($data['actions']), Database::json($data['quicklinks']),
$data['status'], self::now(), $slug, $version, Database::json($data['visibility']), $data['status'], self::now(), $slug, $version,
]); ]);
self::checkVersion($query->rowCount()); self::checkVersion($query->rowCount());
foreach ($sections as $section) { foreach ($sections as $section) {
@@ -146,6 +146,10 @@ final class Repository
$query = $pdo->prepare('DELETE FROM sections WHERE page_slug = ? AND key = ? AND version = ?'); $query = $pdo->prepare('DELETE FROM sections WHERE page_slug = ? AND key = ? AND version = ?');
$query->execute([$page, $key, $version]); $query->execute([$page, $key, $version]);
self::checkVersion($query->rowCount()); self::checkVersion($query->rowCount());
$pdo->prepare("UPDATE pages SET
quicklinks = (SELECT json_group_array(json(value)) FROM json_each(quicklinks) WHERE json_extract(value, '$[0]') <> :anchor),
actions = (SELECT json_group_array(json(value)) FROM json_each(actions) WHERE json_extract(value, '$[0]') <> :anchor)
WHERE slug = :slug")->execute(['anchor' => '#' . $key, 'slug' => $page]);
} }
public function arrangeSection(string $page, string $key, string $operation, int $version, int $pageVersion): void public function arrangeSection(string $page, string $key, string $operation, int $version, int $pageVersion): void
+15 -3
View File
@@ -272,6 +272,18 @@ class AdminController
} }
$page = array_replace($page, $data, ['version' => $this->version($request)]); $page = array_replace($page, $data, ['version' => $this->version($request)]);
try { try {
$data['visibility'] = $page['visibility'];
foreach (['hero', 'header', 'footer'] as $area) {
$value = $request->post('show_' . $area);
if ($value === null) {
continue;
}
if (!in_array($value, ['0', '1'], true)) {
throw new RuntimeException('页面显示选项不正确。');
}
$data['visibility'][$area] = $value === '1';
}
$page['visibility'] = $data['visibility'];
$data['alignments'] = $request->post('alignments') === null ? $page['alignments'] $data['alignments'] = $request->post('alignments') === null ? $page['alignments']
: $this->alignmentMap(json_decode($this->input($request, 'alignments'), true), ['heading', 'lead', 'actions', 'image']); : $this->alignmentMap(json_decode($this->input($request, 'alignments'), true), ['heading', 'lead', 'actions', 'image']);
$page['alignments'] = $data['alignments']; $page['alignments'] = $data['alignments'];
@@ -279,7 +291,7 @@ class AdminController
if ($data['name'] === '' || mb_strlen($data['name']) > 100 || !in_array($data['status'], ['draft', 'published'], true) if ($data['name'] === '' || mb_strlen($data['name']) > 100 || !in_array($data['status'], ['draft', 'published'], true)
|| $data['title'] === '' || mb_strlen($data['title']) > 160 || || $data['title'] === '' || mb_strlen($data['title']) > 160 ||
($data['status'] === 'published' && $data['description'] === '') || mb_strlen($data['description']) > 300 || ($data['status'] === 'published' && $data['description'] === '') || mb_strlen($data['description']) > 300 ||
$data['heading'] === '' || mb_strlen($data['heading'] . $data['accent']) > 110 || (($data['visibility']['hero'] ?? true) && $data['heading'] === '') || mb_strlen($data['heading'] . $data['accent']) > 110 ||
mb_strlen($data['lead']) > 600 || mb_strlen($data['alt']) > 200 || mb_strlen($data['lead']) > 600 || mb_strlen($data['alt']) > 200 ||
($data['image_scale'] !== 0 && ($data['image_scale'] < 10 || $data['image_scale'] > 100)) || ($data['image_scale'] !== 0 && ($data['image_scale'] < 10 || $data['image_scale'] > 100)) ||
strlen($data['image']) > 1000 || ($data['image'] !== '' && !Html::url($data['image'], true)) || !$validButtons) { strlen($data['image']) > 1000 || ($data['image'] !== '' && !Html::url($data['image'], true)) || !$validButtons) {
@@ -365,8 +377,8 @@ class AdminController
throw new RuntimeException('区块已变更或画布内容无效,请重新打开编辑页。'); throw new RuntimeException('区块已变更或画布内容无效,请重新打开编辑页。');
} }
if ($delete) { if ($delete) {
if ($isNew || empty($available[$key]['feed'])) { if ($isNew) {
throw new RuntimeException('此区块不能通过模块工具删除。'); throw new RuntimeException('未保存的区块无需提交删除。');
} }
$updates[$key] = compact('key', 'version', 'delete'); $updates[$key] = compact('key', 'version', 'delete');
continue; continue;
+3 -2
View File
@@ -41,6 +41,7 @@ final class SiteController
{ {
$slug = $page['slug']; $slug = $page['slug'];
$isHome = $slug === 'home'; $isHome = $slug === 'home';
$showHero = $page['visibility']['hero'] ?? true;
$categories = $repo->categories(); $categories = $repo->categories();
foreach ($page['sections'] as &$section) { foreach ($page['sections'] as &$section) {
if (!$section['feed']) { if (!$section['feed']) {
@@ -75,8 +76,8 @@ final class SiteController
'path' => $isHome ? '/' : '/' . $slug, 'path' => $isHome ? '/' : '/' . $slug,
'title' => $page['title'], 'title' => $page['title'],
'description' => $page['description'], 'description' => $page['description'],
'socialImage' => $page['image'], 'socialImage' => $showHero ? $page['image'] : '',
'socialAlt' => $page['alt'], 'socialAlt' => $showHero ? $page['alt'] : '',
'previewMode' => $preview, 'canvas' => $preview && $canvas, 'noindex' => $preview, 'previewMode' => $preview, 'canvas' => $preview && $canvas, 'noindex' => $preview,
]); ]);
} }
+10
View File
@@ -122,6 +122,16 @@ $previewUrl = '/admin/pages/' . $slug . '/preview';
<label>页面名称<input name="name" value="<?= $e($page['name']) ?>" required maxlength="100"></label> <label>页面名称<input name="name" value="<?= $e($page['name']) ?>" required maxlength="100"></label>
<label>SEO 标题<input name="title" value="<?= $e($page['title']) ?>" required maxlength="160"></label> <label>SEO 标题<input name="title" value="<?= $e($page['title']) ?>" required maxlength="160"></label>
<label>SEO 描述<textarea name="description" rows="2" maxlength="300"><?= $e($page['description']) ?></textarea></label> <label>SEO 描述<textarea name="description" rows="2" maxlength="300"><?= $e($page['description']) ?></textarea></label>
<fieldset class="admin-options form-grid">
<legend>页面显示</legend>
<?php foreach (['header' => '页头', 'hero' => '首屏', 'footer' => '页脚'] as $area => $label): ?>
<?php $visible = $page['visibility'][$area] ?? true; ?>
<label><?= $e($label) ?><select name="show_<?= $e($area) ?>">
<option value="1" <?= $visible ? 'selected' : '' ?>>显示</option>
<option value="0" <?= !$visible ? 'selected' : '' ?>>隐藏</option>
</select></label>
<?php endforeach ?>
</fieldset>
<?php <?php
$contentFields = [ $contentFields = [
'heading' => $page['heading'], 'accent' => $page['accent'], 'lead' => $page['lead'], 'heading' => $page['heading'], 'accent' => $page['accent'], 'lead' => $page['lead'],
+1 -1
View File
@@ -3,7 +3,7 @@ use App\Content\View;
$e = View::escape(...); $e = View::escape(...);
?> ?>
<footer class="site-footer" id="contact"> <footer class="site-footer" id="contact"<?= empty($hideFooter) ? '' : ' hidden' ?>>
<div class="wrap"> <div class="wrap">
<div class="footer-grid"> <div class="footer-grid">
<div class="footer-company" itemscope itemtype="https://schema.org/Organization"> <div class="footer-company" itemscope itemtype="https://schema.org/Organization">
+8 -2
View File
@@ -17,6 +17,8 @@ $footer = SiteDesign::footer($site);
$nav = $header['links']; $nav = $header['links'];
$contact = $header['button']; $contact = $header['button'];
$theme = $page['theme'] ?? ''; $theme = $page['theme'] ?? '';
$showHeader = $page['visibility']['header'] ?? true;
$showFooter = $page['visibility']['footer'] ?? true;
?> ?>
<!doctype html> <!doctype html>
<html lang="zh-CN" data-type="<?= $e($kind) ?>" data-buttons="solid" data-motion="on"> <html lang="zh-CN" data-type="<?= $e($kind) ?>" data-buttons="solid" data-motion="on">
@@ -53,7 +55,8 @@ $theme = $page['theme'] ?? '';
</head> </head>
<body<?= $kind === 'service' ? ' class="copyright-service"' : '' ?>> <body<?= $kind === 'service' ? ' class="copyright-service"' : '' ?>>
<a class="skip-link" href="#main-content">跳到内容</a> <a class="skip-link" href="#main-content">跳到内容</a>
<header class="masthead"> <?php if ($showHeader || !empty($canvas)): ?>
<header class="masthead"<?= $showHeader ? '' : ' hidden' ?>>
<div class="wrap masthead-inner"> <div class="wrap masthead-inner">
<a class="wordmark" href="/" aria-label="来笙 Laysense 首页"> <a class="wordmark" href="/" aria-label="来笙 Laysense 首页">
<?php if ($header['logo'] !== ''): ?> <?php if ($header['logo'] !== ''): ?>
@@ -77,7 +80,10 @@ $theme = $page['theme'] ?? '';
<?php endif ?> <?php endif ?>
</div> </div>
</header> </header>
<?php endif ?>
<main id="main-content"<?= $theme !== '' ? ' class="page-theme theme-' . $e($theme) . '"' : '' ?> tabindex="-1"><?= $content ?></main> <main id="main-content"<?= $theme !== '' ? ' class="page-theme theme-' . $e($theme) . '"' : '' ?> tabindex="-1"><?= $content ?></main>
<?= View::fragment('footer', ['footer' => $footer]) ?> <?php if ($showFooter || !empty($canvas)): ?>
<?= View::fragment('footer', ['footer' => $footer, 'hideFooter' => !$showFooter]) ?>
<?php endif ?>
</body> </body>
</html> </html>
+11 -6
View File
@@ -6,12 +6,17 @@ use App\Content\View;
$e = View::escape(...); $e = View::escape(...);
$home = $page['slug'] === 'home'; $home = $page['slug'] === 'home';
$service = in_array($page['slug'], ['sc', 'shnu-sc'], true); $service = in_array($page['slug'], ['sc', 'shnu-sc'], true);
$showHero = $page['visibility']['hero'] ?? true;
$heroLinks = array_filter($page['sections'], static fn (array $section): bool => $section['style'] === 'hero-links');
$alignments = $page['alignments']; $alignments = $page['alignments'];
$alignField = static fn (string $name): string => $canvas ? ' data-studio-align-field="' . $name . '"' : ''; $alignField = static fn (string $name): string => $canvas ? ' data-studio-align-field="' . $name . '"' : '';
$field = static fn (string $name): string => $canvas ? ' data-studio-field="' . $name . '"' : ''; $field = static fn (string $name): string => $canvas ? ' data-studio-field="' . $name . '"' : '';
?> ?>
<?php if (!$showHero && !$canvas): ?><h1 class="sr-only"><?= $e($page['name']) ?></h1><?php endif ?>
<?php if ($showHero || $canvas || $heroLinks): ?>
<section class="hero hero-<?= $e($page['slug']) ?>" id="home" data-enter> <section class="hero hero-<?= $e($page['slug']) ?>" id="home" data-enter>
<div class="wrap hero-inner<?= $page['image'] === '' ? ' hero-text-only' : '' ?>"> <?php if ($showHero || $canvas): ?>
<div class="wrap hero-inner<?= $page['image'] === '' ? ' hero-text-only' : '' ?>"<?= $canvas ? ' data-studio-hero-content' : '' ?><?= $showHero ? '' : ' hidden' ?>>
<div class="hero-copy"> <div class="hero-copy">
<?php if (!$home): ?> <?php if (!$home): ?>
<nav class="breadcrumbs" aria-label="面包屑" itemscope itemtype="https://schema.org/BreadcrumbList"> <nav class="breadcrumbs" aria-label="面包屑" itemscope itemtype="https://schema.org/BreadcrumbList">
@@ -56,12 +61,12 @@ $field = static fn (string $name): string => $canvas ? ' data-studio-field="' .
</div> </div>
<?php endif ?> <?php endif ?>
</div> </div>
<?php foreach ($page['sections'] as $section): ?>
<?php if ($section['style'] === 'hero-links'): ?>
<?= View::fragment('section', ['section' => $section, 'moment' => false, 'canvas' => $canvas, 'pageSlug' => $page['slug']]) ?>
<?php endif ?> <?php endif ?>
<?php foreach ($heroLinks as $section): ?>
<?= View::fragment('section', ['section' => $section, 'moment' => false, 'canvas' => $canvas, 'pageSlug' => $page['slug']]) ?>
<?php endforeach ?> <?php endforeach ?>
</section> </section>
<?php endif ?>
<?php if ($canvas || $page['quicklinks']): ?> <?php if ($canvas || $page['quicklinks']): ?>
<nav class="section-nav" aria-label="本页目录"<?= $canvas ? ' data-studio-navigation' : '' ?><?= !$page['quicklinks'] ? ' hidden' : '' ?>> <nav class="section-nav" aria-label="本页目录"<?= $canvas ? ' data-studio-navigation' : '' ?><?= !$page['quicklinks'] ? ' hidden' : '' ?>>
<div class="wrap section-nav-inner"> <div class="wrap section-nav-inner">
@@ -76,8 +81,8 @@ $field = static fn (string $name): string => $canvas ? ' data-studio-field="' .
<?= View::fragment('section', ['section' => $section, 'moment' => $home && $section['key'] === 'about', 'canvas' => $canvas, 'pageSlug' => $page['slug']]) ?> <?= View::fragment('section', ['section' => $section, 'moment' => $home && $section['key'] === 'about', 'canvas' => $canvas, 'pageSlug' => $page['slug']]) ?>
<?php endif ?> <?php endif ?>
<?php endforeach ?> <?php endforeach ?>
<?php if ($credit = PageTemplates::photoCredit($page['image'])): ?> <?php if (($showHero || $canvas) && ($credit = PageTemplates::photoCredit($page['image']))): ?>
<p class="wrap page-photo-credit">摄影 <a href="<?= $e($credit[2]) ?>"><?= $e($credit[0]) ?></a> · <p class="wrap page-photo-credit"<?= $showHero ? '' : ' hidden' ?>>摄影 <a href="<?= $e($credit[2]) ?>"><?= $e($credit[0]) ?></a> ·
<?php if ($credit[3]): ?><a href="<?= $e($credit[3]) ?>"><?= $e($credit[1]) ?></a><?php else: ?><?= $e($credit[1]) ?><?php endif ?> <?php if ($credit[3]): ?><a href="<?= $e($credit[3]) ?>"><?= $e($credit[1]) ?></a><?php else: ?><?= $e($credit[1]) ?><?php endif ?>
</p> </p>
<?php endif ?> <?php endif ?>
+4
View File
@@ -40,8 +40,11 @@ $previewRoot = '/assets/page-templates/';
<section data-template-panel="detail" aria-labelledby="page-template-detail-heading" hidden> <section data-template-panel="detail" aria-labelledby="page-template-detail-heading" hidden>
<button type="button" class="button button-outline page-template-back" data-template-back="pages">返回套内页面</button> <button type="button" class="button button-outline page-template-back" data-template-back="pages">返回套内页面</button>
<h3 id="page-template-detail-heading" data-template-name tabindex="-1"></h3> <h3 id="page-template-detail-heading" data-template-name tabindex="-1"></h3>
<div class="page-template-detail">
<div>
<div class="page-template-image"><img data-template-preview width="768" height="480" alt=""></div> <div class="page-template-image"><img data-template-preview width="768" height="480" alt=""></div>
<a class="button button-outline page-template-preview-link" data-template-live target="_blank" rel="noopener">打开完整页面预览</a> <a class="button button-outline page-template-preview-link" data-template-live target="_blank" rel="noopener">打开完整页面预览</a>
</div>
<form class="admin-form" method="post" action="/admin/new-page"> <form class="admin-form" method="post" action="/admin/new-page">
<input type="hidden" name="csrf" value="<?= $e($token) ?>"> <input type="hidden" name="csrf" value="<?= $e($token) ?>">
<input type="hidden" name="template"> <input type="hidden" name="template">
@@ -51,6 +54,7 @@ $previewRoot = '/assets/page-templates/';
</div> </div>
<div class="form-submit"><button type="submit" class="button button-primary">用此模板创建草稿</button></div> <div class="form-submit"><button type="submit" class="button button-primary">用此模板创建草稿</button></div>
</form> </form>
</div>
</section> </section>
</div> </div>
</dialog> </dialog>
+7 -3
View File
@@ -2,7 +2,7 @@
position: fixed; position: fixed;
inset: 0 0 0 auto; inset: 0 0 0 auto;
margin: 0; margin: 0;
width: min(100%, 39rem); width: min(100%, clamp(45rem, 80vw, 78rem));
max-width: none; max-width: none;
height: 100dvh; height: 100dvh;
max-height: none; max-height: none;
@@ -33,7 +33,9 @@
.page-template-content h3:focus { outline: none; } .page-template-content h3:focus { outline: none; }
.page-template-back { margin-bottom: 1.15rem; } .page-template-back { margin-bottom: 1.15rem; }
.page-template-groups, .page-template-pages { display: grid; gap: .75rem; } .page-template-groups, .page-template-pages { display: grid; gap: .75rem; }
.page-template-groups { grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); }
.page-template-pages { grid-template-columns: repeat(2, minmax(0, 1fr)); } .page-template-pages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.page-template-detail { display: grid; gap: clamp(1rem, 3vw, 2rem); align-items: start; }
.page-template-card { .page-template-card {
display: grid; display: grid;
grid-template-columns: 1fr; grid-template-columns: 1fr;
@@ -46,7 +48,6 @@
border-radius: .7rem; border-radius: .7rem;
text-align: start; text-align: start;
} }
.page-template-groups .page-template-card { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: stretch; }
.page-template-card:hover, .page-template-card:focus-visible { border-color: var(--accent); } .page-template-card:hover, .page-template-card:focus-visible { border-color: var(--accent); }
.page-template-card-copy { display: grid; align-content: center; gap: .24rem; padding: clamp(.65rem, 2vw, 1rem); } .page-template-card-copy { display: grid; align-content: center; gap: .24rem; padding: clamp(.65rem, 2vw, 1rem); }
.page-template-card-copy small { line-height: 1.5; color: var(--muted); } .page-template-card-copy small { line-height: 1.5; color: var(--muted); }
@@ -54,7 +55,10 @@
.page-template-image img { width: 100%; height: auto; transition: transform 180ms ease; } .page-template-image img { width: 100%; height: auto; transition: transform 180ms ease; }
.page-template-card:hover img, .page-template-card:focus-visible img { transform: scale(1.035); } .page-template-card:hover img, .page-template-card:focus-visible img { transform: scale(1.035); }
.page-template-preview-link { margin-block: .8rem 1.2rem; } .page-template-preview-link { margin-block: .8rem 1.2rem; }
@media (min-width: 49rem) {
.page-template-detail { grid-template-columns: minmax(0, 1.8fr) minmax(17rem, 1fr); }
.page-template-detail .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 30rem) { @media (max-width: 30rem) {
.page-template-groups .page-template-card { grid-template-columns: 1fr; }
.page-template-pages { grid-template-columns: 1fr; } .page-template-pages { grid-template-columns: 1fr; }
} }
Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

+56
View File
@@ -114,3 +114,59 @@
.template-ledger article { gap: .4rem; } .template-ledger article { gap: .4rem; }
.template-steps { gap: .8rem; } .template-steps { gap: .8rem; }
} }
.theme-vantage {
--white: #121b20;
--paper: #1b272d;
--ink: #eef4f1;
--muted: #bdcdc8;
--line: #53676b;
--accent: #bfe971;
--accent-deep: #d7ffa0;
--accent-light: #2e4233;
}
.theme-vantage .hero {
background: radial-gradient(ellipse at 82% 35%, #243b39, transparent 65%),
radial-gradient(circle, #4b6959 1px, transparent 1.4px) 0 0 / 18px 18px, var(--white);
}
.theme-vantage .hero-copy { background: #121b20; padding-block: 1rem; }
.theme-vantage .app-frame { border: 1px solid #618076; border-radius: .2rem; background: #263738; box-shadow: 8px 8px 0 #172e26; }
.theme-vantage .app-frame img, .theme-vantage .button { border-radius: .2rem; }
.theme-vantage .button-primary, .theme-vantage .button-primary:hover { color: #172318; }
.theme-vantage .button-outline { border-color: #7d9b8e; color: var(--ink); }
.theme-vantage .button-outline:hover { background: var(--paper); }
.theme-ribbon {
--white: #fffdfb;
--paper: #f0eaf8;
--ink: #2d2546;
--muted: #5a516e;
--line: #d9cce8;
--accent: #633ab1;
--accent-deep: #4d268e;
--accent-light: #ebdfff;
}
.theme-ribbon .hero { background: radial-gradient(ellipse at 88% 24%, #d9c5f3, transparent 60%), #f5eff9; }
.theme-ribbon .app-frame { border-color: #b9a1db; border-radius: clamp(1.4rem, 4vw, 3rem); background: #fffafc; box-shadow: 0 22px 65px -31px #68489b83; }
.theme-ribbon .app-frame img { border-radius: 1rem; object-fit: cover; }
.theme-ribbon .button { border-radius: 2rem; }
.theme-ribbon .button-outline { border-color: #ac99c8; background: var(--white); }
.theme-ribbon .studio-split img { border-radius: 1.4rem; border: 1px solid var(--line); }
.theme-furrow {
--white: #fdf9ee;
--paper: #f1e9d5;
--ink: #262b1c;
--muted: #5a5847;
--line: #c9bd9f;
--accent: #325335;
--accent-deep: #233a27;
--accent-light: #e3ecd9;
}
.theme-furrow .hero { background: linear-gradient(115deg, #f7f0dd, #eee2c5); }
.theme-furrow .hero-copy { border-inline-start: .3rem solid #b67e28; padding-inline-start: clamp(1rem, 2.6vw, 2.2rem); }
.theme-furrow :is(h1, h2) { font-family: 'Noto Serif CJK SC', 'Songti SC', Georgia, serif; }
.theme-furrow .app-frame { border: 1px solid #9f946f; border-radius: .3rem; background: #fff8e7; box-shadow: 9px 9px 0 #c6ae7d56; }
.theme-furrow .app-frame img { border-radius: .15rem; }
.theme-furrow .button { border-radius: .2rem; }
.theme-furrow .button-outline { border-color: #908764; background: var(--white); }
+2 -1
View File
@@ -262,7 +262,7 @@ progress { width: 100%; height: .8rem; accent-color: var(--accent); }
.contact-panel { display: flex; flex-wrap: wrap; gap: 1.4rem 3rem; align-items: center; } .contact-panel { display: flex; flex-wrap: wrap; gap: 1.4rem 3rem; align-items: center; }
.contact-panel img { width: 10rem; border: 1px solid var(--line); } .contact-panel img { width: 10rem; border: 1px solid var(--line); }
.resource-box { max-width: 46rem; } .resource-box { max-width: 46rem; }
.faq { max-width: 62rem; border-top: 1px solid var(--line); } .faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); } .faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 1.05rem 2.5rem 1.05rem 0; min-height: 48px; position: relative; list-style: none; font-weight: 630; } .faq summary { cursor: pointer; padding: 1.05rem 2.5rem 1.05rem 0; min-height: 48px; position: relative; list-style: none; font-weight: 630; }
.faq summary::-webkit-details-marker { display: none; } .faq summary::-webkit-details-marker { display: none; }
@@ -479,6 +479,7 @@ progress { width: 100%; height: .8rem; accent-color: var(--accent); }
} }
.hero h1 .hero-heading-primary { color: inherit; } .hero h1 .hero-heading-primary { color: inherit; }
.studio-accent { display: block; } .studio-accent { display: block; }
[data-studio-editing] .hero:has(> [data-studio-hero-content][hidden]):not(:has(> .hero-directory-slot)) { display: none; }
[data-studio-editing] [contenteditable], [data-studio-editing] [data-studio-action], [data-studio-editing] [contenteditable], [data-studio-editing] [data-studio-action],
[data-studio-editing] [data-studio-navigation] a, [data-studio-editing] [data-studio-hero-image] { [data-studio-editing] [data-studio-navigation] a, [data-studio-editing] [data-studio-hero-image] {
outline: 1px dashed #7896d5; outline: 1px dashed #7896d5;
+44 -9
View File
@@ -306,8 +306,7 @@ jQuery(function ($) {
const $alignTools = $elementTools.find('[data-element-align]'); const $alignTools = $elementTools.find('[data-element-align]');
const alignments = ['left', 'center', 'right']; const alignments = ['left', 'center', 'right'];
const alignmentClasses = alignments.map((value) => 'studio-align-' + value); const alignmentClasses = alignments.map((value) => 'studio-align-' + value);
const heroOrOptional = '[data-studio-field="accent"], [data-studio-field="lead"], [data-studio-part="lead"], [data-studio-action], [data-studio-nav-index]'; const canvasFields = '[data-studio-field="heading"], [data-studio-field="accent"], [data-studio-field="lead"], [data-studio-part="title"], [data-studio-part="lead"], [data-studio-action], [data-studio-nav-index]';
const canvasFields = heroOrOptional + ', [data-studio-field="heading"], [data-studio-part="title"]';
const bodyElements = 'a, article, blockquote, details, div, dl, dt, dd, figure, h1, h2, h3, h4, h5, h6, hr, li, ol, p, pre, progress, table, ul'; const bodyElements = 'a, article, blockquote, details, div, dl, dt, dd, figure, h1, h2, h3, h4, h5, h6, hr, li, ol, p, pre, progress, table, ul';
const mediaTargets = '[data-studio-hero-image], [data-studio-part="body"] img, [data-studio-part="body"] audio, [data-studio-part="body"] video'; const mediaTargets = '[data-studio-hero-image], [data-studio-part="body"] img, [data-studio-part="body"] audio, [data-studio-part="body"] video';
const $handle = $studio.find('[data-media-handle]'); const $handle = $studio.find('[data-media-handle]');
@@ -359,7 +358,7 @@ jQuery(function ($) {
const $moduleForm = $moduleDialog.find('form'); const $moduleForm = $moduleDialog.find('form');
const moduleInput = (name) => $moduleForm.find('[name="' + name + '"]'); const moduleInput = (name) => $moduleForm.find('[name="' + name + '"]');
let editedModule; let editedModule;
let deletedModules = []; let deletedSections = [];
const propertyInput = (name) => $propertyForm.find('[name="' + name + '"]'); const propertyInput = (name) => $propertyForm.find('[name="' + name + '"]');
const pageInput = (name) => $settings.find('[name="' + name + '"]'); const pageInput = (name) => $settings.find('[name="' + name + '"]');
const settingsSnapshot = () => $settings.serializeArray() const settingsSnapshot = () => $settings.serializeArray()
@@ -402,7 +401,7 @@ jQuery(function ($) {
if (feedChanged) edit.feed = feed; if (feedChanged) edit.feed = feed;
return [edit]; return [edit];
}); });
return [...edits, ...deletedModules]; return [...edits, ...deletedSections];
} }
$settings.on('studio:sync', () => pageInput('canvas_sections').val(JSON.stringify(sectionChanges()))); $settings.on('studio:sync', () => pageInput('canvas_sections').val(JSON.stringify(sectionChanges())));
@@ -514,6 +513,15 @@ jQuery(function ($) {
} }
function bindPage($doc) { function bindPage($doc) {
const visibilityTargets = {header: '.masthead', hero: '[data-studio-hero-content], .page-photo-credit', footer: '.site-footer'};
for (const [area, selector] of Object.entries(visibilityTargets)) {
const $input = pageInput('show_' + area);
const $target = $doc.find(selector);
$input.on('change.canvas', () => {
selectElement(null);
$target.prop('hidden', $input.val() === '0');
});
}
const labels = {name: '页面名称', heading: '首屏标题', accent: '标题第二行', lead: '首屏简介'}; const labels = {name: '页面名称', heading: '首屏标题', accent: '标题第二行', lead: '首屏简介'};
$doc.find('[data-studio-field]').each(function () { $doc.find('[data-studio-field]').each(function () {
const field = this.dataset.studioField; const field = this.dataset.studioField;
@@ -622,6 +630,20 @@ jQuery(function ($) {
return $navContent.find('[data-studio-nav-index="' + (index + 1) + '"]').get(0); return $navContent.find('[data-studio-nav-index="' + (index + 1) + '"]').get(0);
}); });
$navInput.on('input.canvas', syncNavigation); $navInput.on('input.canvas', syncNavigation);
heroControls.set('remove-section-links', (key) => {
const anchor = '#' + key;
$navInput.val(navLines().filter((line) => {
const separator = line.indexOf('|');
return separator < 0 || line.slice(separator + 1).trim() !== anchor;
}).join('\n'));
syncNavigation();
for (const index of [1, 2]) {
const $url = pageInput('url' + index);
if ($url.val().trim() !== anchor) continue;
pageInput('label' + index).val('');
$url.val('').trigger('input');
}
});
heroControls.set('navigation', () => { heroControls.set('navigation', () => {
openProperties('本页目录', {quicklinks: $navInput.val()}, ({quicklinks}) => { openProperties('本页目录', {quicklinks: $navInput.val()}, ({quicklinks}) => {
$navInput.val(quicklinks); $navInput.val(quicklinks);
@@ -832,7 +854,10 @@ jQuery(function ($) {
const aligned = dynamic ? null : alignmentTarget(node); const aligned = dynamic ? null : alignmentTarget(node);
syncAlignmentButtons(aligned); syncAlignmentButtons(aligned);
$elementTools.find('[data-element-copy]').prop('hidden', !canCopy); $elementTools.find('[data-element-copy]').prop('hidden', !canCopy);
$elementTools.find('[data-element-delete]').prop('hidden', !dynamic && !inBody && !selectedMedia && !node.matches(heroOrOptional)); const deleteLabel = node.dataset.studioField === 'heading' ? '删除首屏'
: node.dataset.studioPart === 'title' ? '删除区块' : '删除';
$elementTools.find('[data-element-delete]').attr({'aria-label': deleteLabel, title: deleteLabel})
.prop('hidden', !dynamic && !inBody && !selectedMedia && !node.matches(canvasFields));
$elementTools.find('[data-element-properties]').prop('hidden', !hasProperties); $elementTools.find('[data-element-properties]').prop('hidden', !hasProperties);
if (target) showMediaWidth(currentMediaWidth(target)); if (target) showMediaWidth(currentMediaWidth(target));
selectionObserver?.observe(target || aligned || node); selectionObserver?.observe(target || aligned || node);
@@ -848,6 +873,15 @@ jQuery(function ($) {
return; return;
} }
const {studioField, studioAction, studioNavIndex} = node.dataset; const {studioField, studioAction, studioNavIndex} = node.dataset;
if (!copy && studioField === 'heading') {
pageInput('show_hero').val('0').trigger('change');
$studio.find('[data-canvas-status]').text('首屏已移除,可在页面设置中恢复。');
return;
}
if (!copy && node.dataset.studioPart === 'title') {
changeModule(sections.find((section) => section.node === node.closest('[data-studio-section]')), false);
return;
}
const inBody = node.closest('[data-studio-part="body"]') !== null; const inBody = node.closest('[data-studio-part="body"]') !== null;
selectElement(null); selectElement(null);
if (inBody) { if (inBody) {
@@ -958,9 +992,10 @@ jQuery(function ($) {
function removeSection(section) { function removeSection(section) {
if (section.node.contains(activeBody)) selectBody(null); if (section.node.contains(activeBody)) selectBody(null);
if (section.node.contains(selectedElement)) selectElement(null); if (section.node.contains(selectedElement)) selectElement(null);
if (section.version !== null) deletedModules.push({key: section.key, version: section.version, delete: true}); if (section.version !== null) deletedSections.push({key: section.key, version: section.version, delete: true});
section.node.remove(); section.node.remove();
sections = sections.filter((entry) => entry !== section); sections = sections.filter((entry) => entry !== section);
heroControls.get('remove-section-links')(section.key);
section.$pending?.remove(); section.$pending?.remove();
$pending.prop('hidden', !$pending.children().length); $pending.prop('hidden', !$pending.children().length);
} }
@@ -989,9 +1024,9 @@ jQuery(function ($) {
function changeModule(section, copy) { function changeModule(section, copy) {
if (!section) return; if (!section) return;
if (!copy) { if (!copy) {
if (window.confirm('删除此模块?保存页面后生效。')) { if (window.confirm('删除此区块?保存页面后生效。')) {
removeSection(section); removeSection(section);
$studio.find('[data-canvas-status]').text('模块已移除,保存页面后生效。'); $studio.find('[data-canvas-status]').text('区块已移除,保存页面后生效。');
} }
return; return;
} }
@@ -1178,7 +1213,7 @@ jQuery(function ($) {
selectElement(null); selectElement(null);
$pending.empty().prop('hidden', true); $pending.empty().prop('hidden', true);
sections = []; sections = [];
deletedModules = []; deletedSections = [];
$doc.find('[data-studio-section]').each((_, section) => registerSection(section)); $doc.find('[data-studio-section]').each((_, section) => registerSection(section));
$doc.on('focusin.canvas', '[contenteditable]', function () { $doc.on('focusin.canvas', '[contenteditable]', function () {
+104
View File
@@ -0,0 +1,104 @@
<?php
return [
'vantage' => [
'name' => 'Vantage · 观测台',
'description' => '蓝黑底色、仪表边框和青柠色操作入口,适合基础设施与运维说明。',
'pages' => [
'vantage-infrastructure' => [
'name' => '基础设施概览',
'heading' => '从一个界面看清解析服务。',
'description' => '为自托管服务整理部署入口、解析策略和故障排查资料。',
'image' => '/assets/original/highspeaker-ui-optimized.webp',
'alt' => 'HighSpeaker DNS 控制台',
'actions' => [['#deployment', '查看部署说明'], ['/highspeaker', '产品主页']],
'sections' => [
['deployment', '部署与管理', 'plain', <<<'HTML'
<div class="template-ledger"><article><h3>节点与入口</h3><p>记录实例位置、访问方式和部署依赖。</p></article><article><h3>解析策略</h3><p>按域名与访问来源整理实际使用的记录。</p></article><article><h3>变更流程</h3><p>先在测试环境复核结果,再更新对外服务。</p></article></div>
HTML, null],
['visibility', '检查服务可用性', 'tinted', <<<'HTML'
<div class="studio-split"><div><h3>记录预期结果</h3><p>每次变更后,从服务节点和外部网络分别发起查询。</p></div><pre class="studio-code"><code>dig @127.0.0.1 example.com A</code></pre></div>
HTML, null],
['infra-resources', '产品与支持', 'plain', '<ul class="studio-resources"><li><a href="/highspeaker">查看 HighSpeaker DNS</a><span>产品文档</span></li><li><a href="/contact">联系来笙</a><span>技术咨询</span></li></ul>', null],
],
],
'vantage-runbook' => [
'name' => '运维操作手册',
'heading' => '按步骤排查服务故障。',
'description' => '把常用的检查、回退和交接步骤集中到一页,方便团队值班时使用。',
'image' => '',
'alt' => '',
'actions' => [['#first-checks', '开始排查']],
'sections' => [
['first-checks', '先核对这三项', 'plain', '<ol class="template-steps"><li><h3>确认影响范围</h3><p>检查是单一区域受影响,还是所有请求都失败。</p></li><li><h3>查看最近变更</h3><p>核对配置、证书与部署记录。</p></li><li><h3>比对响应</h3><p>比较本地与公开地址的访问结果。</p></li></ol>', null],
['recovery', '恢复与回退', 'tinted', '<ul class="studio-checklist"><li>保留当前配置与日志。</li><li>按团队约定恢复最近的可用配置。</li><li>从两个网络确认服务恢复。</li></ul>', null],
['handover', '交接记录', 'plain', '<div class="table-scroll"><table><thead><tr><th scope="col">事项</th><th scope="col">记录内容</th></tr></thead><tbody><tr><td>异常时间</td><td>开始、发现及恢复时间。</td></tr><tr><td>变更</td><td>执行过的动作和结果。</td></tr><tr><td>负责人</td><td>后续处理人和待办事项。</td></tr></tbody></table></div>', null],
],
],
],
],
'ribbon' => [
'name' => 'Ribbon · 柔彩',
'description' => '柔紫色封面、圆角图片与清晰的步骤组合,适合入门教程与帮助中心。',
'pages' => [
'ribbon-onboarding' => [
'name' => '新手入门页',
'heading' => '做出你的第一个网页。',
'description' => '从选模板、编辑组件到检查手机预览,走完一次完整的建站流程。',
'image' => '/assets/original/pagepan-example.webp',
'alt' => 'PAGEPAN 网页模板示例',
'actions' => [['#start-building', '开始学习'], ['/pagepan', '查看 PAGEPAN']],
'sections' => [
['start-building', '从三个动作开始', 'plain', '<ol class="template-steps"><li><h3>选一个版式</h3><p>用符合内容结构的模板开工。</p></li><li><h3>替换内容</h3><p>换上自己的文案、照片和链接。</p></li><li><h3>检查预览</h3><p>分别用桌面和手机尺寸浏览。</p></li></ol>', null],
['editor-tour', '认识编辑器', 'tinted', '<div class="studio-split"><img src="/assets/original/pagepan-editor-optimized.webp" alt="PAGEPAN 画布" loading="lazy"><div><h3>在画布上选中元素</h3><p>修改内容后,保留必要的导航和行动按钮。</p></div></div>', null],
['more-lessons', '继续学习', 'plain', '<ul class="studio-resources"><li><a href="/pagepan#download">获取 PAGEPAN</a><span>下载</span></li><li><a href="/articles">浏览产品动态</a><span>更新与文章</span></li></ul>', null],
],
],
'ribbon-help' => [
'name' => '产品帮助中心',
'heading' => '找到你眼下需要的帮助。',
'description' => '给访客一个独立入口,集中查看入门资料、常见问题和联系渠道。',
'image' => '/assets/original/home-hero.webp',
'alt' => '来笙云服务插画',
'actions' => [['#common-questions', '查看常见问题'], ['/contact', '联系支持']],
'sections' => [
['documentation', '快速入口', 'plain', '<ul class="studio-resources"><li><a href="/pagepan">可视化建站</a><span>PAGEPAN</span></li><li><a href="/highspeaker">智能 DNS</a><span>HighSpeaker DNS</span></li><li><a href="/articles">公告与动态</a><span>最新文章</span></li></ul>', null],
['common-questions', '常见问题', 'tinted', '<div class="faq"><details><summary>在哪里找下载入口?</summary><div><p>打开产品页,再查看页面中的下载区块。</p></div></details><details><summary>如何反馈问题?</summary><div><p>通过联系页发送所用产品和版本、操作步骤及遇到的问题。</p></div></details></div>', null],
['support-options', '联系团队', 'plain', '<p class="actions"><a class="button button-primary" href="/contact">查看联系方式</a></p>', null],
],
],
],
],
'furrow' => [
'name' => 'Furrow · 田垄',
'description' => '暖纸色、墨绿和琥珀色线条,适合服务介绍与办理清单。',
'pages' => [
'furrow-service' => [
'name' => '服务说明页',
'heading' => '从准备材料到提交申请。',
'description' => '清楚列出软件著作权服务的办理流程,以及申请人需要准备的材料。',
'image' => '/assets/original/copyright.webp',
'alt' => '软件著作权服务配图',
'actions' => [['#service-steps', '了解流程'], ['/sc', '查看服务详情']],
'sections' => [
['service-steps', '服务如何开展', 'plain', '<ol class="studio-timeline"><li><h3>了解项目</h3><p>先明确软件用途、申请主体和材料现状。</p></li><li><h3>核对材料</h3><p>按项目情况整理代码、使用说明与必要文件。</p></li><li><h3>提交并跟进</h3><p>核对信息后提交,并按办理进度补充材料。</p></li></ol>', null],
['prepare', '申请前准备', 'tinted', '<div class="studio-two-column"><article><h3>已经有项目</h3><p>整理项目代码、软件说明和主体信息。</p></article><article><h3>需要协助</h3><p>说明当前进度,方便团队判断需要哪些服务。</p></article></div>', null],
['service-contact', '咨询办理方案', 'plain', '<p class="actions"><a class="button button-primary" href="/contact">联系来笙</a></p>', null],
],
],
'furrow-checklist' => [
'name' => '办事准备清单',
'heading' => '把要准备的材料一次列清。',
'description' => '适合发布可逐项核对的材料清单、办理须知与后续链接。',
'image' => '',
'alt' => '',
'actions' => [['#materials-list', '查看材料清单']],
'sections' => [
['materials-list', '准备材料', 'plain', '<ul class="studio-checklist"><li>软件名称、版本与用途说明</li><li>可用于提交的代码材料</li><li>能够说明安装和操作的用户指南</li><li>适用时准备合作开发和主体证明材料</li></ul>', null],
['before-submitting', '提交前核对', 'tinted', '<div class="template-ledger"><article><h3>名称一致</h3><p>核对各材料中的软件名称和版本。</p></article><article><h3>说明完整</h3><p>确保文档能解释主要操作。</p></article><article><h3>文件齐全</h3><p>按申请类型核对所需证明。</p></article></div>', null],
['next-actions', '下一步', 'plain', '<ul class="studio-resources"><li><a href="/sc">查看软著服务</a><span>流程与方案</span></li><li><a href="/contact">咨询材料问题</a><span>联系方式</span></li></ul>', null],
],
],
],
],
];
+1
View File
@@ -132,4 +132,5 @@ return [
], ],
], ],
], ],
...require __DIR__ . '/page-templates-extra.php',
]; ];
+1
View File
@@ -17,6 +17,7 @@ CREATE TABLE IF NOT EXISTS pages (
actions TEXT NOT NULL, actions TEXT NOT NULL,
quicklinks TEXT NOT NULL, quicklinks TEXT NOT NULL,
theme TEXT NOT NULL DEFAULT '', theme TEXT NOT NULL DEFAULT '',
visibility TEXT NOT NULL DEFAULT '{}',
status TEXT NOT NULL DEFAULT 'published' CHECK (status IN ('draft', 'published')), status TEXT NOT NULL DEFAULT 'published' CHECK (status IN ('draft', 'published')),
updated_at TEXT, updated_at TEXT,
version INTEGER NOT NULL DEFAULT 0 version INTEGER NOT NULL DEFAULT 0
+3 -2
View File
@@ -303,7 +303,8 @@ async function verifyPageTemplateDrawer(context, page, slug, csrf) {
await opener.click(); await opener.click();
const drawer = page.getByRole('dialog', {name: '整页模板'}); const drawer = page.getByRole('dialog', {name: '整页模板'});
const groups = drawer.locator('[data-template-group]:visible'); const groups = drawer.locator('[data-template-group]:visible');
assert.equal(await groups.count(), 3); const themes = ['cobalt', 'studio', 'dusk', 'vantage', 'ribbon', 'furrow'];
assert.equal(await groups.count(), themes.length);
const assertThumbnails = async (cards) => { const assertThumbnails = async (cards) => {
assert(await cards.locator('img').evaluateAll(async (images) => { assert(await cards.locator('img').evaluateAll(async (images) => {
await Promise.all(images.map((image) => image.decode())); await Promise.all(images.map((image) => image.decode()));
@@ -311,7 +312,7 @@ async function verifyPageTemplateDrawer(context, page, slug, csrf) {
})); }));
}; };
await assertThumbnails(groups); await assertThumbnails(groups);
for (const theme of ['cobalt', 'studio', 'dusk']) { for (const theme of themes) {
await drawer.locator(`[data-template-group="${theme}"]`).click(); await drawer.locator(`[data-template-group="${theme}"]`).click();
const pages = drawer.locator('[data-page-template]:visible'); const pages = drawer.locator('[data-page-template]:visible');
assert.equal(await pages.count(), 2); assert.equal(await pages.count(), 2);