Files
wordpress-theme-aksrt/assets/admin/src/schema/sections/global/common.js
T

73 lines
2.9 KiB
JavaScript

const themeRoot = typeof window !== 'undefined' && window.aksrtAdminData?.themeUri
? String(window.aksrtAdminData.themeUri).replace(/\/$/, '')
: ''
const defaultThumbnail = themeRoot ? `${themeRoot}/assets/img/thumbnail.svg` : ''
export const commonSchema = {
key: 'global.common',
title: '常用功能',
icon: 'fas fa-cog',
description: '管理站点常用开关、懒加载与备案信息等基础配置。',
defaults: {
lazy_posts_thumb: true,
lazy_avatar: true,
lazy_posts_content: false,
lazy_comment: true,
lazy_private: true,
lazy_sider: true,
lazy_cover: true,
lazy_other: true,
lazy_animation: 'blur',
thumbnail: defaultThumbnail,
icp_filing: '',
police_filing: '',
footer_text: '',
},
groups: [
{
key: 'performance',
title: '性能优化',
icon: 'fas fa-tachometer-alt',
fields: [
{ key: 'lazy_posts_thumb', label: '文章缩略图懒加载', type: 'switch', default: true, help: '滚动到图像附近时再加载真实图片。' },
{
key: 'lazy_animation',
label: '懒加载动画',
type: 'select',
default: 'blur',
options: [
{ label: '模糊渐显', value: 'blur' },
{ label: '淡入', value: 'fade' },
{ label: '缩放', value: 'scale' },
],
},
{ key: 'thumbnail', label: '懒加载预载图', type: 'media', default: defaultThumbnail, help: '图片加载前显示的占位图。' },
],
},
{
key: 'lazyload-scope',
title: '懒加载范围',
icon: 'fas fa-layer-group',
fields: [
{ key: 'lazy_avatar', label: '头像懒加载', type: 'switch', default: true },
{ key: 'lazy_posts_content', label: '文章内容图片懒加载', type: 'switch', default: false },
{ key: 'lazy_comment', label: '评论内容图片懒加载', type: 'switch', default: true },
{ key: 'lazy_private', label: '私信聊天图片懒加载', type: 'switch', default: true },
{ key: 'lazy_sider', label: '幻灯片图片懒加载', type: 'switch', default: true },
{ key: 'lazy_cover', label: '封面图片懒加载', type: 'switch', default: true },
{ key: 'lazy_other', label: '其它图片懒加载', type: 'switch', default: true },
],
},
{
key: 'filing',
title: '备案信息',
icon: 'fas fa-shield-alt',
fields: [
{ key: 'icp_filing', label: 'ICP 备案号', type: 'input', placeholder: '例如:京ICP备12345678号', help: '显示在页脚的备案信息' },
{ key: 'police_filing', label: '公安备案号', type: 'input', placeholder: '例如:公网安备11000000000000号', help: '显示在页脚的备案信息' },
{ key: 'footer_text', label: '页脚附加文字', type: 'input', placeholder: '自定义页脚文字', help: '显示在版权信息下方' },
],
},
],
}