chore(cms): 清理旧版 CMS 客户端代码,完成 CMS 迁移
- 删除已废弃的 CMS 客户端代码:mock-data、registry、client、storage、renderers 等 - 删除已归档的 CMS 页面组件:home-content-cms、news-content-cms、services-content-cms 等 - 删除 CMS Studio 页面 - 将 CaseStudyData 类型移至 types.ts,统一类型定义 - 移除 content-types 对 registry 的依赖,内联 ContentTypeConfig - 修复测试文件中对已删除 mock-data 的引用 - 添加 site-config 和 navigation 内容模型种子数据 - 更新 revalidate API 路由使用 CONTENT_TYPE_CONFIGS 共修改 34 个文件,+132 / -5993 行
This commit is contained in:
+78
-2
@@ -8,6 +8,8 @@ import { SERVICES } from '../src/lib/constants/services';
|
||||
import { PRODUCTS } from '../src/lib/constants/products';
|
||||
import { SOLUTIONS } from '../src/lib/constants/solutions';
|
||||
import { STATS } from '../src/lib/constants/stats';
|
||||
import { COMPANY_INFO } from '../src/lib/constants/company';
|
||||
import { NAVIGATION_V2, MEGA_DROPDOWN_DATA } from '../src/lib/constants/navigation';
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
@@ -30,7 +32,7 @@ async function seedItems(
|
||||
const item = items[i]!;
|
||||
const slug = String(item[slugField] || item.id || `${modelCode}-${i}`);
|
||||
const title = String(item[titleField] || `未命名 ${i + 1}`);
|
||||
const { id, slug: _s, title: _t, ...data } = item as Record<string, unknown>;
|
||||
const { id: _id, slug: _s, title: _t, ...data } = item as Record<string, unknown>;
|
||||
|
||||
await prisma.contentItem.upsert({
|
||||
where: { modelCode_slug: { modelCode, slug } },
|
||||
@@ -216,6 +218,49 @@ async function main() {
|
||||
],
|
||||
},
|
||||
},
|
||||
// === site-config ===
|
||||
{
|
||||
model: {
|
||||
code: 'site-config',
|
||||
name: '站点配置',
|
||||
description: '公司基本信息、SEO 元数据等全局配置',
|
||||
isPageType: false,
|
||||
urlPattern: '',
|
||||
hasVersions: false,
|
||||
hasDraft: true,
|
||||
icon: 'settings',
|
||||
fields: [
|
||||
{ name: 'name', type: 'text', label: '公司全称', required: true },
|
||||
{ name: 'shortName', type: 'text', label: '公司简称', required: true },
|
||||
{ name: 'displayName', type: 'text', label: '展示名称', required: true },
|
||||
{ name: 'slogan', type: 'text', label: '品牌标语', required: true },
|
||||
{ name: 'description', type: 'textarea', label: '公司简介', required: true },
|
||||
{ name: 'founded', type: 'text', label: '成立年份' },
|
||||
{ name: 'location', type: 'text', label: '所在地' },
|
||||
{ name: 'email', type: 'text', label: '联系邮箱', required: true },
|
||||
{ name: 'address', type: 'text', label: '办公地址', required: true },
|
||||
{ name: 'icp', type: 'text', label: 'ICP 备案号' },
|
||||
{ name: 'police', type: 'text', label: '公安备案号' },
|
||||
],
|
||||
},
|
||||
},
|
||||
// === navigation ===
|
||||
{
|
||||
model: {
|
||||
code: 'navigation',
|
||||
name: '导航菜单',
|
||||
description: '主导航项和下拉菜单内容',
|
||||
isPageType: false,
|
||||
urlPattern: '',
|
||||
hasVersions: false,
|
||||
hasDraft: true,
|
||||
icon: 'menu',
|
||||
fields: [
|
||||
{ name: 'mainNav', type: 'json', label: '主导航项', required: true },
|
||||
{ name: 'megaDropdown', type: 'json', label: '下拉菜单数据', required: true },
|
||||
],
|
||||
},
|
||||
},
|
||||
// === legal-page ===
|
||||
{
|
||||
model: {
|
||||
@@ -300,7 +345,7 @@ async function main() {
|
||||
const s = statList[i] as Record<string, unknown>;
|
||||
const slug = `stat-${i}`;
|
||||
const title = String(s.label || `指标 ${i + 1}`);
|
||||
const { id, ...data } = s;
|
||||
const { id: _id, ...data } = s;
|
||||
await prisma.contentItem.upsert({
|
||||
where: { modelCode_slug: { modelCode: 'stat-item', slug } },
|
||||
update: {
|
||||
@@ -495,6 +540,37 @@ async function main() {
|
||||
]);
|
||||
console.log(' ✅ 法律页面');
|
||||
|
||||
console.log('📝 导入站点配置...');
|
||||
await seedItems('site-config', [
|
||||
{
|
||||
slug: 'default',
|
||||
title: '站点配置',
|
||||
name: COMPANY_INFO.name,
|
||||
shortName: COMPANY_INFO.shortName,
|
||||
displayName: COMPANY_INFO.displayName,
|
||||
slogan: COMPANY_INFO.slogan,
|
||||
description: COMPANY_INFO.description,
|
||||
founded: COMPANY_INFO.founded,
|
||||
location: COMPANY_INFO.location,
|
||||
email: COMPANY_INFO.email,
|
||||
address: COMPANY_INFO.address,
|
||||
icp: COMPANY_INFO.icp,
|
||||
police: COMPANY_INFO.police,
|
||||
},
|
||||
]);
|
||||
console.log(' ✅ 站点配置');
|
||||
|
||||
console.log('📝 导入导航菜单...');
|
||||
await seedItems('navigation', [
|
||||
{
|
||||
slug: 'default',
|
||||
title: '导航菜单',
|
||||
mainNav: NAVIGATION_V2,
|
||||
megaDropdown: MEGA_DROPDOWN_DATA,
|
||||
},
|
||||
]);
|
||||
console.log(' ✅ 导航菜单');
|
||||
|
||||
// ============ 5. 创建默认内容区域 ============
|
||||
console.log('📝 创建默认内容区域...');
|
||||
const defaultZones = [
|
||||
|
||||
Reference in New Issue
Block a user