fix(admin): replicate reference post-feature settings page 1:1

- Rewrite post_list/feature schema (PHP + JS) with the reference theme's
  field set, order, defaults and dependencies; print/PDF toggles dropped
- Move the migrated reference fields off the post-page schema (lightbox
  six switches, post like, default view/like ranges) to kill the dual path
- Map PostDisplay::get_post_page_settings() to the new keys without legacy
  fallback: imagelightbox* (pc_s/m_s checkboxes merged), post_like_s,
  post_default_mate ranges, article_nav + article_nav_mobile_nav_s
- Wire article_nav runtime: content data-nav/no-nav gate with per-post
  override, mobile drawer TOC box, imgbox_type config
- Seed random views/likes on new posts from post_default_mate ranges
- Keep the print stylesheet enqueued unconditionally (no switch); drop the
  dead print/PDF settings and needs_print requirement
- Add post-feature settings reference contract test
This commit is contained in:
kate522 committed 2026-09-24 14:29:04 +08:00
1 parent c331b2aeef
commit 4d6b2c6045
12 files changed
+469 -85

No files matched your search

+35 -18
View File
@@ -76,15 +76,7 @@ class SchemaPostList {
['key' => 'post_article_video_cover', 'label' => '视频封面', 'type' => 'switch', 'default' => true, 'description' => '文章有视频时以视频播放器作为封面'],
['key' => 'post_article_video_cover_scale', 'label' => '视频封面高度比例(%)', 'type' => 'number', 'default' => 56, 'min' => 20, 'max' => 100],
]],
['key' => 'media', 'title' => '媒体功能', 'fields' => [
['key' => 'post_lightbox', 'label' => '图片灯箱', 'type' => 'switch', 'default' => true],
['key' => 'post_lightbox_thumbs', 'label' => '灯箱缩略图', 'type' => 'switch', 'default' => true],
['key' => 'post_lightbox_zoom', 'label' => '灯箱缩放', 'type' => 'switch', 'default' => true],
['key' => 'post_lightbox_full', 'label' => '灯箱全屏', 'type' => 'switch', 'default' => true],
['key' => 'post_lightbox_down', 'label' => '灯箱下载', 'type' => 'switch', 'default' => false],
['key' => 'post_lightbox_play', 'label' => '灯箱播放', 'type' => 'switch', 'default' => false],
]],
['key' => 'related', 'title' => '相关推荐', 'fields' => [
['key' => 'related', 'title' => '相关推荐', 'fields' => [
['key' => 'post_related_s', 'label' => '显示相关推荐', 'type' => 'switch', 'default' => true],
['key' => 'post_related_type', 'label' => '展示样式', 'type' => 'radio', 'default' => 'img', 'options' => [
['label' => '图文卡片', 'value' => 'img'],
@@ -104,7 +96,6 @@ class SchemaPostList {
]],
]],
['key' => 'interactions', 'title' => '互动功能', 'fields' => [
['key' => 'post_like_enabled', 'label' => '点赞', 'type' => 'switch', 'default' => true],
['key' => 'post_favorite_enabled', 'label' => '收藏', 'type' => 'switch', 'default' => true],
['key' => 'share_s', 'label' => '分享按钮', 'type' => 'switch', 'default' => true],
['key' => 'post_copyright_enabled', 'label' => '版权信息', 'type' => 'switch', 'default' => true],
@@ -131,10 +122,6 @@ class SchemaPostList {
['key' => 'post_yiyan_box', 'label' => '一言盒子', 'type' => 'switch', 'default' => false],
]],
['key' => 'meta', 'title' => 'Meta设置', 'fields' => [
['key' => 'post_default_views_min', 'label' => '默认浏览最小值', 'type' => 'number', 'default' => 20, 'min' => 0, 'max' => 9999],
['key' => 'post_default_views_max', 'label' => '默认浏览最大值', 'type' => 'number', 'default' => 50, 'min' => 1, 'max' => 9999],
['key' => 'post_default_likes_min', 'label' => '默认点赞最小值', 'type' => 'number', 'default' => 5, 'min' => 0, 'max' => 9999],
['key' => 'post_default_likes_max', 'label' => '默认点赞最大值', 'type' => 'number', 'default' => 15, 'min' => 1, 'max' => 9999],
['key' => 'post_views_s', 'label' => '浏览统计', 'type' => 'switch', 'default' => true],
]],
],
@@ -186,12 +173,42 @@ class SchemaPostList {
'feature' => [
'key' => 'feature',
'title' => '文章功能',
'version' => '1.0.0',
'version' => '2.0.0',
'option_key' => 'aksrt_settings',
'groups' => [
['key' => 'tools', 'title' => '工具功能', 'fields' => [
['key' => 'feature_print', 'label' => '打印文章', 'type' => 'switch', 'default' => true],
['key' => 'feature_pdf_export', 'label' => 'PDF 导出', 'type' => 'switch', 'default' => false],
['key' => 'feature', 'title' => '文章功能', 'fields' => [
['key' => 'article_nav', 'label' => '文章目录树', 'type' => 'switcher', 'default' => true, 'description' => '默认开关,每篇文章可单独设置。开启后请自行添加文章目录树模块到侧边栏(文章内标题超过3个才会显示)'],
['key' => 'article_nav_mobile_nav_s', 'label' => '在移动端弹出菜单内显示', 'type' => 'switcher', 'default' => true, 'dependsOn' => ['key' => 'article_nav', 'value' => true], 'description' => '如需显示在侧边栏等其它位置,请使用小工具模块添加'],
['key' => 'imagelightbox', 'label' => '图片灯箱', 'type' => 'switcher', 'default' => true, 'description' => '点击图片查看原图功能,共两种模式'],
['key' => 'imagelightbox_type', 'label' => '图片灯箱模式', 'type' => 'radio', 'default' => 'group', 'dependsOn' => ['key' => 'imagelightbox', 'value' => true], 'options' => [
['label' => '组合模式(将文章的全部图片组合成一组灯箱)', 'value' => 'group'],
['label' => '单张模式(点击某张图片仅显示该图片)', 'value' => 'alone'],
]],
['key' => 'imagelightbox_thumbs_s', 'label' => '缩略图导航', 'type' => 'checkbox', 'default' => ['pc_s', 'm_s'], 'dependsOn' => ['all' => [['key' => 'imagelightbox', 'value' => true], ['key' => 'imagelightbox_type', 'value' => 'group']]], 'options' => [
['label' => 'PC端开启', 'value' => 'pc_s'],
['label' => '移动端开启', 'value' => 'm_s'],
]],
['key' => 'imagelightbox_play_s', 'label' => '播放按钮', 'type' => 'checkbox', 'default' => ['pc_s', 'm_s'], 'dependsOn' => ['all' => [['key' => 'imagelightbox', 'value' => true], ['key' => 'imagelightbox_type', 'value' => 'group']]], 'options' => [
['label' => 'PC端开启', 'value' => 'pc_s'],
['label' => '移动端开启', 'value' => 'm_s'],
]],
['key' => 'imagelightbox_zoom_s', 'label' => '缩放按钮', 'type' => 'checkbox', 'default' => ['pc_s'], 'dependsOn' => ['key' => 'imagelightbox', 'value' => true], 'options' => [
['label' => 'PC端开启', 'value' => 'pc_s'],
['label' => '移动端开启', 'value' => 'm_s'],
]],
['key' => 'imagelightbox_full_s', 'label' => '全屏按钮', 'type' => 'checkbox', 'default' => ['pc_s'], 'dependsOn' => ['key' => 'imagelightbox', 'value' => true], 'options' => [
['label' => 'PC端开启', 'value' => 'pc_s'],
['label' => '移动端开启', 'value' => 'm_s'],
]],
['key' => 'imagelightbox_down_s', 'label' => '下载按钮', 'type' => 'checkbox', 'default' => ['pc_s'], 'dependsOn' => ['key' => 'imagelightbox', 'value' => true], 'options' => [
['label' => 'PC端开启', 'value' => 'pc_s'],
['label' => '移动端开启', 'value' => 'm_s'],
]],
['key' => 'post_like_s', 'label' => '文章点赞', 'type' => 'switcher', 'default' => true],
['key' => 'post_default_mate', 'label' => '文章预置参数', 'type' => 'fieldset', 'default' => ['views' => ['min' => 20, 'max' => 50], 'like' => ['min' => 5, 'max' => 15]], 'fields' => [
['key' => 'views', 'label' => '阅读量', 'type' => 'between_number', 'default' => ['min' => 20, 'max' => 50]],
['key' => 'like', 'label' => '点赞数', 'type' => 'between_number', 'default' => ['min' => 5, 'max' => 15], 'description' => '新建文章时系统会根据此处设置的区间获取随机值填入对应项'],
]],
]],
],
],