fix(admin): restore Vite admin source files

This commit is contained in:
2026-08-17 20:02:36 +08:00
parent 8fe3a89c36
commit ac5c0b2dd7
114 changed files with 17272 additions and 0 deletions
@@ -0,0 +1,10 @@
/**
* Admin sections — central menu and route registry.
*
* Sidebar menu, route metadata, schema domain mapping, and deferred-page
* planning details are all registered in domain modules to avoid drift between
* the navigation tree and router definitions while keeping each file focused.
*/
export { ADMIN_SECTIONS, getAdminSections, getAllAdminPages } from './sections/index.js'
export { renderFaIcon, customPage, schemaPage, deferredPage } from './sections/helpers.js'
@@ -0,0 +1,20 @@
import { renderFaIcon, customPage } from './helpers'
export const docsSection = {
key: 'tools-compat',
label: '兼容&工具',
icon: renderFaIcon('fas fa-toolbox'),
route: '/tools',
hidden: true,
children: [
customPage({
key: 'docs-dashboard',
name: 'DocsDashboard',
label: '文档中心',
route: '/docs',
component: 'DocsPage',
title: '文档中心',
desc: '更新日志、文档链接和发布说明。',
}),
],
}
@@ -0,0 +1,108 @@
import { renderFaIcon, schemaPage, customPage } from './helpers'
export const globalSection = {
key: 'global',
label: '全局&功能',
icon: renderFaIcon('fas fa-globe'),
route: '/global',
children: [
schemaPage({
key: 'global-common',
name: 'GlobalCommon',
label: '常用功能',
route: '/global/common',
title: '常用功能',
desc: '评论、性能、头像源与备案等全局基础配置。',
canonicalDomain: 'global',
section: 'common',
}),
schemaPage({
key: 'global-logo',
name: 'GlobalLogo',
label: 'LOGO图像',
route: '/global/logo',
title: 'LOGO图像',
desc: '管理站点 Logo、站点图标和品牌标识。',
canonicalDomain: 'global',
section: 'logo',
}),
schemaPage({
key: 'global-seo',
name: 'GlobalSeo',
label: 'SEO优化',
route: '/global/seo',
title: 'SEO优化',
desc: '站点标题、描述、关键词、Sitemap 等搜索引擎优化设置。',
canonicalDomain: 'global',
section: 'seo',
}),
schemaPage({
key: 'global-layout',
name: 'GlobalLayout',
label: '显示&布局',
route: '/global/layout',
title: '显示&布局',
desc: '全局布局风格、颜色方案、字体设置。',
canonicalDomain: 'global',
section: 'layout',
}),
schemaPage({
key: 'global-search',
name: 'GlobalSearch',
label: '搜索功能',
route: '/global/search',
title: '搜索功能',
desc: '搜索页面样式、搜索建议、热门搜索配置。',
canonicalDomain: 'global',
section: 'search',
}),
customPage({
key: 'global-tabbar',
name: 'GlobalTabbar',
label: '手机底部Tab',
route: '/global/tabbar',
title: '手机底部Tab',
desc: '移动端底部导航栏配置。',
component: 'FooterTabbarSettings',
}),
customPage({
key: 'global-floating',
name: 'GlobalFloating',
label: '右侧悬浮按钮',
route: '/global/floating',
title: '右侧悬浮按钮',
desc: '页面右侧浮动按钮的显示与配置。',
component: 'FloatingButtonsSettings',
}),
schemaPage({
key: 'global-i18n',
name: 'GlobalI18n',
label: '多语言翻译',
route: '/global/i18n',
title: '多语言翻译',
desc: '配置站点语言、语言切换器和翻译管理。',
canonicalDomain: 'global',
section: 'i18n',
}),
schemaPage({
key: 'global-email',
name: 'GlobalEmail',
label: 'Email邮件',
route: '/global/email',
title: 'Email邮件',
desc: 'SMTP 发信配置、邮件模板与测试。',
canonicalDomain: 'global',
section: 'email',
}),
schemaPage({
key: 'global-custom-code',
name: 'GlobalCustomCode',
label: '自定义代码',
route: '/global/custom-code',
title: '自定义代码',
desc: '自定义 CSS、JS 代码注入。',
canonicalDomain: 'global',
section: 'custom-code',
}),
],
}
@@ -0,0 +1,39 @@
import { h } from 'vue'
export function renderFaIcon(faClass) {
return () => h('i', { class: faClass, style: 'font-size:18px;width:18px;text-align:center' })
}
function sectionPage(config) {
return {
status: 'available',
component: 'SchemaPage',
canonicalDomain: '',
section: '',
phase: '',
dependsOn: [],
reason: '',
features: [],
iconClass: '',
...config,
}
}
export function customPage(config) {
return sectionPage(config)
}
export function schemaPage(config) {
return sectionPage({
component: 'SchemaPage',
...config,
})
}
export function deferredPage(config) {
return sectionPage({
component: 'DeferredPage',
status: 'deferred',
...config,
})
}
@@ -0,0 +1,92 @@
import { renderFaIcon, schemaPage, customPage } from './helpers'
export const postListSection = {
key: 'post-list',
label: '文章&列表',
icon: renderFaIcon('fas fa-file-alt'),
route: '/post-list',
children: [
schemaPage({
key: 'post-list-list',
name: 'PostListList',
label: '文章列表',
route: '/post-list/list',
title: '文章列表',
desc: '列表样式、元信息开关、分页方式配置。',
canonicalDomain: 'post_list',
section: 'list',
}),
schemaPage({
key: 'post-list-thumb',
name: 'PostListThumb',
label: '列表缩略图',
route: '/post-list/thumb',
title: '列表缩略图',
desc: '缩略图策略、封面回退、多图模式配置。',
canonicalDomain: 'post_list',
section: 'thumb',
}),
schemaPage({
key: 'post-list-page',
name: 'PostListPage',
label: '文章页面',
route: '/post-list/page',
component: 'PostPageSettings',
title: '文章页面',
desc: '文章页布局、目录树、灯箱、版权区配置。',
canonicalDomain: 'post_list',
section: 'page',
}),
schemaPage({
key: 'post-list-filter',
name: 'PostListFilter',
label: '高级筛选',
route: '/post-list/filter',
title: '高级筛选',
desc: '筛选栏、排序方式、分类筛选配置。',
canonicalDomain: 'post_list',
section: 'filter',
}),
schemaPage({
key: 'post-list-feature',
name: 'PostListFeature',
label: '文章功能',
route: '/post-list/feature',
title: '文章功能',
desc: '收藏、分享、阅读进度、相关推荐等功能开关。',
canonicalDomain: 'post_list',
section: 'feature',
}),
schemaPage({
key: 'post-list-share',
name: 'PostListShare',
label: '分享设置',
route: '/post-list/share',
title: '分享设置',
desc: '配置微信分享凭据、海报分享和社交分享选项。',
canonicalDomain: 'post_list',
section: 'share',
}),
schemaPage({
key: 'post-list-comment',
name: 'PostListComment',
label: '评论设置',
route: '/post-list/comment',
component: 'CommentSettings',
title: '评论设置',
desc: '评论排序、楼层展示、登录限制、回复限制等配置。',
canonicalDomain: 'post_list',
section: 'comment',
}),
schemaPage({
key: 'post-list-submit',
name: 'PostListSubmit',
label: '前台投稿',
route: '/post-list/submit',
title: '前台投稿',
desc: '配置前台投稿表单字段、审核流程、附件权限和封面策略。',
canonicalDomain: 'post_list',
section: 'submit',
}),
],
}
@@ -0,0 +1,29 @@
import { renderFaIcon, customPage } from './helpers'
export const themeInfoSection = {
key: 'tools-compat',
label: '兼容&工具',
icon: renderFaIcon('fas fa-toolbox'),
route: '/tools',
hidden: true,
children: [
customPage({
key: 'theme-info-dashboard',
name: 'ThemeInfoDashboard',
label: '主题信息',
route: '/theme-info',
component: 'ThemeInfoPage',
title: '主题信息',
desc: '主题版本、授权信息和帮助入口。',
}),
customPage({
key: 'theme-authorization',
name: 'ThemeAuthorization',
label: '主题授权',
route: '/theme-info/authorization',
component: 'ThemeAuthorizationPage',
title: '主题授权',
desc: '当前版本的授权策略与产品决策说明。',
}),
],
}
@@ -0,0 +1,28 @@
import { ALL_SCHEMAS, CANONICAL_SCHEMA_DOMAINS, normalizeSchemaDomain } from '@/schema/index.js'
function cloneDefaults(defaults = {}) {
return JSON.parse(JSON.stringify(defaults))
}
export function getSectionDefaults(domain, section) {
const domainKey = normalizeSchemaDomain(domain)
const sectionSchema = ALL_SCHEMAS[domainKey]?.[section]
return cloneDefaults(sectionSchema?.defaults || {})
}
export function getDomainDefaults(domain) {
const domainKey = normalizeSchemaDomain(domain)
const sections = Object.values(ALL_SCHEMAS[domainKey] || {})
return sections.reduce((defaults, schema) => {
return {
...defaults,
...cloneDefaults(schema?.defaults || {}),
}
}, {})
}
export const SETTINGS_DEFAULTS_BY_DOMAIN = CANONICAL_SCHEMA_DOMAINS.reduce((defaults, domain) => {
defaults[domain] = getDomainDefaults(domain)
return defaults
}, {})