Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
828dfc09f9 | ||
|
|
904812fd95 | ||
|
|
d6fee652db | ||
|
|
abccb8c004 | ||
|
|
2cf63b61ba | ||
|
|
2b01537cf3 | ||
|
|
2ef38bd716 |
@@ -27,12 +27,13 @@ php bin/admin.php reset admin@example.com
|
|||||||
|
|
||||||
## 后台编辑
|
## 后台编辑
|
||||||
|
|
||||||
- **页面设计**支持新建草稿、发布和撤回。首屏标题与简介可在桌面或手机画布中直接编辑。区块支持新增、排序、删除、可视化编辑、媒体插入和 HTML 源码。单击画布元素可用浮动工具条复制或删除。选中媒体后,可拖动边缘手柄调整宽度。浮动工具条可将正文元素、区块标题和首屏元素对齐到左侧、中央或右侧。编辑器左侧可插入基础元素,或按分类和名称查找区块模板。悬停或键盘聚焦缩略图可放大,点击可打开预览。
|
- **网站后台**可按名称、地址或发布状态查找页面,从列表打开画布、公开页或草稿预览。
|
||||||
|
- **页面设计**支持新建草稿、发布和撤回。首屏标题与简介可在桌面或手机画布中直接编辑。区块支持新增、排序、删除、可视化编辑、媒体插入和 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 左侧源码、右侧实时预览,富文本使用所见即所得模式。文章可以加入多个分类,可在「管理分类」创建新分类。
|
||||||
- **分类文章**支持在任意页面添加,保存区块后在「图层」中编辑分类、展示数量和合并或标签页模式。「查看全部动态」和翻页只列出该区块所选的分类。
|
- **分类文章**支持在任意页面添加,保存区块后在「图层」中编辑分类、展示数量和合并或标签页模式。「查看全部动态」和翻页只列出该区块所选的分类。
|
||||||
- **产品与服务**(`/services`)和**支持项目与合作伙伴**(`/network`)由文章分类生成。通过文章的目录卡片设置图片、链接和排序,使用草稿状态可从目录撤下。
|
- **产品与服务**(`/services`)和**支持项目与合作伙伴**(`/network`)由文章分类生成。通过文章的目录卡片设置图片、链接和排序,使用草稿状态可从目录撤下。
|
||||||
- **网站设置**分别编辑页头标志、导航及按钮,和页脚的公司信息、链接与备注。CDN 设置接受 HTTPS 源站地址。浏览器看到的公开 `/assets/…` 路径使用该源站。
|
- **网站设置**分别编辑页头标志、导航及按钮,和页脚的公司信息、产品、公司及资源链接和备注。页脚设置可恢复原站内容。CDN 设置接受 HTTPS 源站地址。浏览器看到的公开 `/assets/…` 路径使用该源站。
|
||||||
- 文章支持摘要和标签。状态选「草稿」可撤回公开文章。已发布文章改网址标识后,旧标识会自动跳转。
|
- 文章支持摘要和标签。状态选「草稿」可撤回公开文章。已发布文章改网址标识后,旧标识会自动跳转。
|
||||||
- 首页动态、分类列表和站点地图随发布状态更新。源代码和 SQLite 数据分开管理。安装命令可重复执行,已编辑的内容会保留。
|
- 首页动态、分类列表和站点地图随发布状态更新。源代码和 SQLite 数据分开管理。安装命令可重复执行,已编辑的内容会保留。
|
||||||
|
|
||||||
|
|||||||
@@ -8,16 +8,34 @@ final class BlockTemplates
|
|||||||
{
|
{
|
||||||
public const ARTICLE_FEED = '{"categories":["announcement","news","product"],"mode":"merged","limit":6}';
|
public const ARTICLE_FEED = '{"categories":["announcement","news","product"],"mode":"merged","limit":6}';
|
||||||
|
|
||||||
public const ELEMENTS = [
|
public const ELEMENT_GROUPS = [
|
||||||
'paragraph' => ['段落', '<p>填写正文。</p>'],
|
'text-elements' => ['文字与列表', [
|
||||||
'subheading' => ['小标题', '<h3>填写小标题</h3>'],
|
'paragraph' => ['段落', '<p>填写正文。</p>'],
|
||||||
'bullet-list' => ['项目列表', '<ul><li>填写列表项</li><li>填写列表项</li></ul>'],
|
'subheading' => ['小标题', '<h3>填写小标题</h3>'],
|
||||||
'button' => ['按钮', '<p><a class="button button-primary" href="#contact">联系来笙</a></p>'],
|
'lead' => ['导语', '<p class="studio-lead">填写本节的导语。</p>'],
|
||||||
'separator' => ['分割线', '<hr class="studio-divider">'],
|
'blockquote' => ['引用', '<blockquote><p>填写需要引用的内容。</p></blockquote>'],
|
||||||
'code' => ['代码块', '<pre class="studio-code"><code>填写代码</code></pre>'],
|
'bullet-list' => ['项目列表', '<ul><li>填写列表项</li><li>填写列表项</li></ul>'],
|
||||||
'image' => ['图片', '', 'image/'],
|
'ordered-list' => ['编号列表', '<ol><li>填写第一项</li><li>填写第二项</li></ol>'],
|
||||||
'video' => ['视频', '', 'video/'],
|
'definition-list' => ['术语说明', '<dl class="studio-definitions"><dt>填写术语</dt><dd>填写术语说明。</dd></dl>'],
|
||||||
'audio' => ['音频', '', 'audio/'],
|
]],
|
||||||
|
'link-elements' => ['链接与按钮', [
|
||||||
|
'button' => ['主按钮', '<p><a class="button button-primary" href="#contact">联系来笙</a></p>'],
|
||||||
|
'outline-button' => ['描边按钮', '<p><a class="button button-outline" href="/services">查看服务</a></p>'],
|
||||||
|
'text-link' => ['文字链接', '<p><a href="/articles">阅读文章</a></p>'],
|
||||||
|
'email-link' => ['邮件链接', '<p><a href="mailto:hello@example.com">发送邮件</a></p>'],
|
||||||
|
]],
|
||||||
|
'media-elements' => ['图片与影音', [
|
||||||
|
'image' => ['图片', '', 'image/'],
|
||||||
|
'video' => ['视频', '', 'video/'],
|
||||||
|
'audio' => ['音频', '', 'audio/'],
|
||||||
|
]],
|
||||||
|
'structure-elements' => ['版式与数据', [
|
||||||
|
'separator' => ['分割线', '<hr class="studio-divider">'],
|
||||||
|
'spacer' => ['留白', '<div class="studio-spacer"></div>'],
|
||||||
|
'code' => ['代码块', '<pre class="studio-code"><code>填写代码</code></pre>'],
|
||||||
|
'basic-table' => ['数据表格', '<table><thead><tr><th scope="col">名称</th><th scope="col">数据</th></tr></thead><tbody><tr><td>填写名称</td><td>填写数据</td></tr></tbody></table>'],
|
||||||
|
'disclosure' => ['折叠内容', '<div class="faq"><details><summary>填写折叠标题</summary><div><p>填写展开后的内容。</p></div></details></div>'],
|
||||||
|
]],
|
||||||
];
|
];
|
||||||
|
|
||||||
public const GROUPS = [
|
public const GROUPS = [
|
||||||
@@ -31,6 +49,7 @@ final class BlockTemplates
|
|||||||
'cover' => ['封面与横幅', [
|
'cover' => ['封面与横幅', [
|
||||||
'cover' => ['图文封面', '<div class="studio-cover"><img src="/assets/original/pagepan-example.webp" alt="" loading="lazy"><div><h3>用一句话介绍你的产品</h3><p>在首段说明访客能获得什么。</p><a class="button button-primary" href="/services">查看服务</a></div></div>'],
|
'cover' => ['图文封面', '<div class="studio-cover"><img src="/assets/original/pagepan-example.webp" alt="" loading="lazy"><div><h3>用一句话介绍你的产品</h3><p>在首段说明访客能获得什么。</p><a class="button button-primary" href="/services">查看服务</a></div></div>'],
|
||||||
'banner' => ['横幅', '<div class="studio-banner"><h3>用一句话介绍你的项目</h3><p>简要说明项目能为访客做什么。</p><a class="button button-primary" href="/services">了解更多</a></div>'],
|
'banner' => ['横幅', '<div class="studio-banner"><h3>用一句话介绍你的项目</h3><p>简要说明项目能为访客做什么。</p><a class="button button-primary" href="/services">了解更多</a></div>'],
|
||||||
|
'two-actions' => ['双按钮横幅', '<div class="studio-banner studio-banner-two"><div><h3>选择下一步</h3><p>介绍访客可以立即做什么。</p></div><div class="actions"><a class="button button-primary" href="/services">查看服务</a><a class="button button-outline" href="/#contact">联系我们</a></div></div>'],
|
||||||
]],
|
]],
|
||||||
'layout' => ['图文与布局', [
|
'layout' => ['图文与布局', [
|
||||||
'image' => ['图文', '<div class="studio-split"><img src="/assets/original/home-hero.webp" alt="" loading="lazy"><div><h3>介绍主题</h3><p>在这里说明图片或产品。</p></div></div>'],
|
'image' => ['图文', '<div class="studio-split"><img src="/assets/original/home-hero.webp" alt="" loading="lazy"><div><h3>介绍主题</h3><p>在这里说明图片或产品。</p></div></div>'],
|
||||||
@@ -51,11 +70,14 @@ final class BlockTemplates
|
|||||||
'faq' => ['常见问题', '<div class="faq"><details><summary>请输入问题</summary><div><p>请输入答案。</p></div></details></div>'],
|
'faq' => ['常见问题', '<div class="faq"><details><summary>请输入问题</summary><div><p>请输入答案。</p></div></details></div>'],
|
||||||
'timeline' => ['时间线', '<ol class="studio-timeline"><li><h3>确定目标</h3><p>填写这一阶段需要完成的事项。</p></li><li><h3>实施与验收</h3><p>填写交付时间与验收标准。</p></li></ol>'],
|
'timeline' => ['时间线', '<ol class="studio-timeline"><li><h3>确定目标</h3><p>填写这一阶段需要完成的事项。</p></li><li><h3>实施与验收</h3><p>填写交付时间与验收标准。</p></li></ol>'],
|
||||||
'checklist' => ['清单', '<ul class="studio-checklist"><li>填写必备材料</li><li>填写提交条件</li><li>填写确认事项</li></ul>'],
|
'checklist' => ['清单', '<ul class="studio-checklist"><li>填写必备材料</li><li>填写提交条件</li><li>填写确认事项</li></ul>'],
|
||||||
|
'changelog' => ['更新记录', '<div class="studio-releases"><article><h3>版本 2.0</h3><p>填写主要功能或改进。</p></article><article><h3>版本 1.0</h3><p>填写上一版本的更新内容。</p></article></div>'],
|
||||||
|
'pricing' => ['双方案报价', '<div class="card-grid price-grid studio-pricing"><article class="content-card price-card"><h3>基础方案</h3><p class="price-value">填写价格</p><p>填写方案包含的服务。</p><a class="button button-outline" href="/#contact">咨询基础方案</a></article><article class="content-card price-card"><h3>进阶方案</h3><p class="price-value">填写价格</p><p>填写扩展服务或权益。</p><a class="button button-primary" href="/#contact">咨询进阶方案</a></article></div>'],
|
||||||
]],
|
]],
|
||||||
'actions' => ['导航与引导', [
|
'actions' => ['导航与引导', [
|
||||||
'navigation' => ['快速导航', '<ul class="studio-quick-nav"><li><a href="/services">产品与服务</a></li><li><a href="/articles">动态与文章</a></li><li><a href="/#contact">联系来笙</a></li></ul>'],
|
'navigation' => ['快速导航', '<ul class="studio-quick-nav"><li><a href="/services">产品与服务</a></li><li><a href="/articles">动态与文章</a></li><li><a href="/#contact">联系来笙</a></li></ul>'],
|
||||||
'cta' => ['行动按钮', '<p>说明下一步。</p><p><a class="button button-primary" href="#contact">联系来笙</a></p>'],
|
'cta' => ['行动按钮', '<p>说明下一步。</p><p><a class="button button-primary" href="#contact">联系来笙</a></p>'],
|
||||||
'resources' => ['资料与链接', '<ul class="studio-resources"><li><a href="/pagepan#download">获取 PAGEPAN</a><span>应用下载</span></li><li><a href="/articles">浏览动态与文档</a><span>网站资源</span></li></ul>'],
|
'resources' => ['资料与链接', '<ul class="studio-resources"><li><a href="/pagepan#download">获取 PAGEPAN</a><span>应用下载</span></li><li><a href="/articles">浏览动态与文档</a><span>网站资源</span></li></ul>'],
|
||||||
|
'contact-card' => ['联系方式', '<div class="studio-contact"><div><h3>联系团队</h3><p>填写咨询范围与回复时间。</p></div><dl class="studio-definitions"><dt>电子邮件</dt><dd><a href="mailto:hello@example.com">hello@example.com</a></dd><dt>服务时间</dt><dd>填写工作时间</dd></dl></div>'],
|
||||||
]],
|
]],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Content;
|
||||||
|
|
||||||
|
use DOMDocument;
|
||||||
|
use DOMXPath;
|
||||||
|
|
||||||
|
final class DirectoryCard
|
||||||
|
{
|
||||||
|
public static function links(array $article, string $body): array
|
||||||
|
{
|
||||||
|
$detail = self::hasText($article['summary']) || self::hasBody($body) ? '/articles/' . $article['slug'] : '';
|
||||||
|
$primary = ($article['card']['url'] ?? '') ?: $detail;
|
||||||
|
|
||||||
|
return ['primary' => $primary, 'detail' => $primary === $detail ? '' : $detail];
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function hasText(string $text): bool
|
||||||
|
{
|
||||||
|
return preg_match('/[^\s\p{Z}\p{Cf}]/u', $text) === 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function hasBody(string $html): bool
|
||||||
|
{
|
||||||
|
if (self::hasText(html_entity_decode(strip_tags($html), ENT_QUOTES | ENT_HTML5, 'UTF-8'))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!str_contains($html, 'src=')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$document = new DOMDocument();
|
||||||
|
$document->loadHTML('<meta charset="utf-8">' . $html, LIBXML_NOERROR | LIBXML_NOWARNING | LIBXML_NONET);
|
||||||
|
$xpath = new DOMXPath($document);
|
||||||
|
|
||||||
|
return (bool) $xpath->evaluate('boolean(//img[@src] | //audio[@src] | //video[@src] | //audio/source[@src] | //video/source[@src])');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,14 +16,40 @@ final class SiteDesign
|
|||||||
];
|
];
|
||||||
|
|
||||||
public const DEFAULT_FOOTER = [
|
public const DEFAULT_FOOTER = [
|
||||||
'logo' => '/assets/wordmark.webp', 'alt' => '来笙 Laysense',
|
'logo' => '/assets/original/footer-wordmark.webp', 'alt' => '来笙 Laysense',
|
||||||
|
'name' => '上海来笙信息科技有限公司',
|
||||||
|
'address' => '中国(上海)自由贸易试验区世博村路231号2单元3层328室',
|
||||||
|
'email' => 'public@laysense.cn',
|
||||||
'products_title' => '产品与服务',
|
'products_title' => '产品与服务',
|
||||||
'products' => [['/pagepan', 'PAGEPAN 小飞页'], ['/highspeaker', 'HighSpeaker DNS'], ['/sc', '软著代理服务'], ['/shnu-sc', 'SHNU 学生软著服务']],
|
'products' => [['/highspeaker', 'HighSpeaker DNS'], ['/pagepan', 'PAGEPAN'], ['/sc', '软著代理服务']],
|
||||||
'company_title' => '公司',
|
'company_title' => '公司',
|
||||||
'company' => [['/#about', '关于来笙'], ['/articles', '来笙动态'], ['https://git.laysense.com', 'Laysense Git'], ['https://www.layso.de', 'LaySo']],
|
'company' => [['/#about', '关于来笙'], ['#contact', '联系来笙']],
|
||||||
|
'resources_title' => '资源',
|
||||||
|
'resources' => [['https://git.laysense.com', 'Laysense Git'], ['https://www.layso.de', 'LaySo']],
|
||||||
'phones' => [['tel:+16699004532', '+1 (669) 900 4532'], ['tel:+85257012856', '+852 5701 2856']],
|
'phones' => [['tel:+16699004532', '+1 (669) 900 4532'], ['tel:+85257012856', '+852 5701 2856']],
|
||||||
|
'copyright' => '© Shanghai Laysense Information Technology Co. Ltd. 2024',
|
||||||
|
'terms' => '本网站中产品价格仅作展示,不作为订立合同、邀约或要约邀请的有效因素。',
|
||||||
|
'registration' => '沪ICP备2024051698号-1',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public static function footer(array $site): array
|
||||||
|
{
|
||||||
|
$saved = $site['footer'] ?? null;
|
||||||
|
if ($saved === null) {
|
||||||
|
return self::DEFAULT_FOOTER;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Older configurations store the entire footer navigation in two columns.
|
||||||
|
if (!array_key_exists('resources', $saved)) {
|
||||||
|
$saved += ['resources' => [], 'resources_title' => ''];
|
||||||
|
if (!empty($saved['copyright'])) {
|
||||||
|
$saved['copyright'] .= ' 2024–' . date('Y');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $saved + self::DEFAULT_FOOTER;
|
||||||
|
}
|
||||||
|
|
||||||
public static function parseLinks(string $value): array
|
public static function parseLinks(string $value): array
|
||||||
{
|
{
|
||||||
$links = [];
|
$links = [];
|
||||||
|
|||||||
@@ -591,7 +591,7 @@ class AdminController
|
|||||||
], $status);
|
], $status);
|
||||||
}
|
}
|
||||||
|
|
||||||
return View::render($view, $data + ['token' => $token, 'user' => $this->user], $status, true);
|
return View::render($view, $data + ['token' => $token, 'user' => $this->user, 'adminPath' => $request->path()], $status, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function error(Request $request, string $message, int $status): Response
|
protected function error(Request $request, string $message, int $status): Response
|
||||||
|
|||||||
@@ -98,15 +98,16 @@ final class StudioController extends AdminController
|
|||||||
$site = (new Repository())->site();
|
$site = (new Repository())->site();
|
||||||
$defaults = match ($part) {
|
$defaults = match ($part) {
|
||||||
'header' => SiteDesign::DEFAULT_HEADER,
|
'header' => SiteDesign::DEFAULT_HEADER,
|
||||||
'footer' => SiteDesign::DEFAULT_FOOTER + array_intersect_key($site, array_flip(['name', 'address', 'email', 'copyright', 'registration', 'terms'])),
|
'footer' => SiteDesign::DEFAULT_FOOTER,
|
||||||
'cdn' => ['origin' => ''],
|
'cdn' => ['origin' => ''],
|
||||||
};
|
};
|
||||||
$config = ($site[$part] ?? []) + $defaults;
|
$config = $part === 'footer' ? SiteDesign::footer($site) : ($site[$part] ?? []) + $defaults;
|
||||||
$version = $site['revisions'][$part] ?? 0;
|
$version = $site['revisions'][$part] ?? 0;
|
||||||
$error = '';
|
$error = '';
|
||||||
if ($request->method() === 'POST') {
|
if ($request->method() === 'POST') {
|
||||||
try {
|
try {
|
||||||
$config = $this->settingsInput($request, $part, $defaults);
|
$config = $part === 'footer' && $request->post('operation') === 'restore-footer'
|
||||||
|
? $defaults : $this->settingsInput($request, $part, $defaults, $config);
|
||||||
SiteDesign::saveSettings($part, $config, $this->version($request));
|
SiteDesign::saveSettings($part, $config, $this->version($request));
|
||||||
|
|
||||||
return $this->success($request, '/admin/settings/' . $part . '?saved=1');
|
return $this->success($request, '/admin/settings/' . $part . '?saved=1');
|
||||||
@@ -177,13 +178,18 @@ final class StudioController extends AdminController
|
|||||||
return $this->success($request, '/admin/media');
|
return $this->success($request, '/admin/media');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function settingsInput(Request $request, string $part, array $defaults): array
|
private function settingsInput(Request $request, string $part, array $defaults, array $current): array
|
||||||
{
|
{
|
||||||
if ($part === 'cdn') {
|
if ($part === 'cdn') {
|
||||||
return ['origin' => Assets::cdn($this->input($request, 'origin'))];
|
return ['origin' => Assets::cdn($this->input($request, 'origin'))];
|
||||||
}
|
}
|
||||||
$result = [];
|
$result = [];
|
||||||
|
$hasResources = $request->post('resources') !== null;
|
||||||
foreach ($defaults as $key => $default) {
|
foreach ($defaults as $key => $default) {
|
||||||
|
if ($part === 'footer' && !$hasResources && in_array($key, ['resources', 'resources_title'], true)) {
|
||||||
|
$result[$key] = $current[$key];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$input = $this->input($request, $key);
|
$input = $this->input($request, $key);
|
||||||
if (is_array($default)) {
|
if (is_array($default)) {
|
||||||
$result[$key] = SiteDesign::parseLinks($input);
|
$result[$key] = SiteDesign::parseLinks($input);
|
||||||
|
|||||||
@@ -2,24 +2,58 @@
|
|||||||
use App\Content\View;
|
use App\Content\View;
|
||||||
|
|
||||||
$e = View::escape(...);
|
$e = View::escape(...);
|
||||||
|
$live = count(array_filter($pages, static fn (array $page): bool => $page['status'] === 'published'));
|
||||||
?>
|
?>
|
||||||
<header class="admin-heading">
|
<header class="admin-heading dashboard-heading">
|
||||||
<div><h1>内容管理</h1><p>管理网站页面、文章、公告和产品动态。</p></div>
|
<h1>网站后台</h1>
|
||||||
<div class="actions"><a class="button button-primary" href="/admin/new-page">新建页面</a>
|
<div class="actions">
|
||||||
<a class="button button-outline" href="/admin/articles/new">新建文章</a></div>
|
<a class="button button-primary" href="/admin/new-page">新建页面</a>
|
||||||
|
<a class="button button-outline" href="/admin/articles/new">写文章</a>
|
||||||
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<section class="admin-panel" aria-labelledby="pages-title">
|
<div class="dashboard-grid">
|
||||||
<h2 id="pages-title">网站页面</h2>
|
<section class="admin-panel dashboard-pages" aria-labelledby="pages-title" data-page-list>
|
||||||
<ul class="admin-list">
|
<div class="admin-heading compact">
|
||||||
<?php foreach ($pages as $page): ?>
|
<h2 id="pages-title">网站页面</h2>
|
||||||
<li>
|
<p class="field-note"><?= $live ?> 个已发布 · <?= count($pages) - $live ?> 个草稿</p>
|
||||||
<div><strong><?= $e($page['name']) ?></strong><small><?= $e($page['slug'] === 'home' ? '/' : '/' . $page['slug']) ?> · <?= $page['status'] === 'draft' ? '草稿' : '已发布' ?></small></div>
|
</div>
|
||||||
<a class="button button-outline" href="/admin/pages/<?= $e($page['slug']) ?>">编辑页面</a>
|
<div class="dashboard-filters" data-page-filters hidden>
|
||||||
</li>
|
<label>查找页面<input type="search" data-page-search placeholder="页面名称或地址"></label>
|
||||||
<?php endforeach ?>
|
<label>发布状态<select data-page-status>
|
||||||
</ul>
|
<option value="">全部状态</option>
|
||||||
</section>
|
<option value="published">已发布</option>
|
||||||
<section class="admin-panel" aria-labelledby="recent-title">
|
<option value="draft">草稿</option>
|
||||||
<div class="admin-heading compact"><h2 id="recent-title">最近编辑的文章</h2><a href="/admin/articles">管理全部文章</a></div>
|
</select></label>
|
||||||
<?= View::fragment('admin-article-list', ['articles' => $articles]) ?>
|
</div>
|
||||||
</section>
|
<p class="empty-state" data-page-empty role="status"<?= $pages ? ' hidden' : '' ?>><?= $pages ? '没有匹配的页面。' : '暂无页面。' ?></p>
|
||||||
|
<ul class="admin-list dashboard-page-list">
|
||||||
|
<?php foreach ($pages as $page): ?>
|
||||||
|
<?php $path = $page['slug'] === 'home' ? '/' : '/' . $page['slug']; $published = $page['status'] === 'published'; ?>
|
||||||
|
<li data-page-item="<?= $e($page['status']) ?>" data-page-label="<?= $e($page['name'] . ' ' . $page['title'] . ' ' . $path) ?>">
|
||||||
|
<div class="dashboard-page-label"><strong><?= $e($page['name']) ?></strong><small><?= $e($path) ?></small></div>
|
||||||
|
<span class="dashboard-page-state" data-published="<?= $published ? 'true' : 'false' ?>"><?= $published ? '已发布' : '草稿' ?></span>
|
||||||
|
<div class="dashboard-page-actions">
|
||||||
|
<a class="button button-outline" href="/admin/pages/<?= $e($page['slug']) ?>">编辑页面</a>
|
||||||
|
<a href="<?= $e($published ? $path : '/admin/pages/' . $page['slug'] . '/preview') ?>" target="_blank" rel="noopener"><?= $published ? '查看' : '预览' ?></a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
|
<div class="dashboard-secondary">
|
||||||
|
<section class="admin-panel" aria-labelledby="recent-title">
|
||||||
|
<div class="admin-heading compact"><h2 id="recent-title">最近编辑的文章</h2></div>
|
||||||
|
<?= View::fragment('admin-article-list', ['articles' => $articles]) ?>
|
||||||
|
<a class="back-link" href="/admin/articles">管理全部文章</a>
|
||||||
|
</section>
|
||||||
|
<section class="admin-panel dashboard-settings" aria-labelledby="quick-title">
|
||||||
|
<h2 id="quick-title">站点编辑</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="/admin/settings/header">编辑页头</a></li>
|
||||||
|
<li><a href="/admin/settings/footer">编辑页脚</a></li>
|
||||||
|
<li><a href="/admin/settings/cdn">静态资源 CDN</a></li>
|
||||||
|
<li><a href="/admin/media">打开媒体库</a></li>
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|||||||
+25
-11
@@ -2,6 +2,13 @@
|
|||||||
use App\Content\View;
|
use App\Content\View;
|
||||||
|
|
||||||
$e = View::escape(...);
|
$e = View::escape(...);
|
||||||
|
$active = match (true) {
|
||||||
|
str_starts_with($adminPath, '/admin/article') => 'articles',
|
||||||
|
str_starts_with($adminPath, '/admin/media') => 'media',
|
||||||
|
str_starts_with($adminPath, '/admin/settings') => 'settings',
|
||||||
|
$adminPath === '/admin/password' => '',
|
||||||
|
default => 'pages',
|
||||||
|
};
|
||||||
?>
|
?>
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="zh-CN">
|
<html lang="zh-CN">
|
||||||
@@ -29,18 +36,25 @@ $e = View::escape(...);
|
|||||||
<div class="admin-wrap admin-bar-inner">
|
<div class="admin-wrap admin-bar-inner">
|
||||||
<a class="wordmark" href="/admin" aria-label="来笙内容管理首页"><img src="/assets/wordmark.webp" alt="来笙 Laysense" width="130" height="33"></a>
|
<a class="wordmark" href="/admin" aria-label="来笙内容管理首页"><img src="/assets/wordmark.webp" alt="来笙 Laysense" width="130" height="33"></a>
|
||||||
<?php if ($user): ?>
|
<?php if ($user): ?>
|
||||||
<nav aria-label="后台导航">
|
<nav class="admin-primary" aria-label="后台导航">
|
||||||
<a href="/admin">页面</a>
|
<a href="/admin"<?= $active === 'pages' ? ' aria-current="page"' : '' ?>>页面</a>
|
||||||
<a href="/admin/articles">文章</a>
|
<a href="/admin/articles"<?= $active === 'articles' ? ' aria-current="page"' : '' ?>>文章</a>
|
||||||
<a href="/admin/media">媒体库</a>
|
<a href="/admin/media"<?= $active === 'media' ? ' aria-current="page"' : '' ?>>媒体库</a>
|
||||||
<a href="/admin/settings/header">网站设置</a>
|
<a href="/admin/settings/header"<?= $active === 'settings' ? ' aria-current="page"' : '' ?>>网站设置</a>
|
||||||
<a href="/admin/password">修改密码</a>
|
|
||||||
<a href="/">访问网站</a>
|
|
||||||
<form method="post" action="/admin/logout">
|
|
||||||
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
|
||||||
<button class="button button-outline" type="submit">退出</button>
|
|
||||||
</form>
|
|
||||||
</nav>
|
</nav>
|
||||||
|
<div class="admin-utility">
|
||||||
|
<a href="/">访问网站</a>
|
||||||
|
<details class="admin-account">
|
||||||
|
<summary>账户</summary>
|
||||||
|
<div class="admin-account-menu">
|
||||||
|
<a href="/admin/password">修改密码</a>
|
||||||
|
<form method="post" action="/admin/logout">
|
||||||
|
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
||||||
|
<button type="submit">退出登录</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
</div>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<a class="back-link" href="/">返回网站</a>
|
<a class="back-link" href="/">返回网站</a>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|||||||
+2
-51
@@ -2,7 +2,6 @@
|
|||||||
use App\Content\Database;
|
use App\Content\Database;
|
||||||
use App\Content\SiteDesign;
|
use App\Content\SiteDesign;
|
||||||
use App\Content\View;
|
use App\Content\View;
|
||||||
use App\Content\BlockTemplates;
|
|
||||||
|
|
||||||
$e = View::escape(...);
|
$e = View::escape(...);
|
||||||
$slug = $page['slug'];
|
$slug = $page['slug'];
|
||||||
@@ -20,56 +19,8 @@ $previewUrl = '/admin/pages/' . $slug . '/preview';
|
|||||||
<?= View::fragment('admin-feedback', compact('error', 'saved')) ?>
|
<?= View::fragment('admin-feedback', compact('error', 'saved')) ?>
|
||||||
<div class="studio-layout">
|
<div class="studio-layout">
|
||||||
<aside class="admin-panel studio-library" aria-labelledby="studio-library-title">
|
<aside class="admin-panel studio-library" aria-labelledby="studio-library-title">
|
||||||
<h2 id="studio-library-title">区块模板</h2>
|
<h2 id="studio-library-title">页面编辑</h2>
|
||||||
<?= View::fragment('studio-templates') ?>
|
<?= View::fragment('studio-templates', ['layers' => View::fragment('studio-layers', compact('page', 'slug', 'token'))]) ?>
|
||||||
<details class="studio-layers">
|
|
||||||
<summary>首屏与目录</summary>
|
|
||||||
<button type="button" disabled data-hero-control="image">首屏图片</button>
|
|
||||||
<button type="button" disabled data-hero-control="1">首屏按钮 1</button>
|
|
||||||
<button type="button" disabled data-hero-control="2">首屏按钮 2</button>
|
|
||||||
<button type="button" disabled data-hero-control="navigation">本页目录</button>
|
|
||||||
</details>
|
|
||||||
<details class="studio-layers">
|
|
||||||
<summary>按锚点新建区块</summary>
|
|
||||||
<form class="admin-form" method="post" action="/admin/page-blocks/<?= $e($slug) ?>">
|
|
||||||
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
|
||||||
<input type="hidden" name="operation" value="create">
|
|
||||||
<label>锚点<input name="key" pattern="[a-z0-9]+(-[a-z0-9]+)*" maxlength="70" placeholder="overview" required></label>
|
|
||||||
<label>模板<select name="preset">
|
|
||||||
<?php foreach (BlockTemplates::GROUPS as [$category, $templates]): ?>
|
|
||||||
<optgroup label="<?= $e($category) ?>">
|
|
||||||
<?php foreach ($templates as $preset => [$label]): ?>
|
|
||||||
<option value="<?= $e($preset) ?>"><?= $e($label) ?></option>
|
|
||||||
<?php endforeach ?>
|
|
||||||
</optgroup>
|
|
||||||
<?php endforeach ?>
|
|
||||||
</select></label>
|
|
||||||
<button type="submit" class="button button-outline">新建</button>
|
|
||||||
</form>
|
|
||||||
</details>
|
|
||||||
<details class="studio-layers" id="blocks">
|
|
||||||
<summary>区块顺序</summary>
|
|
||||||
<ul class="admin-list studio-blocks">
|
|
||||||
<?php foreach ($page['sections'] as $index => $item): ?>
|
|
||||||
<li>
|
|
||||||
<div><strong><?= $e($item['title']) ?></strong><small>#<?= $e($item['key']) ?></small></div>
|
|
||||||
<div class="actions studio-block-actions">
|
|
||||||
<button class="button button-outline" type="button" data-canvas-jump="<?= $e($item['key']) ?>" hidden>在画布编辑</button>
|
|
||||||
<a class="button button-outline" href="/admin/pages/<?= $e($slug) ?>/<?= $e($item['key']) ?>">区块设置</a>
|
|
||||||
<form method="post" action="/admin/page-blocks/<?= $e($slug) ?>">
|
|
||||||
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
|
||||||
<input type="hidden" name="key" value="<?= $e($item['key']) ?>">
|
|
||||||
<input type="hidden" name="page_version" value="<?= $e($page['version']) ?>">
|
|
||||||
<input type="hidden" name="version" value="<?= $e($item['version']) ?>">
|
|
||||||
<button class="button button-outline" name="operation" value="up" type="submit" <?= $index === 0 ? 'disabled' : '' ?>>上移</button>
|
|
||||||
<button class="button button-outline" name="operation" value="down" type="submit" <?= $index === count($page['sections']) - 1 ? 'disabled' : '' ?>>下移</button>
|
|
||||||
<button class="button button-outline" name="operation" value="delete" type="submit" data-confirm="删除这个区块?">删除</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<?php endforeach ?>
|
|
||||||
</ul>
|
|
||||||
</details>
|
|
||||||
</aside>
|
</aside>
|
||||||
<div class="studio-workspace">
|
<div class="studio-workspace">
|
||||||
<section class="admin-panel studio-preview" data-preview-studio aria-labelledby="studio-preview-title">
|
<section class="admin-panel studio-preview" data-preview-studio aria-labelledby="studio-preview-title">
|
||||||
|
|||||||
+25
-15
@@ -8,7 +8,7 @@ $e = View::escape(...);
|
|||||||
<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">
|
||||||
<?php if ($footer['logo'] !== ''): ?>
|
<?php if ($footer['logo'] !== ''): ?>
|
||||||
<a href="/" itemprop="url" aria-label="来笙 Laysense 首页">
|
<a class="footer-logo" href="/" itemprop="url" aria-label="来笙 Laysense 首页">
|
||||||
<img src="<?= $e($footer['logo']) ?>" alt="<?= $e($footer['alt']) ?>" width="130" height="33" itemprop="logo" loading="lazy">
|
<img src="<?= $e($footer['logo']) ?>" alt="<?= $e($footer['alt']) ?>" width="130" height="33" itemprop="logo" loading="lazy">
|
||||||
</a>
|
</a>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
@@ -17,31 +17,41 @@ $e = View::escape(...);
|
|||||||
<?php if ($footer['email']): ?>
|
<?php if ($footer['email']): ?>
|
||||||
<a itemprop="email" href="mailto:<?= $e($footer['email']) ?>"><?= $e($footer['email']) ?></a>
|
<a itemprop="email" href="mailto:<?= $e($footer['email']) ?>"><?= $e($footer['email']) ?></a>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
<p class="footer-payment-label">支持的付款方式</p>
|
||||||
<div class="payment-methods" aria-label="支持的付款方式">
|
<div class="payment-methods" aria-label="支持的付款方式">
|
||||||
<img src="/assets/original/payment-taobao.png" alt="淘宝" width="26" height="26" loading="lazy">
|
<img src="/assets/original/payment-taobao.png" alt="淘宝" width="26" height="26" loading="lazy">
|
||||||
<img src="/assets/original/payment-alipay.png" alt="支付宝" width="26" height="26" loading="lazy">
|
<img src="/assets/original/payment-alipay.png" alt="支付宝" width="26" height="26" loading="lazy">
|
||||||
<img src="/assets/original/payment-wechat.png" alt="微信支付" width="26" height="26" loading="lazy">
|
<img src="/assets/original/payment-wechat.png" alt="微信支付" width="26" height="26" loading="lazy">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php foreach (['products', 'company'] as $group): ?>
|
<nav class="footer-links" aria-label="页脚导航">
|
||||||
<?php if (!$footer[$group] && $footer[$group . '_title'] === '') { continue; } ?>
|
<?php foreach (['products', 'company', 'resources'] as $group): ?>
|
||||||
<div>
|
<?php if (!$footer[$group] && $footer[$group . '_title'] === '') { continue; } ?>
|
||||||
<?php if ($footer[$group . '_title'] !== ''): ?><p class="footer-label"><?= $e($footer[$group . '_title']) ?></p><?php endif ?>
|
<div>
|
||||||
<?php foreach ($footer[$group] as [$url, $label]): ?><a href="<?= $e($url) ?>"><?= $e($label) ?></a><?php endforeach ?>
|
<?php if ($footer[$group . '_title'] !== ''): ?><h2 class="footer-label"><?= $e($footer[$group . '_title']) ?></h2><?php endif ?>
|
||||||
</div>
|
<?php if ($footer[$group]): ?>
|
||||||
<?php endforeach ?>
|
<ul>
|
||||||
|
<?php foreach ($footer[$group] as [$url, $label]): ?><li><a href="<?= $e($url) ?>"><?= $e($label) ?></a></li><?php endforeach ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif ?>
|
||||||
|
</div>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
<div class="footer-meta">
|
<div class="footer-meta">
|
||||||
<?php if ($footer['copyright']): ?><p><?= $e($footer['copyright']) ?> 2024–<?= $e(date('Y')) ?></p><?php endif ?>
|
<?php if ($footer['copyright']): ?><p><?= $e($footer['copyright']) ?></p><?php endif ?>
|
||||||
<?php if ($footer['phones']): ?>
|
<?php if ($footer['email'] || $footer['phones']): ?>
|
||||||
<p>全球号码
|
<p>
|
||||||
<?php foreach ($footer['phones'] as $index => [$url, $label]): ?>
|
<?php if ($footer['email']): ?><a href="mailto:<?= $e($footer['email']) ?>"><?= $e($footer['email']) ?></a><?php endif ?>
|
||||||
<?= $index ? ' / ' : '' ?><a href="<?= $e($url) ?>"><?= $e($label) ?></a>
|
<?php if ($footer['phones']): ?>全球号码:
|
||||||
<?php endforeach ?>
|
<?php foreach ($footer['phones'] as $index => [$url, $label]): ?>
|
||||||
|
<?= $index ? ' / ' : '' ?><a href="<?= $e($url) ?>"><?= $e($label) ?></a>
|
||||||
|
<?php endforeach ?>
|
||||||
|
<?php endif ?>
|
||||||
</p>
|
</p>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?php if ($footer['registration']): ?><a href="https://beian.miit.gov.cn/"><?= $e($footer['registration']) ?></a><?php endif ?>
|
|
||||||
<?php if ($footer['terms']): ?><p class="footer-terms"><?= $e($footer['terms']) ?></p><?php endif ?>
|
<?php if ($footer['terms']): ?><p class="footer-terms"><?= $e($footer['terms']) ?></p><?php endif ?>
|
||||||
|
<?php if ($footer['registration']): ?><p><a href="https://beian.miit.gov.cn/"><?= $e($footer['registration']) ?></a></p><?php endif ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|||||||
+1
-1
@@ -13,7 +13,7 @@ if (str_starts_with($imageUrl, '/')) {
|
|||||||
$kind = in_array($page['slug'] ?? '', ['sc', 'shnu-sc'], true) ? 'service' : 'software';
|
$kind = in_array($page['slug'] ?? '', ['sc', 'shnu-sc'], true) ? 'service' : 'software';
|
||||||
$siteKind = $kind === 'service' ? 'other' : 'software';
|
$siteKind = $kind === 'service' ? 'other' : 'software';
|
||||||
$header = ($site['header'] ?? []) + SiteDesign::DEFAULT_HEADER;
|
$header = ($site['header'] ?? []) + SiteDesign::DEFAULT_HEADER;
|
||||||
$footer = ($site['footer'] ?? []) + SiteDesign::DEFAULT_FOOTER + $site;
|
$footer = SiteDesign::footer($site);
|
||||||
$nav = $header['links'];
|
$nav = $header['links'];
|
||||||
$contact = $header['button'];
|
$contact = $header['button'];
|
||||||
?>
|
?>
|
||||||
|
|||||||
+42
-43
@@ -1,43 +1,42 @@
|
|||||||
<?php
|
<?php
|
||||||
use App\Content\View;
|
use App\Content\DirectoryCard;
|
||||||
|
use App\Content\Html;
|
||||||
$e = View::escape(...);
|
use App\Content\View;
|
||||||
?>
|
|
||||||
<section class="section network" aria-label="支持项目与合作伙伴">
|
$e = View::escape(...);
|
||||||
<div class="wrap">
|
?>
|
||||||
<?php if (!$standalone): ?>
|
<section class="section network" aria-label="支持项目与合作伙伴">
|
||||||
<div class="section-heading inline-heading">
|
<div class="wrap">
|
||||||
<h2>支持项目与合作伙伴</h2>
|
<?php if (!$standalone): ?>
|
||||||
<a class="button button-outline" href="/network">查看全部</a>
|
<div class="section-heading inline-heading">
|
||||||
</div>
|
<h2>支持项目与合作伙伴</h2>
|
||||||
<?php endif ?>
|
<a class="button button-outline" href="/network">查看全部</a>
|
||||||
<?php foreach ($network as $slug => $group): ?>
|
</div>
|
||||||
<div class="network-group" id="<?= $e($slug) ?>">
|
<?php endif ?>
|
||||||
<?php if ($standalone): ?><h2><?= $e($group['name']) ?></h2><?php else: ?><h3><?= $e($group['name']) ?></h3><?php endif ?>
|
<?php foreach ($network as $slug => $group): ?>
|
||||||
<?php if (!$group['articles']): ?><p class="empty-state">暂无已发布条目。</p><?php endif ?>
|
<div class="network-group" id="<?= $e($slug) ?>">
|
||||||
<ul class="network-list">
|
<?php if ($standalone): ?><h2><?= $e($group['name']) ?></h2><?php else: ?><h3><?= $e($group['name']) ?></h3><?php endif ?>
|
||||||
<?php foreach ($group['articles'] as $item): ?>
|
<?php if (!$group['articles']): ?><p class="empty-state">暂无已发布条目。</p><?php endif ?>
|
||||||
<?php
|
<ul class="network-list">
|
||||||
// 优先跳卡片配置的网址;没有网址时,只有文章本身有内容才回退到文章页,否则不渲染链接。
|
<?php foreach ($group['articles'] as $item): ?>
|
||||||
$card = $item['card'];
|
<?php
|
||||||
$articlePath = '/articles/' . $item['slug'];
|
$card = $item['card'];
|
||||||
$hasDetail = $item['body'] !== '' || $item['summary'] !== '';
|
['primary' => $target, 'detail' => $detail] = DirectoryCard::links($item, Html::articleBody($item));
|
||||||
$target = ($card['url'] ?? '') ?: ($hasDetail ? $articlePath : '');
|
?>
|
||||||
?>
|
<li>
|
||||||
<li>
|
<?php if ($target !== ''): ?><a href="<?= $e($target) ?>"><?php else: ?><span class="network-static"><?php endif ?>
|
||||||
<?php if ($target !== ''): ?><a href="<?= $e($target) ?>"><?php else: ?><span class="network-static"><?php endif ?>
|
<?php if (!empty($card['image'])): ?>
|
||||||
<?php if (!empty($card['image'])): ?>
|
<img src="<?= $e($card['image']) ?>" alt="" loading="lazy" width="76" height="28">
|
||||||
<img src="<?= $e($card['image']) ?>" alt="" loading="lazy" width="76" height="28">
|
<?php endif ?>
|
||||||
<?php endif ?>
|
<span><?= $e($item['title']) ?></span>
|
||||||
<span><?= $e($item['title']) ?></span>
|
<?php if ($target !== ''): ?></a><?php else: ?></span><?php endif ?>
|
||||||
<?php if ($target !== ''): ?></a><?php else: ?></span><?php endif ?>
|
<?php if ($standalone && $detail !== ''): ?>
|
||||||
<?php if ($standalone && !empty($card['url']) && $hasDetail): ?>
|
<a class="network-detail" href="<?= $e($detail) ?>">查看详情</a>
|
||||||
<a class="network-detail" href="<?= $e($articlePath) ?>">查看详情</a>
|
<?php endif ?>
|
||||||
<?php endif ?>
|
</li>
|
||||||
</li>
|
<?php endforeach ?>
|
||||||
<?php endforeach ?>
|
</ul>
|
||||||
</ul>
|
</div>
|
||||||
</div>
|
<?php endforeach ?>
|
||||||
<?php endforeach ?>
|
</div>
|
||||||
</div>
|
</section>
|
||||||
</section>
|
|
||||||
|
|||||||
+50
-48
@@ -1,48 +1,50 @@
|
|||||||
<?php
|
<?php
|
||||||
use App\Content\Html;
|
use App\Content\DirectoryCard;
|
||||||
use App\Content\View;
|
use App\Content\Html;
|
||||||
|
use App\Content\View;
|
||||||
$e = View::escape(...);
|
|
||||||
?>
|
$e = View::escape(...);
|
||||||
<section class="section catalog-hero">
|
?>
|
||||||
<div class="wrap">
|
<section class="section catalog-hero">
|
||||||
<nav class="breadcrumbs" aria-label="面包屑"><a href="/">首页</a><span aria-hidden="true">/</span><span aria-current="page">产品与服务</span></nav>
|
<div class="wrap">
|
||||||
<h1>产品与服务</h1>
|
<nav class="breadcrumbs" aria-label="面包屑"><a href="/">首页</a><span aria-hidden="true">/</span><span aria-current="page">产品与服务</span></nav>
|
||||||
<p>自托管建站、开源智能 DNS 与软件著作权代理服务。</p>
|
<h1>产品与服务</h1>
|
||||||
</div>
|
<p>自托管建站、开源智能 DNS 与软件著作权代理服务。</p>
|
||||||
</section>
|
</div>
|
||||||
<section class="section catalog-listing" aria-label="产品与服务目录">
|
</section>
|
||||||
<div class="wrap">
|
<section class="section catalog-listing" aria-label="产品与服务目录">
|
||||||
<?php if (!$products): ?><p class="empty-state">暂无可查看的产品和服务。</p><?php endif ?>
|
<div class="wrap">
|
||||||
<div class="catalog-grid">
|
<?php if (!$products): ?><p class="empty-state">暂无可查看的产品和服务。</p><?php endif ?>
|
||||||
<?php foreach ($products as $product): ?>
|
<div class="catalog-grid">
|
||||||
<?php
|
<?php foreach ($products as $product): ?>
|
||||||
// 目录卡片指向卡片自己配置的网址;没有网址时,只有文章本身有内容才回退到文章页。
|
<?php
|
||||||
$card = $product['card'];
|
$card = $product['card'];
|
||||||
$hasDetail = $product['body'] !== '' || $product['summary'] !== '';
|
$body = Html::articleBody($product);
|
||||||
$target = ($card['url'] ?? '') ?: ($hasDetail ? '/articles/' . $product['slug'] : '');
|
['primary' => $target, 'detail' => $detail] = DirectoryCard::links($product, $body);
|
||||||
?>
|
$extra = $card['extra_url'] ?? '';
|
||||||
<article class="catalog-card">
|
?>
|
||||||
<?php if (!empty($card['image'])): ?>
|
<article class="catalog-card">
|
||||||
<div class="catalog-image"><img src="<?= $e($card['image']) ?>" alt="<?= $e($card['alt'] ?? '') ?>" loading="lazy"></div>
|
<?php if (!empty($card['image'])): ?>
|
||||||
<?php endif ?>
|
<div class="catalog-image"><img src="<?= $e($card['image']) ?>" alt="<?= $e($card['alt'] ?? '') ?>" loading="lazy"></div>
|
||||||
<div class="catalog-content">
|
<?php endif ?>
|
||||||
<?php if (!empty($card['category_label'])): ?><p class="overline"><?= $e($card['category_label']) ?></p><?php endif ?>
|
<div class="catalog-content">
|
||||||
<h2><?php if ($target !== ''): ?><a href="<?= $e($target) ?>"><?= $e($product['title']) ?></a><?php else: ?><?= $e($product['title']) ?><?php endif ?></h2>
|
<?php if (!empty($card['category_label'])): ?><p class="overline"><?= $e($card['category_label']) ?></p><?php endif ?>
|
||||||
<?php if ($product['summary']): ?>
|
<h2><?php if ($target !== ''): ?><a href="<?= $e($target) ?>"><?= $e($product['title']) ?></a><?php else: ?><?= $e($product['title']) ?><?php endif ?></h2>
|
||||||
<p><?= $e($product['summary']) ?></p>
|
<?php if ($product['summary']): ?>
|
||||||
<?php else: ?>
|
<p><?= $e($product['summary']) ?></p>
|
||||||
<div class="rich"><?= Html::articleBody($product) ?></div>
|
<?php else: ?>
|
||||||
<?php endif ?>
|
<div class="rich"><?= $body ?></div>
|
||||||
<?php if ($target !== '' || !empty($card['extra_url'])): ?>
|
<?php endif ?>
|
||||||
<div class="actions">
|
<?php if ($target !== '' || $extra !== ''): ?>
|
||||||
<?php if ($target !== ''): ?><a class="button button-primary" href="<?= $e($target) ?>"><?= $e(($card['label'] ?? '') ?: '了解详情') ?></a><?php endif ?>
|
<div class="actions">
|
||||||
<?php if (!empty($card['extra_url'])): ?><a href="<?= $e($card['extra_url']) ?>"><?= $e(($card['extra_label'] ?? '') ?: '相关链接') ?></a><?php endif ?>
|
<?php if ($target !== ''): ?><a class="button button-primary" href="<?= $e($target) ?>"><?= $e(($card['label'] ?? '') ?: '了解详情') ?></a><?php endif ?>
|
||||||
</div>
|
<?php if ($extra !== '' && $extra !== $target): ?><a href="<?= $e($extra) ?>"><?= $e(($card['extra_label'] ?? '') ?: '相关链接') ?></a><?php endif ?>
|
||||||
<?php endif ?>
|
<?php if ($detail !== '' && $detail !== $extra): ?><a class="catalog-detail" href="<?= $e($detail) ?>">查看详情</a><?php endif ?>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
<?php endif ?>
|
||||||
<?php endforeach ?>
|
</div>
|
||||||
</div>
|
</article>
|
||||||
</div>
|
<?php endforeach ?>
|
||||||
</section>
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Content\BlockTemplates;
|
||||||
|
use App\Content\View;
|
||||||
|
|
||||||
|
$e = View::escape(...);
|
||||||
|
?>
|
||||||
|
<details class="studio-layers">
|
||||||
|
<summary>首屏与目录</summary>
|
||||||
|
<button type="button" disabled data-hero-control="image">首屏图片</button>
|
||||||
|
<button type="button" disabled data-hero-control="1">首屏按钮 1</button>
|
||||||
|
<button type="button" disabled data-hero-control="2">首屏按钮 2</button>
|
||||||
|
<button type="button" disabled data-hero-control="navigation">本页目录</button>
|
||||||
|
</details>
|
||||||
|
<details class="studio-layers">
|
||||||
|
<summary>按锚点新建区块</summary>
|
||||||
|
<form class="admin-form" method="post" action="/admin/page-blocks/<?= $e($slug) ?>">
|
||||||
|
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
||||||
|
<input type="hidden" name="operation" value="create">
|
||||||
|
<label>锚点<input name="key" pattern="[a-z0-9]+(-[a-z0-9]+)*" maxlength="70" placeholder="overview" required></label>
|
||||||
|
<label>模板<select name="preset">
|
||||||
|
<?php foreach (BlockTemplates::GROUPS as [$category, $templates]): ?>
|
||||||
|
<optgroup label="<?= $e($category) ?>">
|
||||||
|
<?php foreach ($templates as $preset => [$label]): ?>
|
||||||
|
<option value="<?= $e($preset) ?>"><?= $e($label) ?></option>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</optgroup>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</select></label>
|
||||||
|
<button type="submit" class="button button-outline">新建</button>
|
||||||
|
</form>
|
||||||
|
</details>
|
||||||
|
<details class="studio-layers" id="blocks">
|
||||||
|
<summary>区块顺序</summary>
|
||||||
|
<ul class="admin-list studio-blocks">
|
||||||
|
<?php foreach ($page['sections'] as $index => $item): ?>
|
||||||
|
<li>
|
||||||
|
<div><strong><?= $e($item['title']) ?></strong><small>#<?= $e($item['key']) ?></small></div>
|
||||||
|
<div class="actions studio-block-actions">
|
||||||
|
<button class="button button-outline" type="button" data-canvas-jump="<?= $e($item['key']) ?>" hidden>在画布编辑</button>
|
||||||
|
<a class="button button-outline" href="/admin/pages/<?= $e($slug) ?>/<?= $e($item['key']) ?>">区块设置</a>
|
||||||
|
<form method="post" action="/admin/page-blocks/<?= $e($slug) ?>">
|
||||||
|
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
||||||
|
<input type="hidden" name="key" value="<?= $e($item['key']) ?>">
|
||||||
|
<input type="hidden" name="page_version" value="<?= $e($page['version']) ?>">
|
||||||
|
<input type="hidden" name="version" value="<?= $e($item['version']) ?>">
|
||||||
|
<button class="button button-outline" name="operation" value="up" type="submit" <?= $index === 0 ? 'disabled' : '' ?>>上移</button>
|
||||||
|
<button class="button button-outline" name="operation" value="down" type="submit" <?= $index === count($page['sections']) - 1 ? 'disabled' : '' ?>>下移</button>
|
||||||
|
<button class="button button-outline" name="operation" value="delete" type="submit" data-confirm="删除这个区块?">删除</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</ul>
|
||||||
|
</details>
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Content\View;
|
||||||
|
|
||||||
|
$e = View::escape(...);
|
||||||
|
$modules = $kind === 'modules';
|
||||||
|
?>
|
||||||
|
<section role="tabpanel" id="studio-panel-<?= $kind ?>" aria-labelledby="studio-tab-<?= $kind ?>" data-library-panel="<?= $kind ?>" hidden>
|
||||||
|
<ul class="studio-library-categories" data-library-index>
|
||||||
|
<?php foreach ($groups as $group => [$category, $items]): ?>
|
||||||
|
<li><button type="button" data-library-category="<?= $e($group) ?>" data-library-label="<?= $e($category) ?>">
|
||||||
|
<span><?= $e($category) ?></span><small><?= count($items) ?></small>
|
||||||
|
</button></li>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</ul>
|
||||||
|
<div class="studio-library-content" data-library-content hidden>
|
||||||
|
<div class="studio-library-category-title">
|
||||||
|
<button type="button" data-library-back>返回分类</button>
|
||||||
|
<h3 data-library-title></h3>
|
||||||
|
</div>
|
||||||
|
<label class="studio-template-search">查找本分类<input type="search" data-template-search autocomplete="off"></label>
|
||||||
|
<?php if ($modules): ?>
|
||||||
|
<label class="studio-insert-mode"><input type="checkbox" data-template-inline> 插入当前正文</label>
|
||||||
|
<?php endif ?>
|
||||||
|
<p class="field-note" data-template-empty hidden role="status">没有匹配的<?= $modules ? '组件' : '元素' ?>。</p>
|
||||||
|
<?php foreach ($groups as $group => [$category, $items]): ?>
|
||||||
|
<div class="<?= $modules ? 'studio-template-cards' : 'studio-element-items' ?>" data-template-group="<?= $e($group) ?>" hidden>
|
||||||
|
<?php foreach ($items as $key => $item): ?>
|
||||||
|
<?php [$label, $markup, $mime] = array_pad($item, 3, ''); ?>
|
||||||
|
<?php if ($modules): ?>
|
||||||
|
<article class="studio-template-card" data-template-card data-library-item data-template-search-text="<?= $e($label . ' ' . $key) ?>">
|
||||||
|
<button type="button" class="studio-template-image" data-template-preview="<?= $e($key) ?>" data-template-title="<?= $e($label) ?>"
|
||||||
|
aria-label="预览<?= $e($label) ?>组件">
|
||||||
|
<img src="/assets/template-previews/<?= $e($key) ?>.webp" alt="" width="768" height="480" loading="lazy">
|
||||||
|
</button>
|
||||||
|
<div class="studio-template-meta">
|
||||||
|
<span><?= $e($label) ?></span>
|
||||||
|
<button type="button" class="button button-outline" disabled data-canvas-template="<?= $e($key) ?>"
|
||||||
|
data-template-title="<?= $e($label) ?>" aria-label="添加<?= $e($label) ?>组件">添加</button>
|
||||||
|
</div>
|
||||||
|
<template data-preset="<?= $e($key) ?>"><?= $markup ?></template>
|
||||||
|
</article>
|
||||||
|
<?php else: ?>
|
||||||
|
<div data-library-item data-template-search-text="<?= $e($label . ' ' . $key) ?>">
|
||||||
|
<button type="button" disabled data-canvas-element="<?= $e($key) ?>"
|
||||||
|
<?php if ($mime): ?>data-element-mime="<?= $e($mime) ?>"<?php endif ?>
|
||||||
|
aria-label="插入<?= $e($label) ?>"><?= $e($label) ?></button>
|
||||||
|
<template data-element="<?= $e($key) ?>"><?= $markup ?></template>
|
||||||
|
</div>
|
||||||
|
<?php endif ?>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</div>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</div>
|
||||||
|
<?php if ($modules): ?>
|
||||||
|
<p class="field-note" data-template-status role="status"></p>
|
||||||
|
<ul class="studio-pending" data-template-pending aria-label="待保存区块" hidden></ul>
|
||||||
|
<?php else: ?>
|
||||||
|
<p class="field-note" data-element-status role="status"></p>
|
||||||
|
<?php endif ?>
|
||||||
|
</section>
|
||||||
@@ -36,7 +36,7 @@ $e = View::escape(...);
|
|||||||
<small>每行填写「显示号码 | tel:号码」。</small>
|
<small>每行填写「显示号码 | tel:号码」。</small>
|
||||||
</label>
|
</label>
|
||||||
<div class="form-grid">
|
<div class="form-grid">
|
||||||
<?php foreach (['products' => '第一列', 'company' => '第二列'] as $key => $text): ?>
|
<?php foreach (['products' => '第一列', 'company' => '第二列', 'resources' => '第三列'] as $key => $text): ?>
|
||||||
<div class="admin-form">
|
<div class="admin-form">
|
||||||
<label><?= $text ?>标题<input name="<?= $key ?>_title" value="<?= $e($config[$key . '_title']) ?>"></label>
|
<label><?= $text ?>标题<input name="<?= $key ?>_title" value="<?= $e($config[$key . '_title']) ?>"></label>
|
||||||
<label><?= $text ?>链接<textarea name="<?= $key ?>" rows="6"><?= $e(SiteDesign::linkText($config[$key])) ?></textarea>
|
<label><?= $text ?>链接<textarea name="<?= $key ?>" rows="6"><?= $e(SiteDesign::linkText($config[$key])) ?></textarea>
|
||||||
@@ -50,3 +50,11 @@ $e = View::escape(...);
|
|||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<div class="form-submit"><button class="button button-primary" type="submit">保存设置</button></div>
|
<div class="form-submit"><button class="button button-primary" type="submit">保存设置</button></div>
|
||||||
</form>
|
</form>
|
||||||
|
<?php if ($part === 'footer'): ?>
|
||||||
|
<form method="post" action="/admin/settings/footer">
|
||||||
|
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
||||||
|
<input type="hidden" name="version" value="<?= $e($revision) ?>">
|
||||||
|
<input type="hidden" name="operation" value="restore-footer">
|
||||||
|
<button class="button button-outline" type="submit" data-confirm="用原站的页脚内容覆盖当前页脚设置?">恢复原站页脚</button>
|
||||||
|
</form>
|
||||||
|
<?php endif ?>
|
||||||
|
|||||||
@@ -4,55 +4,22 @@ use App\Content\BlockTemplates;
|
|||||||
use App\Content\View;
|
use App\Content\View;
|
||||||
|
|
||||||
$e = View::escape(...);
|
$e = View::escape(...);
|
||||||
|
$labels = ['modules' => '组件', 'elements' => '元素', 'layers' => '图层'];
|
||||||
?>
|
?>
|
||||||
<div class="studio-presets" data-canvas-presets>
|
<div class="studio-presets" data-canvas-presets>
|
||||||
<details class="studio-element-library">
|
<div class="studio-library-tabs" role="tablist" aria-label="页面编辑工具" data-library-tabs hidden>
|
||||||
<summary>基础元素</summary>
|
<?php foreach ($labels as $kind => $label): ?>
|
||||||
<div role="group" aria-label="添加基础元素">
|
<button type="button" role="tab" id="studio-tab-<?= $kind ?>" aria-controls="studio-panel-<?= $kind ?>"
|
||||||
<?php foreach (BlockTemplates::ELEMENTS as $key => $element): ?>
|
aria-selected="false" tabindex="-1" data-library-tab="<?= $kind ?>"><?= $e($label) ?></button>
|
||||||
<?php [$label, $markup, $mime] = array_pad($element, 3, ''); ?>
|
|
||||||
<button type="button" disabled data-canvas-element="<?= $e($key) ?>"
|
|
||||||
<?php if ($mime): ?>data-element-mime="<?= $e($mime) ?>"<?php endif ?>
|
|
||||||
aria-label="插入<?= $e($label) ?>"><?= $e($label) ?></button>
|
|
||||||
<template data-element="<?= $e($key) ?>"><?= $markup ?></template>
|
|
||||||
<?php endforeach ?>
|
|
||||||
</div>
|
|
||||||
<p class="field-note" data-element-status role="status">选中画布正文后插入。</p>
|
|
||||||
</details>
|
|
||||||
<label class="studio-template-search">搜索模板<input type="search" data-template-search placeholder="按名称或分类搜索" autocomplete="off"></label>
|
|
||||||
<div class="studio-template-filters" role="group" aria-label="模板分类">
|
|
||||||
<button type="button" data-template-filter="" aria-pressed="true">全部</button>
|
|
||||||
<?php foreach (BlockTemplates::GROUPS as $group => [$category]): ?>
|
|
||||||
<button type="button" data-template-filter="<?= $e($group) ?>" aria-pressed="false"><?= $e($category) ?></button>
|
|
||||||
<?php endforeach ?>
|
|
||||||
</div>
|
|
||||||
<label class="studio-insert-mode"><input type="checkbox" data-template-inline> 插入当前正文</label>
|
|
||||||
<p class="field-note" data-template-status role="status"></p>
|
|
||||||
<ul class="studio-pending" data-template-pending hidden></ul>
|
|
||||||
<p class="field-note" data-template-empty hidden role="status">没有找到匹配的模板。</p>
|
|
||||||
<div class="studio-template-groups">
|
|
||||||
<?php foreach (BlockTemplates::GROUPS as $group => [$category, $templates]): ?>
|
|
||||||
<section class="studio-template-group" data-template-group="<?= $e($group) ?>" aria-labelledby="studio-template-<?= $e($group) ?>">
|
|
||||||
<h3 id="studio-template-<?= $e($group) ?>"><?= $e($category) ?></h3>
|
|
||||||
<div class="studio-template-cards">
|
|
||||||
<?php foreach ($templates as $preset => [$label, $markup]): ?>
|
|
||||||
<article class="studio-template-card" data-template-card data-template-search-text="<?= $e($label . ' ' . $category . ' ' . $preset) ?>">
|
|
||||||
<button type="button" class="studio-template-image" data-template-preview="<?= $e($preset) ?>" data-template-title="<?= $e($label) ?>"
|
|
||||||
aria-label="预览<?= $e($label) ?>模板">
|
|
||||||
<img src="/assets/template-previews/<?= $e($preset) ?>.webp" alt="" width="768" height="480" loading="lazy">
|
|
||||||
</button>
|
|
||||||
<div class="studio-template-meta">
|
|
||||||
<span><?= $e($label) ?></span>
|
|
||||||
<button type="button" class="button button-outline" disabled data-canvas-template="<?= $e($preset) ?>"
|
|
||||||
data-template-title="<?= $e($label) ?>" aria-label="添加<?= $e($label) ?>模板">添加</button>
|
|
||||||
</div>
|
|
||||||
<template data-preset="<?= $e($preset) ?>"><?= $markup ?></template>
|
|
||||||
</article>
|
|
||||||
<?php endforeach ?>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
</div>
|
</div>
|
||||||
|
<?php foreach (['modules' => BlockTemplates::GROUPS, 'elements' => BlockTemplates::ELEMENT_GROUPS] as $kind => $groups): ?>
|
||||||
|
<?= View::fragment('studio-library-panel', compact('kind', 'groups')) ?>
|
||||||
|
<?php endforeach ?>
|
||||||
|
<section role="tabpanel" id="studio-panel-layers" aria-labelledby="studio-tab-layers" data-library-panel="layers">
|
||||||
|
<?= $layers ?>
|
||||||
|
</section>
|
||||||
|
|
||||||
<div class="studio-template-peek" data-template-peek aria-hidden="true" hidden>
|
<div class="studio-template-peek" data-template-peek aria-hidden="true" hidden>
|
||||||
<img alt="">
|
<img alt="">
|
||||||
<p></p>
|
<p></p>
|
||||||
|
|||||||
+68
-21
@@ -167,19 +167,29 @@
|
|||||||
border: 1px solid var(--line);
|
border: 1px solid var(--line);
|
||||||
border-radius: .5rem;
|
border-radius: .5rem;
|
||||||
}
|
}
|
||||||
.studio-template-filters { display: flex; gap: .3rem; flex-wrap: wrap; margin-block: .25rem; }
|
.studio-library-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .2rem; padding: .22rem; margin-bottom: .45rem; border-radius: .6rem; background: var(--paper); }
|
||||||
.studio-template-filters button {
|
.studio-library-tabs button, .studio-library-categories button, .studio-library-category-title button, .studio-element-items button {
|
||||||
min-height: 36px;
|
color: var(--ink); font-family: inherit; cursor: pointer;
|
||||||
padding: .2rem .5rem;
|
|
||||||
color: var(--muted);
|
|
||||||
font-size: .825rem;
|
|
||||||
border: 1px solid var(--line);
|
|
||||||
border-radius: .35rem;
|
|
||||||
background: var(--white);
|
|
||||||
}
|
}
|
||||||
.studio-template-filters button[aria-pressed="true"] { border-color: #9bb5fa; color: var(--accent-deep); background: var(--accent-light); }
|
.studio-library-tabs button { min-height: 2.4rem; padding: .3rem .18rem; border: 1px solid transparent; border-radius: .42rem; background: transparent; font-size: .84rem; }
|
||||||
.studio-template-group + .studio-template-group { margin-top: .9rem; }
|
.studio-library-tabs button[aria-selected="true"] { border-color: var(--line); background: var(--white); color: var(--accent-deep); font-weight: 650; box-shadow: 0 1px 2px #182e5110; }
|
||||||
.studio-template-group h3 { margin: 0 0 .4rem; font-size: .9rem; font-weight: 650; }
|
.studio-library-categories { list-style: none; padding: 0; margin: 0; }
|
||||||
|
.studio-library-categories li + li { border-top: 1px solid var(--line); }
|
||||||
|
.studio-library-categories button, .studio-element-items button {
|
||||||
|
display: flex; gap: .35rem; align-items: center; width: 100%; min-height: 2.65rem; padding: .4rem .32rem;
|
||||||
|
text-align: left; border: 1px solid transparent; border-radius: .35rem; background: transparent; font-size: .9rem;
|
||||||
|
}
|
||||||
|
.studio-library-categories button::after { content: ''; width: .38rem; height: .38rem; border: solid currentColor; border-width: 1px 1px 0 0; rotate: 45deg; margin-inline-end: .25rem; }
|
||||||
|
.studio-library-categories small { margin-inline-start: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
|
||||||
|
.studio-library-content { display: grid; gap: .55rem; min-width: 0; }
|
||||||
|
.studio-library-category-title { display: grid; gap: .28rem; }
|
||||||
|
.studio-library-category-title h3 { font-size: 1rem; margin: 0; }
|
||||||
|
.studio-library-category-title button { justify-self: start; min-height: 2.25rem; padding: .25rem .45rem; background: var(--white); border: 1px solid var(--line); border-radius: .38rem; font-size: .8rem; }
|
||||||
|
.studio-library-category-title button::before { content: '‹'; margin-inline-end: .3em; }
|
||||||
|
.studio-element-items { display: grid; gap: .35rem; }
|
||||||
|
.studio-element-items button { justify-content: space-between; padding-inline: .55rem; border-color: var(--line); background: var(--white); }
|
||||||
|
.studio-element-items button::after { content: '+'; color: var(--accent-deep); }
|
||||||
|
.studio-element-items button:disabled { opacity: .55; cursor: wait; }
|
||||||
.studio-template-cards { display: grid; gap: .48rem; }
|
.studio-template-cards { display: grid; gap: .48rem; }
|
||||||
.studio-template-card { min-width: 0; border: 1px solid var(--line); border-radius: .55rem; background: var(--white); }
|
.studio-template-card { min-width: 0; border: 1px solid var(--line); border-radius: .55rem; background: var(--white); }
|
||||||
.studio-template-card:focus-within { border-color: var(--accent); }
|
.studio-template-card:focus-within { border-color: var(--accent); }
|
||||||
@@ -213,7 +223,7 @@
|
|||||||
.studio-template-dialog > .actions { justify-content: flex-end; margin-top: .75rem; }
|
.studio-template-dialog > .actions { justify-content: flex-end; margin-top: .75rem; }
|
||||||
|
|
||||||
@media (max-width: 54rem) {
|
@media (max-width: 54rem) {
|
||||||
.studio-template-groups { max-height: 44dvh; overflow-y: auto; padding: .2rem; }
|
.studio-library-content { max-height: 55dvh; overflow-y: auto; padding: .2rem; }
|
||||||
.studio-template-cards { grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); }
|
.studio-template-cards { grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); }
|
||||||
.studio-template-meta { flex-wrap: wrap; }
|
.studio-template-meta { flex-wrap: wrap; }
|
||||||
.studio-template-peek { display: none; }
|
.studio-template-peek { display: none; }
|
||||||
@@ -235,14 +245,51 @@
|
|||||||
.article-editor-heading > .button { min-height: 2.1rem; padding: .25rem .6rem; }
|
.article-editor-heading > .button { min-height: 2.1rem; padding: .25rem .6rem; }
|
||||||
.article-editor-help:empty { display: none; }
|
.article-editor-help:empty { display: none; }
|
||||||
|
|
||||||
.studio-element-library { padding: .55rem .65rem; border: 1px solid var(--line); border-radius: .5rem; }
|
|
||||||
.studio-element-library summary { font-size: .9rem; font-weight: 650; cursor: pointer; }
|
|
||||||
.studio-element-library [role="group"] { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .35rem; margin-top: .55rem; }
|
|
||||||
.studio-element-library button {
|
|
||||||
min-height: 2.35rem; padding: .2rem; border: 1px solid var(--line);
|
|
||||||
border-radius: .4rem; color: var(--ink); background: var(--white); font-size: .8rem; cursor: pointer;
|
|
||||||
}
|
|
||||||
.studio-element-library .field-note { margin: .45rem 0 0; font-size: .78rem; }
|
|
||||||
.studio-element-align { display: flex; gap: .05rem; padding-inline-end: .2rem; border-inline-end: 1px solid #ffffff55; }
|
.studio-element-align { display: flex; gap: .05rem; padding-inline-end: .2rem; border-inline-end: 1px solid #ffffff55; }
|
||||||
.studio-element-align button { padding-inline: .38rem; }
|
.studio-element-align button { padding-inline: .38rem; }
|
||||||
.studio-element-align button[aria-pressed="true"] { background: white; color: #244bc8; }
|
.studio-element-align button[aria-pressed="true"] { background: white; color: #244bc8; }
|
||||||
|
|
||||||
|
.admin-primary a { padding: .28rem .65rem; border-radius: .48rem; color: var(--muted); }
|
||||||
|
.admin-primary a[aria-current="page"] { background: var(--accent-light); color: var(--accent-deep); }
|
||||||
|
.admin-utility { display: flex; gap: .8rem; align-items: center; font-size: .88rem; }
|
||||||
|
.admin-utility > a { padding-block: .55rem; white-space: nowrap; }
|
||||||
|
.admin-account { position: relative; z-index: 5; }
|
||||||
|
.admin-account summary {
|
||||||
|
min-height: 2.45rem; padding: .43rem .6rem; border: 1px solid var(--line);
|
||||||
|
border-radius: .45rem; color: var(--ink); cursor: pointer;
|
||||||
|
}
|
||||||
|
.admin-account-menu {
|
||||||
|
position: absolute; inset: calc(100% + .4rem) 0 auto auto; min-width: 8rem; padding: .3rem;
|
||||||
|
border: 1px solid var(--line); border-radius: .5rem; background: white; box-shadow: 0 .55rem 1.5rem #1d315026;
|
||||||
|
}
|
||||||
|
.admin-account-menu a, .admin-account-menu button {
|
||||||
|
display: block; width: 100%; padding: .52rem .65rem; border: 0; border-radius: .3rem; background: white;
|
||||||
|
color: var(--ink); text-align: left; text-decoration: none; font: inherit; cursor: pointer;
|
||||||
|
}
|
||||||
|
.admin-account-menu :is(a, button):hover { background: var(--paper); color: var(--accent-deep); }
|
||||||
|
.dashboard-heading { margin-bottom: 1.55rem; }
|
||||||
|
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); align-items: start; gap: 1.05rem; }
|
||||||
|
.dashboard-grid .admin-panel { padding: clamp(.95rem, 2.3vw, 1.55rem); }
|
||||||
|
.dashboard-filters { display: grid; grid-template-columns: 1fr minmax(6.8rem, 9rem); gap: .7rem; margin-bottom: .8rem; }
|
||||||
|
.dashboard-filters label { display: grid; min-width: 0; gap: .25rem; font-size: .83rem; color: var(--muted); }
|
||||||
|
.dashboard-filters :is(input, select) { width: 100%; min-height: 2.65rem; padding: .38rem .52rem; border: 1px solid var(--line); border-radius: .45rem; color: var(--ink); background: var(--white); font: inherit; }
|
||||||
|
.dashboard-page-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .55rem .85rem; }
|
||||||
|
.dashboard-page-label { min-width: 0; overflow-wrap: anywhere; }
|
||||||
|
.dashboard-page-state { padding: .15rem .48rem; border-radius: .35rem; background: var(--paper); color: var(--muted); font-size: .78rem; white-space: nowrap; }
|
||||||
|
.dashboard-page-state[data-published="true"] { background: #e9f6ef; color: #1b6744; }
|
||||||
|
.dashboard-page-actions { display: flex; align-items: center; gap: .55rem; white-space: nowrap; }
|
||||||
|
.dashboard-page-actions > a { font-size: .84rem; }
|
||||||
|
.dashboard-page-actions > .button { min-height: 2.25rem; padding: .28rem .55rem; }
|
||||||
|
.dashboard-secondary .admin-list li { gap: .35rem .65rem; }
|
||||||
|
.dashboard-secondary .admin-list .button { min-height: 2.15rem; padding: .25rem .5rem; font-size: .82rem; }
|
||||||
|
.dashboard-settings h2 { margin-bottom: .55rem; }
|
||||||
|
.dashboard-settings ul { display: flex; flex-wrap: wrap; gap: .45rem 1.15rem; list-style: none; padding: 0; margin: 0; }
|
||||||
|
|
||||||
|
@media (max-width: 51rem) {
|
||||||
|
.dashboard-grid { grid-template-columns: 1fr; gap: 0; }
|
||||||
|
.admin-bar .admin-primary { order: 3; width: 100%; gap: .15rem .35rem; }
|
||||||
|
}
|
||||||
|
@media (max-width: 28rem) {
|
||||||
|
.dashboard-page-list li { grid-template-columns: minmax(0, 1fr) auto; }
|
||||||
|
.dashboard-page-actions { grid-column: 1 / -1; }
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,25 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
jQuery(function ($) {
|
jQuery(function ($) {
|
||||||
|
$('[data-page-list]').each(function () {
|
||||||
|
const $panel = $(this);
|
||||||
|
const $search = $panel.find('[data-page-search]');
|
||||||
|
const $status = $panel.find('[data-page-status]');
|
||||||
|
const $pages = $panel.find('[data-page-item]');
|
||||||
|
$panel.find('[data-page-filters]').prop('hidden', false);
|
||||||
|
$search.add($status).on('input change', function () {
|
||||||
|
const query = $search.val().trim().toLowerCase();
|
||||||
|
const status = $status.val();
|
||||||
|
let count = 0;
|
||||||
|
$pages.each(function () {
|
||||||
|
const visible = (!status || this.dataset.pageItem === status) && this.dataset.pageLabel.toLowerCase().includes(query);
|
||||||
|
$(this).prop('hidden', !visible);
|
||||||
|
if (visible) count++;
|
||||||
|
});
|
||||||
|
$panel.find('[data-page-empty]').prop('hidden', count !== 0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
const formats = {
|
const formats = {
|
||||||
markdown: {
|
markdown: {
|
||||||
heading: ['## ', '', '小标题'],
|
heading: ['## ', '', '小标题'],
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
+32
-9
@@ -282,7 +282,9 @@ progress { width: 100%; height: .8rem; accent-color: var(--accent); }
|
|||||||
.network-group + .network-group { margin-top: 2.2rem; }
|
.network-group + .network-group { margin-top: 2.2rem; }
|
||||||
.network-group h3 { margin-bottom: .8rem; }
|
.network-group h3 { margin-bottom: .8rem; }
|
||||||
.network-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); gap: .7rem; }
|
.network-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); gap: .7rem; }
|
||||||
.network-list li > * { display: flex; align-items: center; gap: .75rem; min-height: 4rem; height: 100%; border-radius: .65rem; background: var(--white); border: 1px solid var(--line); color: var(--ink); text-decoration: none; padding: .75rem; transition: transform 160ms ease, border-color 160ms ease; }
|
.network-list li { display: flex; flex-direction: column; gap: .35rem; }
|
||||||
|
.network-list li > * { display: flex; align-items: center; gap: .75rem; min-height: 4rem; border-radius: .65rem; background: var(--white); border: 1px solid var(--line); color: var(--ink); text-decoration: none; padding: .75rem; transition: transform 160ms ease, border-color 160ms ease; }
|
||||||
|
.network-list li > :first-child { flex: 1; }
|
||||||
.network-list a:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--accent); }
|
.network-list a:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--accent); }
|
||||||
.network-list img { max-width: 3rem; max-height: 1.8rem; object-fit: contain; object-position: left; }
|
.network-list img { max-width: 3rem; max-height: 1.8rem; object-fit: contain; object-position: left; }
|
||||||
.network-list img[src$="oneprovider_invert.svg"] { background: #29354a; border-radius: .25rem; padding: .21rem; }
|
.network-list img[src$="oneprovider_invert.svg"] { background: #29354a; border-radius: .25rem; padding: .21rem; }
|
||||||
@@ -301,18 +303,22 @@ progress { width: 100%; height: .8rem; accent-color: var(--accent); }
|
|||||||
.pagination { display: flex; align-items: center; gap: 1rem; margin-top: 1.5rem; }
|
.pagination { display: flex; align-items: center; gap: 1rem; margin-top: 1.5rem; }
|
||||||
.empty-state { background: var(--paper); padding: 1rem; border-radius: .6rem; }
|
.empty-state { background: var(--paper); padding: 1rem; border-radius: .6rem; }
|
||||||
|
|
||||||
.site-footer { padding: clamp(2.5rem, 5.8vw, 5.5rem) 0 2rem; background: #edf2fa; border-top: 1px solid var(--line); }
|
.site-footer { padding: clamp(2.5rem, 5.8vw, 5.5rem) 0 2rem; background: #e4ecfc; border-top: 1px solid var(--line); }
|
||||||
.footer-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, .75fr)); gap: 1.5rem 3rem; }
|
.footer-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.6rem clamp(2rem, 7vw, 7rem); }
|
||||||
.footer-grid > div { display: flex; flex-direction: column; align-items: flex-start; }
|
.footer-company { display: flex; flex-direction: column; align-items: flex-start; }
|
||||||
|
.footer-logo img { width: clamp(8.125rem, 13vw, 10rem); height: auto; }
|
||||||
|
.footer-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; gap: 1rem; }
|
||||||
|
.footer-links ul { padding: 0; margin: 0; list-style: none; }
|
||||||
.footer-grid a, .footer-meta a { color: var(--muted); text-decoration: none; overflow-wrap: anywhere; }
|
.footer-grid a, .footer-meta a { color: var(--muted); text-decoration: none; overflow-wrap: anywhere; }
|
||||||
.footer-grid a:hover, .footer-meta a:hover { color: var(--accent); text-decoration: underline; }
|
.footer-grid a:hover, .footer-meta a:hover { color: var(--accent); text-decoration: underline; }
|
||||||
.footer-grid a { min-height: 44px; display: inline-flex; align-items: center; }
|
.footer-grid a { min-height: 40px; display: inline-flex; align-items: center; }
|
||||||
.footer-company p, .footer-label { color: var(--ink); font-weight: 640; margin: .2rem 0 .35rem; }
|
.footer-company p, .footer-label { color: var(--ink); font-weight: 640; margin: .2rem 0 .35rem; }
|
||||||
|
.footer-label { font-size: 1.05rem; line-height: 1.35; }
|
||||||
.footer-company p { margin-top: .6rem; }
|
.footer-company p { margin-top: .6rem; }
|
||||||
|
.footer-company .footer-payment-label { margin: .25rem 0 0; color: var(--muted); font-size: .87rem; font-weight: 500; }
|
||||||
.footer-company address { color: var(--muted); max-width: 26rem; font-size: .95rem; }
|
.footer-company address { color: var(--muted); max-width: 26rem; font-size: .95rem; }
|
||||||
.footer-meta { display: flex; flex-wrap: wrap; gap: .6rem 1.8rem; padding-top: 1.2rem; margin-top: 1.25rem; border-top: 1px solid var(--line); font-size: .875rem; }
|
.footer-meta { display: grid; gap: .35rem; padding-top: 1.2rem; margin-top: 1.6rem; border-top: 1px solid var(--line); font-size: .875rem; }
|
||||||
.footer-meta p { margin: 0; }
|
.footer-meta p { margin: 0; }
|
||||||
.footer-terms { flex-basis: 100%; }
|
|
||||||
|
|
||||||
@media (max-width: 62rem) {
|
@media (max-width: 62rem) {
|
||||||
.masthead-inner { gap: .85rem; }
|
.masthead-inner { gap: .85rem; }
|
||||||
@@ -358,8 +364,9 @@ progress { width: 100%; height: .8rem; accent-color: var(--accent); }
|
|||||||
.article-category { grid-column: 1; grid-row: 1; }
|
.article-category { grid-column: 1; grid-row: 1; }
|
||||||
.article-row-title { grid-column: 1 / -1; grid-row: 2; }
|
.article-row-title { grid-column: 1 / -1; grid-row: 2; }
|
||||||
.article-row time { grid-column: 2; grid-row: 1; }
|
.article-row time { grid-column: 2; grid-row: 1; }
|
||||||
.footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1rem; }
|
.footer-grid { grid-template-columns: 1fr; }
|
||||||
.footer-company { grid-column: 1 / -1; }
|
.footer-company { align-items: center; text-align: center; }
|
||||||
|
.footer-links, .footer-meta { text-align: center; }
|
||||||
}
|
}
|
||||||
@media (max-width: 23rem) {
|
@media (max-width: 23rem) {
|
||||||
.hero-actions .button { width: 100%; }
|
.hero-actions .button { width: 100%; }
|
||||||
@@ -702,3 +709,19 @@ progress { width: 100%; height: .8rem; accent-color: var(--accent); }
|
|||||||
.rich table[class*="studio-align-"] :is(th, td) { text-align: inherit; }
|
.rich table[class*="studio-align-"] :is(th, td) { text-align: inherit; }
|
||||||
.hero-visual[class*="studio-align-"] { justify-self: var(--studio-justify); }
|
.hero-visual[class*="studio-align-"] { justify-self: var(--studio-justify); }
|
||||||
.hero-actions[class*="studio-align-"] { justify-content: var(--studio-justify); }
|
.hero-actions[class*="studio-align-"] { justify-content: var(--studio-justify); }
|
||||||
|
|
||||||
|
.studio-lead { font-size: 1.2rem; color: var(--ink); }
|
||||||
|
.studio-definitions { margin: 0; }
|
||||||
|
.studio-definitions dt { font-weight: 650; }
|
||||||
|
.studio-definitions dd { margin: .2rem 0 .8rem; color: var(--muted); }
|
||||||
|
.studio-definitions dd:last-child { margin-bottom: 0; }
|
||||||
|
.studio-spacer { height: clamp(1.5rem, 4vw, 4rem); }
|
||||||
|
[data-studio-editing] .studio-spacer { border: 1px dashed var(--line); }
|
||||||
|
.studio-banner-two, .studio-contact { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.25rem 2rem; }
|
||||||
|
.studio-banner-two p, .studio-contact p { margin-bottom: 0; }
|
||||||
|
.studio-banner-two .actions { margin: 0; }
|
||||||
|
.studio-contact { border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1rem, 4vw, 2rem); }
|
||||||
|
.studio-releases article { padding: 1.05rem 0; border-block-start: 1px solid var(--line); }
|
||||||
|
.studio-releases article:last-child { border-block-end: 1px solid var(--line); }
|
||||||
|
.studio-pricing { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
||||||
|
@media (max-width: 36rem) { .studio-pricing { grid-template-columns: 1fr; } }
|
||||||
|
|||||||
+63
-25
@@ -182,44 +182,82 @@ jQuery(function ($) {
|
|||||||
|
|
||||||
$('[data-canvas-presets]').each(function () {
|
$('[data-canvas-presets]').each(function () {
|
||||||
const $gallery = $(this);
|
const $gallery = $(this);
|
||||||
const $search = $gallery.find('[data-template-search]');
|
const $tabs = $gallery.find('[data-library-tab]');
|
||||||
const $groups = $gallery.find('[data-template-group]');
|
const $panels = $gallery.find('[data-library-panel]');
|
||||||
const $filters = $gallery.find('[data-template-filter]');
|
|
||||||
const $peek = $gallery.find('[data-template-peek]');
|
const $peek = $gallery.find('[data-template-peek]');
|
||||||
const $dialog = $gallery.find('[data-template-dialog]');
|
const $dialog = $gallery.find('[data-template-dialog]');
|
||||||
const $use = $dialog.find('[data-template-use]');
|
const $use = $dialog.find('[data-template-use]');
|
||||||
let category = '';
|
|
||||||
let $selection;
|
let $selection;
|
||||||
|
|
||||||
function hidePeek() {
|
function hidePeek() {
|
||||||
$peek.prop('hidden', true);
|
$peek.prop('hidden', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function filter() {
|
function selectTab(kind, focus = false) {
|
||||||
const query = String($search.val()).trim().toLowerCase();
|
const $current = $tabs.filter((_, tab) => tab.dataset.libraryTab === kind);
|
||||||
let count = 0;
|
$tabs.attr({'aria-selected': 'false', tabindex: '-1'});
|
||||||
$groups.each(function () {
|
$current.attr({'aria-selected': 'true', tabindex: '0'});
|
||||||
const $group = $(this);
|
$panels.each(function () {
|
||||||
const allowed = !category || this.dataset.templateGroup === category;
|
$(this).prop('hidden', this.dataset.libraryPanel !== kind);
|
||||||
let groupCount = 0;
|
|
||||||
$group.find('[data-template-card]').each(function () {
|
|
||||||
const visible = allowed && this.dataset.templateSearchText.toLowerCase().includes(query);
|
|
||||||
$(this).prop('hidden', !visible);
|
|
||||||
if (visible) groupCount++;
|
|
||||||
});
|
|
||||||
$group.prop('hidden', groupCount === 0);
|
|
||||||
count += groupCount;
|
|
||||||
});
|
});
|
||||||
$gallery.find('[data-template-empty]').prop('hidden', count !== 0);
|
$gallery.closest('.studio-library').scrollTop(0);
|
||||||
|
hidePeek();
|
||||||
|
if (focus) $current.trigger('focus');
|
||||||
|
}
|
||||||
|
|
||||||
|
function filterItems($panel) {
|
||||||
|
const query = $panel.find('[data-template-search]').val().trim().toLowerCase();
|
||||||
|
let matches = 0;
|
||||||
|
$panel.find('[data-template-group]').filter((_, group) => !group.hidden).find('[data-library-item]').each(function () {
|
||||||
|
const visible = this.dataset.templateSearchText.toLowerCase().includes(query);
|
||||||
|
$(this).prop('hidden', !visible);
|
||||||
|
if (visible) matches++;
|
||||||
|
});
|
||||||
|
$panel.find('[data-template-empty]').prop('hidden', matches !== 0);
|
||||||
hidePeek();
|
hidePeek();
|
||||||
}
|
}
|
||||||
|
|
||||||
$search.on('input', filter);
|
$gallery.find('[data-library-tabs]').prop('hidden', false);
|
||||||
$filters.on('click', function () {
|
function openLayersFromHash() {
|
||||||
category = this.dataset.templateFilter;
|
if (window.location.hash !== '#blocks') return false;
|
||||||
$filters.attr('aria-pressed', 'false');
|
selectTab('layers');
|
||||||
$(this).attr('aria-pressed', 'true');
|
$gallery.find('#blocks').prop('open', true);
|
||||||
filter();
|
return true;
|
||||||
|
}
|
||||||
|
if (!openLayersFromHash()) selectTab('modules');
|
||||||
|
$(window).on('hashchange', openLayersFromHash);
|
||||||
|
$tabs.on('click', function () {
|
||||||
|
selectTab(this.dataset.libraryTab);
|
||||||
|
}).on('keydown', function (event) {
|
||||||
|
const index = $tabs.index(this);
|
||||||
|
const last = $tabs.length - 1;
|
||||||
|
const next = {Home: 0, End: last, ArrowLeft: index === 0 ? last : index - 1, ArrowRight: index === last ? 0 : index + 1}[event.key];
|
||||||
|
if (typeof next !== 'number') return;
|
||||||
|
event.preventDefault();
|
||||||
|
selectTab($tabs.get(next).dataset.libraryTab, true);
|
||||||
|
});
|
||||||
|
|
||||||
|
$gallery.on('click', '[data-library-category]', function () {
|
||||||
|
const $panel = $(this).closest('[data-library-panel]');
|
||||||
|
$panel.data('categoryTrigger', this);
|
||||||
|
$panel.find('[data-library-index]').prop('hidden', true);
|
||||||
|
$panel.find('[data-library-content]').prop('hidden', false);
|
||||||
|
$panel.find('[data-library-title]').text(this.dataset.libraryLabel);
|
||||||
|
$panel.find('[data-template-search]').val('');
|
||||||
|
const key = this.dataset.libraryCategory;
|
||||||
|
$panel.find('[data-template-group]').each(function () {
|
||||||
|
$(this).prop('hidden', this.dataset.templateGroup !== key);
|
||||||
|
});
|
||||||
|
filterItems($panel);
|
||||||
|
$panel.find('[data-library-back]').trigger('focus');
|
||||||
|
}).on('click', '[data-library-back]', function () {
|
||||||
|
const $panel = $(this).closest('[data-library-panel]');
|
||||||
|
$panel.find('[data-library-content]').prop('hidden', true);
|
||||||
|
$panel.find('[data-library-index]').prop('hidden', false);
|
||||||
|
hidePeek();
|
||||||
|
$($panel.data('categoryTrigger')).trigger('focus');
|
||||||
|
}).on('input', '[data-template-search]', function () {
|
||||||
|
filterItems($(this).closest('[data-library-panel]'));
|
||||||
});
|
});
|
||||||
|
|
||||||
$gallery.on('mouseenter focusin', '[data-template-preview]', function (event) {
|
$gallery.on('mouseenter focusin', '[data-template-preview]', function (event) {
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 5.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 6.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.7 KiB |
@@ -1,18 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
require __DIR__ . '/../vendor/autoload.php';
|
|
||||||
|
|
||||||
use App\Content\Database;
|
|
||||||
|
|
||||||
// 输出目录类文章:slug<TAB>卡片网址<TAB>是否已发布
|
|
||||||
$pdo = Database::connect();
|
|
||||||
$query = $pdo->query("SELECT a.slug, a.card, a.status FROM articles a
|
|
||||||
WHERE EXISTS (SELECT 1 FROM article_category_links l WHERE l.article_id = a.id
|
|
||||||
AND l.category_slug IN ('services', 'supported-projects', 'partners'))
|
|
||||||
ORDER BY a.id");
|
|
||||||
foreach ($query as $row) {
|
|
||||||
$card = json_decode($row['card'], true) ?: [];
|
|
||||||
echo $row['slug'], '|', $card['url'] ?? '', '|', $row['status'], "\n";
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
require dirname(__DIR__) . '/vendor/autoload.php';
|
||||||
|
|
||||||
|
use App\Content\View;
|
||||||
|
|
||||||
|
$primary = 'https://example.com/product?a=1&b=2';
|
||||||
|
$cases = [
|
||||||
|
'configured-with-detail' => [['card' => ['url' => $primary], 'body' => '<p>有正文</p>'], $primary, true],
|
||||||
|
'configured-only' => [['card' => ['url' => '/pagepan']], '/pagepan', false],
|
||||||
|
'summary-only' => [['summary' => '仅摘要'], '/articles/summary-only', false],
|
||||||
|
'editor-placeholder' => [['body' => '<p><br></p><p> ​</p>'], '', false],
|
||||||
|
'markdown-comment' => [['body' => '<!-- 草稿注释 -->', 'body_format' => 'markdown'], '', false],
|
||||||
|
'media-body' => [['body' => '<video controls><source src="/assets/demo.mp4"></video>'], '/articles/media-body', false],
|
||||||
|
'unconfigured' => [[], '', false],
|
||||||
|
];
|
||||||
|
$items = [];
|
||||||
|
foreach ($cases as $slug => [$fields]) {
|
||||||
|
$items[] = $fields + ['slug' => $slug, 'title' => $slug, 'card' => [], 'summary' => '', 'body' => '', 'body_format' => 'html'];
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseFragment(string $html): DOMXPath
|
||||||
|
{
|
||||||
|
$document = new DOMDocument();
|
||||||
|
$document->loadHTML('<meta charset="utf-8">' . $html, LIBXML_NOERROR | LIBXML_NOWARNING | LIBXML_NONET);
|
||||||
|
|
||||||
|
return new DOMXPath($document);
|
||||||
|
}
|
||||||
|
|
||||||
|
function equal(mixed $actual, mixed $expected, string $message): void
|
||||||
|
{
|
||||||
|
if ($actual !== $expected) {
|
||||||
|
throw new RuntimeException($message . ' ' . json_encode([$expected, $actual], JSON_UNESCAPED_UNICODE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$services = parseFragment(View::fragment('services', ['products' => $items]));
|
||||||
|
$network = parseFragment(View::fragment('network-groups', [
|
||||||
|
'network' => ['partners' => ['name' => '合作伙伴', 'articles' => $items]], 'standalone' => true,
|
||||||
|
]));
|
||||||
|
foreach ($cases as $slug => [, $target, $detail]) {
|
||||||
|
$card = "//article[h2='$slug' or div/h2='$slug']";
|
||||||
|
equal($services->evaluate("count($card)"), 1.0, "$slug 服务卡片存在");
|
||||||
|
equal($services->evaluate("string($card/div/h2/a/@href)"), $target, "$slug 服务标题目标");
|
||||||
|
equal($services->evaluate("string($card/div/div/a[contains(@class, 'button-primary')]/@href)"), $target, "$slug 服务按钮目标");
|
||||||
|
equal($services->evaluate("boolean($card/div/div/a[@class='catalog-detail'][@href='/articles/$slug'])"), $detail, "$slug 服务独立详情");
|
||||||
|
|
||||||
|
$item = "//li[*[1]/span='$slug']";
|
||||||
|
equal($network->evaluate("count($item)"), 1.0, "$slug 伙伴卡片存在");
|
||||||
|
equal($network->evaluate("string($item/*[1]/@href)"), $target, "$slug 伙伴卡片目标");
|
||||||
|
equal($network->evaluate("boolean($item/a[@class='network-detail'][@href='/articles/$slug'])"), $detail, "$slug 伙伴独立详情");
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("通过 %d 组目录卡片测试。\n", count($cases));
|
||||||
@@ -1,67 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# 目录页(/services、/network)的卡片链接必须指向卡片配置的网址,而不是 /articles/<slug>
|
set -euo pipefail
|
||||||
set -u
|
cd "$(dirname "$0")/.."
|
||||||
cd "$(dirname "$0")/.." || exit 1
|
exec "${PHP_BIN:-php}" tests/directory-links.php
|
||||||
BASE=http://127.0.0.1:8787
|
|
||||||
PASS=0; FAIL=0
|
|
||||||
ok(){ PASS=$((PASS+1)); printf ' ok %s\n' "$1"; }
|
|
||||||
no(){ FAIL=$((FAIL+1)); printf ' FAIL %s -> %s\n' "$1" "${2:-}"; }
|
|
||||||
|
|
||||||
SERVICES=$(curl -s "$BASE/services")
|
|
||||||
NETWORK=$(curl -s "$BASE/network")
|
|
||||||
ROWS=$(php tests/dircheck.php)
|
|
||||||
|
|
||||||
echo "== /services 卡片链接 =="
|
|
||||||
while IFS='|' read -r slug url status; do
|
|
||||||
[ -z "$slug" ] && continue
|
|
||||||
[ -z "$url" ] && continue
|
|
||||||
if echo "$SERVICES" | grep -q "href=\"$url\""; then ok "$slug 标题/按钮指向 $url"; else no "$slug 未指向 $url"; fi
|
|
||||||
if echo "$SERVICES" | grep -q "href=\"/articles/$slug\""; then no "$slug 仍出现 /articles/$slug"; else ok "$slug 不再指向文章页"; fi
|
|
||||||
done <<< "$(echo "$ROWS" | grep -E '^service-')"
|
|
||||||
|
|
||||||
echo "== /network 卡片链接 =="
|
|
||||||
while IFS='|' read -r slug url status; do
|
|
||||||
[ -z "$slug" ] && continue
|
|
||||||
[ -z "$url" ] && continue
|
|
||||||
if echo "$NETWORK" | grep -q "href=\"$url\""; then ok "$slug 指向 $url"; else no "$slug 未指向 $url"; fi
|
|
||||||
if echo "$NETWORK" | grep -q "href=\"/articles/$slug\""; then no "$slug 仍出现 /articles/$slug"; else ok "$slug 不再指向文章页"; fi
|
|
||||||
done <<< "$(echo "$ROWS" | grep -E '^network-')"
|
|
||||||
|
|
||||||
echo "== 标题链接与按钮链接一致性 =="
|
|
||||||
python3 - "$BASE" <<'PY'
|
|
||||||
import re, sys, html, urllib.request
|
|
||||||
base = sys.argv[1]
|
|
||||||
def get(path):
|
|
||||||
return urllib.request.urlopen(base + path, timeout=10).read().decode()
|
|
||||||
page = get('/services')
|
|
||||||
cards = re.findall(r'<article class="catalog-card">.*?</article>', page, re.S)
|
|
||||||
bad = 0
|
|
||||||
for card in cards:
|
|
||||||
links = re.findall(r'<a[^>]*href="([^"]+)"', card)
|
|
||||||
title = re.search(r'<h2><a href="([^"]+)"', card)
|
|
||||||
if not title:
|
|
||||||
print(' FAIL 卡片缺标题链接'); bad += 1; continue
|
|
||||||
primary = [l for l in links if not l.startswith('/articles/')]
|
|
||||||
if primary and title.group(1) != primary[0]:
|
|
||||||
print(' FAIL 标题 href=%s 与主按钮 href=%s 不一致' % (title.group(1), primary[0])); bad += 1
|
|
||||||
print(' ok %d 张卡片标题与主按钮一致' % (len(cards) - bad) if bad == 0 else ' 共 %d 张卡片,%d 张不一致' % (len(cards), bad))
|
|
||||||
sys.exit(0 if bad == 0 else 1)
|
|
||||||
PY
|
|
||||||
[ $? -eq 0 ] && ok "标题与按钮目标一致" || no "标题与主按钮目标不一致"
|
|
||||||
|
|
||||||
echo "== 参考信息:目录条目在文章流中的可见性(不判定) =="
|
|
||||||
PUB=$(echo "$ROWS" | awk -F'|' '$3 == "published" {print $1}')
|
|
||||||
N=0
|
|
||||||
for slug in $PUB; do
|
|
||||||
if curl -s "$BASE/articles" | grep -q "href=\"/articles/$slug\""; then N=$((N+1)); fi
|
|
||||||
done
|
|
||||||
echo " /articles 列表中出现的目录条目: $N / $(echo "$PUB" | wc -l)"
|
|
||||||
M=0
|
|
||||||
for slug in $PUB; do
|
|
||||||
if curl -s "$BASE/sitemap.xml" | grep -q "/articles/$slug"; then M=$((M+1)); fi
|
|
||||||
done
|
|
||||||
echo " sitemap 中的目录条目: $M / $(echo "$PUB" | wc -l)"
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "== 结果: $PASS 通过, $FAIL 失败 =="
|
|
||||||
[ $FAIL -eq 0 ] || exit 1
|
|
||||||
|
|||||||
+62
-16
@@ -33,6 +33,18 @@ async function run(browser) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await post('/admin/new-page', {slug, name: '画布测试页'});
|
await post('/admin/new-page', {slug, name: '画布测试页'});
|
||||||
|
await page.goto('/admin');
|
||||||
|
const dashboard = page.locator('[data-page-list]');
|
||||||
|
await dashboard.locator('[data-page-search]').fill(slug);
|
||||||
|
assert.equal(await dashboard.locator('[data-page-item]:visible').count(), 1);
|
||||||
|
const draft = dashboard.locator('[data-page-item]:visible');
|
||||||
|
assert.equal(await draft.getAttribute('data-page-item'), 'draft');
|
||||||
|
assert.equal(await draft.getByRole('link', {name: '预览'}).getAttribute('href'), '/admin/pages/' + slug + '/preview');
|
||||||
|
await dashboard.locator('[data-page-status]').selectOption('published');
|
||||||
|
await dashboard.locator('[data-page-empty]').waitFor({state: 'visible'});
|
||||||
|
await dashboard.locator('[data-page-status]').selectOption('draft');
|
||||||
|
assert.equal(await dashboard.locator('[data-page-item]:visible').count(), 1);
|
||||||
|
assert.equal(await page.getByRole('navigation', {name: '后台导航'}).getByRole('link', {name: '页面'}).getAttribute('aria-current'), 'page');
|
||||||
await post('/admin/page-blocks/' + slug, {operation: 'create', key: 'fixtures', preset: 'text'});
|
await post('/admin/page-blocks/' + slug, {operation: 'create', key: 'fixtures', preset: 'text'});
|
||||||
await post('/admin/pages/' + slug + '/fixtures', {
|
await post('/admin/pages/' + slug + '/fixtures', {
|
||||||
version: '0', title: '媒体和链接', lead: '', style: 'plain',
|
version: '0', title: '媒体和链接', lead: '', style: 'plain',
|
||||||
@@ -147,21 +159,41 @@ async function run(browser) {
|
|||||||
assert.equal(await sectionTitle.evaluate((node) => getComputedStyle(node).textAlign), 'center');
|
assert.equal(await sectionTitle.evaluate((node) => getComputedStyle(node).textAlign), 'center');
|
||||||
|
|
||||||
const gallery = page.locator('[data-canvas-presets]');
|
const gallery = page.locator('[data-canvas-presets]');
|
||||||
|
const modules = gallery.locator('[data-library-panel=modules]');
|
||||||
|
const elements = gallery.locator('[data-library-panel=elements]');
|
||||||
|
const moduleTab = gallery.getByRole('tab', {name: '组件'});
|
||||||
|
const elementTab = gallery.getByRole('tab', {name: '元素'});
|
||||||
|
const backToModules = () => modules.getByRole('button', {name: '返回分类'}).click();
|
||||||
|
const openModule = (key) => modules.locator('[data-library-category="' + key + '"]').click();
|
||||||
|
assert.equal(await modules.locator('[data-library-category]:visible').count(), 7);
|
||||||
|
assert.equal(await modules.locator('[data-template-card]:visible').count(), 0);
|
||||||
|
assert.equal(await modules.locator('[data-template-card]').count(), 26);
|
||||||
|
|
||||||
await copyText.first().click();
|
await copyText.first().click();
|
||||||
await gallery.getByText('基础元素', {exact: true}).click();
|
await moduleTab.press('ArrowRight');
|
||||||
await gallery.getByRole('button', {name: '插入分割线'}).click();
|
assert.equal(await elementTab.getAttribute('aria-selected'), 'true');
|
||||||
|
assert.equal(await elements.locator('[data-library-category]:visible').count(), 4);
|
||||||
|
assert.equal(await elements.locator('[data-canvas-element]:visible').count(), 0);
|
||||||
|
const structural = elements.locator('[data-library-category=structure-elements]');
|
||||||
|
await structural.click();
|
||||||
|
assert.equal(await elements.locator('[data-library-category]:visible').count(), 0);
|
||||||
|
assert.equal(await elements.locator('[data-canvas-element]:visible').count(), 5);
|
||||||
|
await elements.getByRole('button', {name: '插入分割线'}).click();
|
||||||
await frame.locator('#fixtures .studio-divider').waitFor();
|
await frame.locator('#fixtures .studio-divider').waitFor();
|
||||||
await gallery.getByText('基础元素', {exact: true}).click();
|
await elements.getByRole('button', {name: '插入留白'}).click();
|
||||||
assert.equal(await gallery.locator('[data-template-group]').count(), 7);
|
await frame.locator('#fixtures .studio-spacer').waitFor();
|
||||||
assert.equal(await gallery.locator('[data-template-card]').count(), 22);
|
await elements.getByRole('button', {name: '返回分类'}).click();
|
||||||
const brokenPreviews = await gallery.locator('[data-template-card] img').evaluateAll(async (images) => {
|
assert(await structural.evaluate((button) => button === document.activeElement));
|
||||||
|
await moduleTab.click();
|
||||||
|
|
||||||
|
const brokenPreviews = await modules.locator('[data-template-card] img').evaluateAll(async (images) => {
|
||||||
for (const image of images) image.loading = 'eager';
|
for (const image of images) image.loading = 'eager';
|
||||||
await Promise.all(images.map((image) => image.decode()));
|
await Promise.all(images.map((image) => image.decode()));
|
||||||
return images.filter((image) => image.naturalWidth !== 768).length;
|
return images.filter((image) => image.naturalWidth !== 768).length;
|
||||||
});
|
});
|
||||||
assert.equal(brokenPreviews, 0);
|
assert.equal(brokenPreviews, 0);
|
||||||
await gallery.locator('[data-template-filter=cover]').click();
|
await openModule('cover');
|
||||||
assert.equal(await gallery.locator('[data-template-card]:visible').count(), 2);
|
assert.equal(await modules.locator('[data-template-card]:visible').count(), 3);
|
||||||
const cover = gallery.locator('[data-template-preview=cover]');
|
const cover = gallery.locator('[data-template-preview=cover]');
|
||||||
await cover.hover();
|
await cover.hover();
|
||||||
const peek = gallery.locator('[data-template-peek]');
|
const peek = gallery.locator('[data-template-peek]');
|
||||||
@@ -175,17 +207,26 @@ async function run(browser) {
|
|||||||
await dialog.locator('[data-template-use]').click();
|
await dialog.locator('[data-template-use]').click();
|
||||||
await frame.locator('section[id^=block-] h2').filter({hasText: '图文封面'}).waitFor();
|
await frame.locator('section[id^=block-] h2').filter({hasText: '图文封面'}).waitFor();
|
||||||
|
|
||||||
await gallery.locator('[data-template-filter=""]').click();
|
await backToModules();
|
||||||
const search = gallery.locator('[data-template-search]');
|
await openModule('layout');
|
||||||
|
const search = modules.locator('[data-template-search]');
|
||||||
await search.fill('does-not-exist');
|
await search.fill('does-not-exist');
|
||||||
await gallery.locator('[data-template-empty]').waitFor({state: 'visible'});
|
await modules.locator('[data-template-empty]').waitFor({state: 'visible'});
|
||||||
await search.fill('双栏');
|
await search.fill('双栏');
|
||||||
assert.equal(await gallery.locator('[data-template-card]:visible').count(), 1);
|
assert.equal(await modules.locator('[data-template-card]:visible').count(), 1);
|
||||||
await search.fill('重点提示');
|
await search.fill('重点提示');
|
||||||
await gallery.locator('[data-canvas-template=notice]').click();
|
await modules.locator('[data-template-empty]').waitFor({state: 'visible'});
|
||||||
|
await backToModules();
|
||||||
|
await openModule('details');
|
||||||
|
await modules.locator('[data-canvas-template=pricing]').click();
|
||||||
|
await frame.locator('.studio-pricing').waitFor();
|
||||||
|
await backToModules();
|
||||||
|
await openModule('content');
|
||||||
|
await search.fill('重点提示');
|
||||||
|
await modules.locator('[data-canvas-template=notice]').click();
|
||||||
await frame.locator('.studio-notice').waitFor();
|
await frame.locator('.studio-notice').waitFor();
|
||||||
await search.fill('分类文章');
|
await search.fill('分类文章');
|
||||||
await gallery.locator('[data-canvas-template=articles]').click();
|
await modules.locator('[data-canvas-template=articles]').click();
|
||||||
await frame.locator('section[id^=block-] h2').filter({hasText: '分类文章'}).waitFor();
|
await frame.locator('section[id^=block-] h2').filter({hasText: '分类文章'}).waitFor();
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
@@ -202,6 +243,8 @@ async function run(browser) {
|
|||||||
assert.deepEqual(await copyText.evaluateAll((nodes) => nodes.map((node) => getComputedStyle(node).textAlign)), ['right', 'right']);
|
assert.deepEqual(await copyText.evaluateAll((nodes) => nodes.map((node) => getComputedStyle(node).textAlign)), ['right', 'right']);
|
||||||
await frame.locator('.studio-notice').waitFor();
|
await frame.locator('.studio-notice').waitFor();
|
||||||
await frame.locator('#fixtures .studio-divider').waitFor();
|
await frame.locator('#fixtures .studio-divider').waitFor();
|
||||||
|
await frame.locator('#fixtures .studio-spacer').waitFor();
|
||||||
|
await frame.locator('.studio-pricing').waitFor();
|
||||||
assert.match(await frame.locator('[data-visual]').getAttribute('class'), /studio-media-99/);
|
assert.match(await frame.locator('[data-visual]').getAttribute('class'), /studio-media-99/);
|
||||||
assert.equal(await copyText.count(), 2);
|
assert.equal(await copyText.count(), 2);
|
||||||
assert.equal(await frame.locator('#copy-fixture').count(), 1);
|
assert.equal(await frame.locator('#copy-fixture').count(), 1);
|
||||||
@@ -219,10 +262,13 @@ async function run(browser) {
|
|||||||
phonePage.on('pageerror', (error) => errors.push(error.message));
|
phonePage.on('pageerror', (error) => errors.push(error.message));
|
||||||
await phonePage.goto(editorPath);
|
await phonePage.goto(editorPath);
|
||||||
const phoneGallery = phonePage.locator('[data-canvas-presets]');
|
const phoneGallery = phonePage.locator('[data-canvas-presets]');
|
||||||
await phoneGallery.locator('[data-template-filter=cover]').tap();
|
await phoneGallery.locator('[data-library-category=cover]').tap();
|
||||||
await phoneGallery.locator('[data-template-preview=banner]').tap();
|
await phoneGallery.locator('[data-template-preview=banner]').tap();
|
||||||
await phoneGallery.locator('[data-template-dialog]').waitFor({state: 'visible'});
|
await phoneGallery.locator('[data-template-dialog]').waitFor({state: 'visible'});
|
||||||
assert.equal(await phoneGallery.locator('[data-template-dialog] h2').textContent(), '横幅');
|
assert.equal(await phoneGallery.locator('[data-template-dialog] h2').textContent(), '横幅');
|
||||||
|
await phonePage.goto(editorPath + '#blocks');
|
||||||
|
assert.equal(await phoneGallery.getByRole('tab', {name: '图层'}).getAttribute('aria-selected'), 'true');
|
||||||
|
assert(await phoneGallery.locator('#blocks').evaluate((details) => details.open));
|
||||||
await phone.close();
|
await phone.close();
|
||||||
await verifyArticleLibrary(browser, context, page, post, slug, feedId);
|
await verifyArticleLibrary(browser, context, page, post, slug, feedId);
|
||||||
assert.deepEqual(errors, []);
|
assert.deepEqual(errors, []);
|
||||||
@@ -372,7 +418,7 @@ async function verifyScopedArchive(context, admin, page, post, slug, feedId, cat
|
|||||||
const browser = await chromium.launch({executablePath: process.env.CHROMIUM_EXECUTABLE || undefined});
|
const browser = await chromium.launch({executablePath: process.env.CHROMIUM_EXECUTABLE || undefined});
|
||||||
try {
|
try {
|
||||||
await run(browser);
|
await run(browser);
|
||||||
console.log('Passed Chromium canvas alignment, editor elements and modules, persistence, and scoped article archives.');
|
console.log('Passed Chromium dashboard, categorized library, canvas persistence, and scoped article archives.');
|
||||||
} finally {
|
} finally {
|
||||||
await browser.close();
|
await browser.close();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user