diff --git a/README.md b/README.md index a1b7c34..f2eadc7 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,8 @@ php bin/admin.php reset admin@example.com ## 后台编辑 -- **页面设计**支持新建草稿、发布和撤回。首屏标题与简介可在桌面或手机画布中直接编辑。区块支持新增、排序、删除、可视化编辑、媒体插入和 HTML 源码。单击画布元素可用浮动工具条复制或删除。选中媒体后,可拖动边缘手柄调整宽度。浮动工具条可将正文元素、区块标题和首屏元素对齐到左侧、中央或右侧。编辑器左侧可插入基础元素,或按分类和名称查找区块模板。悬停或键盘聚焦缩略图可放大,点击可打开预览。 +- **网站后台**可按名称、地址或发布状态查找页面,从列表打开画布、公开页或草稿预览。 +- **页面设计**支持新建草稿、发布和撤回。首屏标题与简介可在桌面或手机画布中直接编辑。区块支持新增、排序、删除、可视化编辑、媒体插入和 HTML 源码。单击画布元素可用浮动工具条复制或删除。选中媒体后,可拖动边缘手柄调整宽度。浮动工具条可将正文元素、区块标题和首屏元素对齐到左侧、中央或右侧。编辑器左侧分为「组件」「元素」「图层」。先进入分类,再查找并插入模板或基础元素。悬停或键盘聚焦缩略图可放大,点击可打开预览。 - **媒体库**集中列出项目静态文件及上传文件,支持查找、选取、复制路径、改名和归档。归档资源的已有 URL 保持可访问。上传文件放在 `LAYSENSE_MEDIA_DIR`,由 `/assets/uploads/` 提供。 - **文章**使用自托管的 TOAST UI Editor 3.2.2(MIT)。Markdown 左侧源码、右侧实时预览,富文本使用所见即所得模式。文章可以加入多个分类,可在「管理分类」创建新分类。 - **分类文章**支持在任意页面添加,保存区块后在「图层」中编辑分类、展示数量和合并或标签页模式。「查看全部动态」和翻页只列出该区块所选的分类。 diff --git a/app/Content/BlockTemplates.php b/app/Content/BlockTemplates.php index a04ec0c..c8feba0 100644 --- a/app/Content/BlockTemplates.php +++ b/app/Content/BlockTemplates.php @@ -8,16 +8,34 @@ final class BlockTemplates { public const ARTICLE_FEED = '{"categories":["announcement","news","product"],"mode":"merged","limit":6}'; - public const ELEMENTS = [ - 'paragraph' => ['段落', '

填写正文。

'], - 'subheading' => ['小标题', '

填写小标题

'], - 'bullet-list' => ['项目列表', ''], - 'button' => ['按钮', '

联系来笙

'], - 'separator' => ['分割线', '
'], - 'code' => ['代码块', '
填写代码
'], - 'image' => ['图片', '', 'image/'], - 'video' => ['视频', '', 'video/'], - 'audio' => ['音频', '', 'audio/'], + public const ELEMENT_GROUPS = [ + 'text-elements' => ['文字与列表', [ + 'paragraph' => ['段落', '

填写正文。

'], + 'subheading' => ['小标题', '

填写小标题

'], + 'lead' => ['导语', '

填写本节的导语。

'], + 'blockquote' => ['引用', '

填写需要引用的内容。

'], + 'bullet-list' => ['项目列表', ''], + 'ordered-list' => ['编号列表', '
  1. 填写第一项
  2. 填写第二项
'], + 'definition-list' => ['术语说明', '
填写术语
填写术语说明。
'], + ]], + 'link-elements' => ['链接与按钮', [ + 'button' => ['主按钮', '

联系来笙

'], + 'outline-button' => ['描边按钮', '

查看服务

'], + 'text-link' => ['文字链接', '

阅读文章

'], + 'email-link' => ['邮件链接', '

发送邮件

'], + ]], + 'media-elements' => ['图片与影音', [ + 'image' => ['图片', '', 'image/'], + 'video' => ['视频', '', 'video/'], + 'audio' => ['音频', '', 'audio/'], + ]], + 'structure-elements' => ['版式与数据', [ + 'separator' => ['分割线', '
'], + 'spacer' => ['留白', '
'], + 'code' => ['代码块', '
填写代码
'], + 'basic-table' => ['数据表格', '
名称数据
填写名称填写数据
'], + 'disclosure' => ['折叠内容', '
填写折叠标题

填写展开后的内容。

'], + ]], ]; public const GROUPS = [ @@ -31,6 +49,7 @@ final class BlockTemplates 'cover' => ['封面与横幅', [ 'cover' => ['图文封面', '

用一句话介绍你的产品

在首段说明访客能获得什么。

查看服务
'], 'banner' => ['横幅', '

用一句话介绍你的项目

简要说明项目能为访客做什么。

了解更多
'], + 'two-actions' => ['双按钮横幅', '

选择下一步

介绍访客可以立即做什么。

查看服务联系我们
'], ]], 'layout' => ['图文与布局', [ 'image' => ['图文', '

介绍主题

在这里说明图片或产品。

'], @@ -51,11 +70,14 @@ final class BlockTemplates 'faq' => ['常见问题', '
请输入问题

请输入答案。

'], 'timeline' => ['时间线', '
  1. 确定目标

    填写这一阶段需要完成的事项。

  2. 实施与验收

    填写交付时间与验收标准。

'], 'checklist' => ['清单', ''], + 'changelog' => ['更新记录', '

版本 2.0

填写主要功能或改进。

版本 1.0

填写上一版本的更新内容。

'], + 'pricing' => ['双方案报价', '

基础方案

填写价格

填写方案包含的服务。

咨询基础方案

进阶方案

填写价格

填写扩展服务或权益。

咨询进阶方案
'], ]], 'actions' => ['导航与引导', [ 'navigation' => ['快速导航', ''], 'cta' => ['行动按钮', '

说明下一步。

联系来笙

'], 'resources' => ['资料与链接', ''], + 'contact-card' => ['联系方式', '

联系团队

填写咨询范围与回复时间。

电子邮件
hello@example.com
服务时间
填写工作时间
'], ]], ]; diff --git a/app/Controller/AdminController.php b/app/Controller/AdminController.php index 7f9d57b..c9602ab 100644 --- a/app/Controller/AdminController.php +++ b/app/Controller/AdminController.php @@ -591,7 +591,7 @@ class AdminController ], $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 diff --git a/app/view/admin-dashboard.php b/app/view/admin-dashboard.php index c05e9cb..75a25b8 100644 --- a/app/view/admin-dashboard.php +++ b/app/view/admin-dashboard.php @@ -2,24 +2,58 @@ use App\Content\View; $e = View::escape(...); +$live = count(array_filter($pages, static fn (array $page): bool => $page['status'] === 'published')); ?> -
-

内容管理

管理网站页面、文章、公告和产品动态。

-
新建页面 - 新建文章
+
+

网站后台

+
-
-

网站页面

- -
-
-

最近编辑的文章

管理全部文章
- $articles]) ?> -
+
+
+
+

网站页面

+

个已发布 · 个草稿

+
+ +

>

+ +
+
+
+

最近编辑的文章

+ $articles]) ?> + 管理全部文章 +
+
+

站点编辑

+ +
+
+
diff --git a/app/view/admin-layout.php b/app/view/admin-layout.php index 37a7e59..1dbe669 100644 --- a/app/view/admin-layout.php +++ b/app/view/admin-layout.php @@ -2,6 +2,13 @@ use App\Content\View; $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', +}; ?> @@ -29,18 +36,25 @@ $e = View::escape(...);
来笙 Laysense -