fix(header): wire multi-function page-type enable like zibll

Connect header_components_show_on through aksrt_header_slide_is_show with
zibll page-type matching, drop the homepage-only gate, align admin options,
apply nav color, enqueue by is_show, remove dead float-btn schema, and
consume footer_tabbar_single extend mode on post singles.
This commit is contained in:
2026-07-15 17:12:51 +08:00
parent 3e3a4631f0
commit bfb64211ee
12 changed files with 445 additions and 285 deletions
@@ -86,16 +86,6 @@ export const pageDisplaySection = {
desc: '首页内容模型、主列表、分类 Tab 与首页交互配置。',
component: 'HomepageSettings',
}),
schemaPage({
key: 'page-display-float-btn',
name: 'PageDisplayFloatBtn',
label: '悬浮按钮',
route: '/page-display/float-btn',
title: '悬浮按钮',
desc: '悬浮按钮的显示规则、样式与滚动隐藏设置。',
canonicalDomain: 'page_display',
section: 'float-btn',
}),
schemaPage({
key: 'page-display-category',
name: 'PageDisplayCategory',
+5 -46
View File
@@ -5,21 +5,13 @@
<n-card class="aksrt-section-card" style="margin-bottom:16px;">
<template #header>
<div class="aksrt-card-header-row">
<strong>Hero 显示开关</strong>
<n-button size="small" secondary @click="goHeaderComponents">顶部多功能组件(搜索/卡片/轮播参数)</n-button>
<strong>显示范围</strong>
<n-button size="small" secondary @click="goHeaderComponents">顶部多功能组件(页面类型/搜索/卡片)</n-button>
</div>
</template>
<n-form label-placement="left" label-width="160" class="aksrt-form">
<n-form-item label="显示首页 Hero">
<div class="aksrt-inline-setting">
<n-switch v-model:value="heroEnabled" :disabled="settingsLoading || settingsSaving" />
<span class="aksrt-inline-setting__hint">关闭后,首页 Hero 区块将不再渲染。</span>
</div>
</n-form-item>
</n-form>
<div class="aksrt-inline-setting__actions">
<n-button type="primary" :loading="settingsSaving" :disabled="settingsLoading" @click="saveHeroSettings">保存 Hero 开关</n-button>
</div>
<p class="aksrt-inline-setting__hint" style="margin:0;">
幻灯片内容在此维护。页面类型启用、设备规则、搜索覆盖层与图标卡片请到「顶部多功能组件」配置;全不选页面类型即为关闭。
</p>
</n-card>
<n-spin :show="loading" style="width:100%; min-height:200px;">
@@ -216,10 +208,7 @@ function goHeaderComponents() {
}
const loading = ref(true)
const saving = ref(false)
const settingsLoading = ref(false)
const settingsSaving = ref(false)
const slides = ref([])
const heroEnabled = ref(true)
const modalShow = ref(false)
const editing = ref(emptyForm())
@@ -348,36 +337,7 @@ async function loadSlides() {
}
}
async function loadHeroSettings() {
settingsLoading.value = true
try {
const res = await api.getHomepageSettings()
const data = res?.data || {}
heroEnabled.value = data.homepage_module_hero_enabled !== false
} catch (e) {
message.error(e.message || '加载 Hero 开关失败')
} finally {
settingsLoading.value = false
}
}
async function saveHeroSettings() {
settingsSaving.value = true
try {
const res = await api.saveHomepageSettings({
homepage_module_hero_enabled: heroEnabled.value,
})
if (res?.code === 'success') {
message.success('Hero 开关已保存')
return
}
throw new Error(res?.message || '保存 Hero 开关失败')
} catch (e) {
message.error(e.message || '保存 Hero 开关失败')
} finally {
settingsSaving.value = false
}
}
function openCreate() {
editing.value = emptyForm()
@@ -495,7 +455,6 @@ function handleDelete(row) {
onMounted(() => {
loadSlides()
loadHeroSettings()
})
</script>
@@ -626,14 +626,17 @@ export const pageDisplaySchemas = {
{ key: 'header_components_cards_enabled', label: '启用图标卡片', type: 'switch', default: false, help: '在顶部组件区域显示图标卡片入口' },
{ key: 'header_components_show_on', label: '按页面类型启用', type: 'checkbox', default: ['home'], options: [
{ label: '首页', value: 'home' },
{ label: '文章', value: 'single' },
{ label: '页面', value: 'page' },
{ label: '分类', value: 'category' },
{ label: '标签', value: 'tag' },
{ label: '搜索', value: 'search' },
{ label: '归档', value: 'archive' },
{ label: '专题', value: 'special' },
], help: '选择哪些页面类型显示顶部组件,不选则关闭' },
{ label: '专题页', value: 'topics' },
{ label: '分类页', value: 'category' },
{ label: '标签页', value: 'tag' },
{ label: '用户页', value: 'author' },
{ label: '文章页', value: 'single' },
{ label: '搜索页', value: 'search' },
{ label: '[论坛]首页', value: 'forum_home' },
{ label: '[论坛]板块页面', value: 'forum_plate' },
{ label: '[论坛]帖子页面', value: 'forum_post' },
{ label: '其它页面', value: 'page' },
], help: '选择启用顶部多功能组件的页面类型,一个都不选则为关闭此功能' },
{ key: 'header_components_device_visibility', label: '设备显示规则', type: 'radio', default: '', options: [
{ label: '全部', value: '' },
{ label: '仅电脑', value: 'only_pc' },
@@ -742,74 +745,6 @@ export const pageDisplaySchemas = {
],
},
/**
* Floating button settings
*/
'float-btn': {
key: 'page_display.float-btn',
title: '悬浮按钮',
icon: 'fas fa-circle-chevron-up',
description: '配置页面悬浮按钮的显示规则、样式和滚动隐藏行为。',
defaults: {
float_btn_style: 'round',
float_btn_position: 'bottom',
float_btn_scroll_hide: false,
float_btn_scroll_down_hide: true,
float_btn_max: 5,
float_btn_size: 44,
float_btn_spacing: 10,
float_btn_shadow: true,
float_btn_animation: true,
float_btn_opacity: 100,
float_btn_active_color: '',
float_btn_bg_color: '',
float_btn_pc_s: true,
float_btn_m_s: true,
float_btn_filter_css: '',
},
groups: [
{
key: 'basic',
title: '悬浮按钮设置',
icon: 'fas fa-circle-notch',
fields: [
{
key: 'float_btn_style',
label: '按钮风格',
type: 'radio',
default: 'round',
options: [
{ label: '圆形', value: 'round' },
{ label: '方形', value: 'square' },
],
},
{
key: 'float_btn_position',
label: '按钮位置',
type: 'radio',
default: 'bottom',
options: [
{ label: '底部', value: 'bottom' },
{ label: '居中', value: 'center' },
],
},
{ key: 'float_btn_scroll_hide', label: '滚动时隐藏', type: 'switch', default: false },
{ key: 'float_btn_scroll_down_hide', label: '下滑时隐藏', type: 'switch', default: true },
{ key: 'float_btn_max', label: '最大显示数', type: 'number', default: 5, min: 1, max: 10 },
{ key: 'float_btn_size', label: '按钮尺寸', type: 'number', default: 44, min: 32, max: 64 },
{ key: 'float_btn_spacing', label: '按钮间距', type: 'number', default: 10, min: 4, max: 24 },
{ key: 'float_btn_shadow', label: '显示阴影', type: 'switch', default: true },
{ key: 'float_btn_animation', label: '悬停动画', type: 'switch', default: true },
{ key: 'float_btn_opacity', label: '按钮透明度', type: 'number', default: 100, min: 30, max: 100 },
{ key: 'float_btn_active_color', label: '激活颜色', type: 'color', default: '' },
{ key: 'float_btn_bg_color', label: '背景颜色', type: 'color', default: '' },
{ key: 'float_btn_pc_s', label: 'PC端显示', type: 'switch', default: true },
{ key: 'float_btn_m_s', label: '移动端显示', type: 'switch', default: true },
{ key: 'float_btn_filter_css', label: '过滤 CSS', type: 'textarea', default: '' },
],
},
],
},
footer: {
key: 'page_display.footer',
title: '底部页脚',