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:
2026-09-24 14:29:04 +08:00
parent c331b2aeef
commit 4d6b2c6045
12 changed files with 469 additions and 85 deletions
@@ -2,19 +2,121 @@ export const featureSchema = {
key: 'post_list.feature',
title: '文章功能',
icon: 'fa fas fa-magic',
description: '配置文章页的互动功能开关。',
description: '配置文章目录树、图片灯箱、点赞与新建文章的预置参数。',
defaults: {
feature_pdf_export: false,
feature_print: true,
article_nav: true,
article_nav_mobile_nav_s: true,
imagelightbox: true,
imagelightbox_type: 'group',
imagelightbox_thumbs_s: ['pc_s', 'm_s'],
imagelightbox_play_s: ['pc_s', 'm_s'],
imagelightbox_zoom_s: ['pc_s'],
imagelightbox_full_s: ['pc_s'],
imagelightbox_down_s: ['pc_s'],
post_like_s: true,
post_default_mate: { views: { min: 20, max: 50 }, like: { min: 5, max: 15 } },
},
groups: [
{
key: 'tools',
title: '工具功能',
icon: 'fa fas fa-wrench',
key: 'feature',
title: '',
fields: [
{ key: 'feature_print', label: '打印文章', type: 'switch', default: true },
{ key: 'feature_pdf_export', label: 'PDF 导出', type: 'switch', default: false, help: '实验性功能' },
{ key: 'article_nav', label: '文章目录树', type: 'switch', default: true, description: '默认开关,每篇文章可单独设置。开启后请自行添加文章目录树模块到侧边栏(文章内标题超过3个才会显示)' },
{
key: 'article_nav_tutorial',
label: '',
type: 'content',
ui_only: true,
dependsOn: { key: 'article_nav', value: true },
content: '<p style="margin:0 0 12px;font-size:12px;"><a href="https://www.zibll.com/1717.html" target="_blank">【查看官网教程】</a></p>',
},
{ key: 'article_nav_mobile_nav_s', label: '在移动端弹出菜单内显示', type: 'switch', default: true, dependsOn: { key: 'article_nav', value: true }, description: '如需显示在侧边栏等其它位置,请使用小工具模块添加' },
{ key: 'imagelightbox', label: '图片灯箱', type: 'switch', default: true, description: '点击图片查看原图功能,共两种模式' },
{
key: 'imagelightbox_tutorial',
label: '',
type: 'content',
ui_only: true,
dependsOn: { key: 'imagelightbox', value: true },
content: '<p style="margin:0 0 12px;font-size:12px;"><a href="https://www.zibll.com/683.html" target="_blank">【查看官网教程】</a></p>',
},
{
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: 'switch', 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: '新建文章时系统会根据此处设置的区间获取随机值填入对应项' },
],
},
],
},
],
@@ -2,7 +2,7 @@ export const pageSchema = {
key: 'post_list.page',
title: '文章页面',
icon: 'fa fas fa-file-alt',
description: '配置单篇文章页面的布局、图片灯箱、版权区和互动功能。',
description: '配置单篇文章页面的导航、封面、版权区与互动功能。',
defaults: {
post_reading_progress: true,
breadcrumbs_single_s: true,
@@ -10,12 +10,6 @@ export const pageSchema = {
post_prevnext_s: true,
post_authordesc_s: true,
post_single_hide_time_s: false,
post_lightbox: true,
post_lightbox_thumbs: true,
post_lightbox_zoom: true,
post_lightbox_full: true,
post_lightbox_down: false,
post_lightbox_play: false,
post_related_s: true,
post_related_type: 'img',
related_title: '相关推荐',
@@ -25,17 +19,12 @@ export const pageSchema = {
post_copyright_enabled: true,
post_copyright_text: '',
share_s: true,
post_like_enabled: true,
post_favorite_enabled: true,
post_front_content: '',
post_after_content: '',
post_yiyan_header: false,
post_yiyan_footer: false,
post_yiyan_box: false,
post_default_views_min: 20,
post_default_views_max: 50,
post_default_likes_min: 5,
post_default_likes_max: 15,
post_article_image_cover: true,
post_article_image_cover_scale: 35,
post_article_slide_cover: true,
@@ -89,19 +78,6 @@ export const pageSchema = {
{ key: 'post_article_video_cover_scale', label: '视频封面高度比例(%)', type: 'number', default: 56, min: 20, max: 100, dependsOn: { key: 'post_article_video_cover', value: true } },
],
},
{
key: 'media',
title: '媒体功能',
icon: 'fa fas fa-image',
fields: [
{ key: 'post_lightbox', label: '图片灯箱', type: 'switch', default: true, help: '点击图片放大查看' },
{ key: 'post_lightbox_thumbs', label: '灯箱缩略图', type: 'switch', default: true, dependsOn: { key: 'post_lightbox', value: true }, help: '灯箱底部显示缩略图导航' },
{ key: 'post_lightbox_zoom', label: '灯箱缩放', type: 'switch', default: true, dependsOn: { key: 'post_lightbox', value: true }, help: '灯箱显示缩放按钮' },
{ key: 'post_lightbox_full', label: '灯箱全屏', type: 'switch', default: true, dependsOn: { key: 'post_lightbox', value: true }, help: '灯箱显示全屏按钮' },
{ key: 'post_lightbox_down', label: '灯箱下载', type: 'switch', default: false, dependsOn: { key: 'post_lightbox', value: true }, help: '灯箱显示下载按钮' },
{ key: 'post_lightbox_play', label: '灯箱播放', type: 'switch', default: false, dependsOn: { key: 'post_lightbox', value: true }, help: '灯箱显示播放按钮(自动轮播)' },
],
},
{
key: 'related',
title: '相关推荐',
@@ -131,7 +107,6 @@ export const pageSchema = {
title: '互动功能',
icon: 'fa fas fa-heart',
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 },
@@ -166,16 +141,5 @@ export const pageSchema = {
{ key: 'post_yiyan_box', label: '一言盒子', type: 'switch', default: false, help: '在相关文章前显示一言盒子' },
],
},
{
key: 'meta',
title: '默认数值',
icon: 'fa fas fa-chart-bar',
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 },
],
},
],
}