Files
weicw-dshsa b88c9df3b3 chore(templates): 只保留 template-07,删除其余 9 套模板
汇吉采仅使用 template-07(后端绑定 + .env.development),其余
template-01~06、08~10 为多租户 SaaS 平台时代遗留,全部删除:

- 删除 app/templates/ 下 9 套模板目录及注册表内对应配置
- 删除 public/images/template-{01,03,09,10} 图片目录
- 删除 templates/cloud-website 下 9 张模板预览图
- 三处 template-01 兜底(nuxt.config / useTemplate / default.vue)改为 07
- 清理指向已删模板的注释,README 模板系统章节同步更新

模板动态加载机制保留:新增模板 = 建目录 + 在 app/templates/index.ts 注册
2026-09-30 07:38:05 +08:00

46 lines
2.0 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type { CaseItem } from '~/app/types'
/**
* 将 CMS 后端案例对象(字段:caseId / caseName / customer …)
* 映射为前端模板约定的 CaseItem(字段:id / title / clientName …)。
*
* 后端 cms-case 控制器返回的是 caseId / caseName / customer,
* 而前端模板组件(template-07)按 id / title / clientName 渲染,
* 故在此统一做一次字段归一化,避免各页面散落做字段转换。
*/
export function normalizeCaseItem(raw: any): CaseItem {
if (!raw) return raw
return {
// 主键与标题
id: raw.caseId ?? raw.id,
title: raw.caseName ?? raw.title,
// 封面 / 摘要 / 正文
cover: raw.cover ?? '',
summary: raw.summary ?? raw.subtitle ?? '',
// 正文:部分 CMS 版本正文在 description,兜底回退(content 优先)
content: raw.content ?? raw.description ?? '',
// 分类
categoryId: raw.categoryId ?? null,
categoryName: raw.categoryName ?? '',
// 客户(后端字段名 customer)→ 前端 clientName
clientName: raw.customer ?? raw.clientName ?? '',
industry: raw.industry ?? '',
// 发布时间:运营可见的对外时间,官网展示与排序的锚点(后端 cms_case.publish_time)。
// 不再回退 createTime——那是系统记录时间,运营没设过,展示它等于显示错误值。
publishTime: raw.publishTime ?? '',
// 关联产品(后端 productUsed)作为标签兜底
tags: raw.productUsed ? [raw.productUsed] : (raw.tags ?? []),
// 排序 / 状态 / 浏览量
sortNumber: raw.sortNum ?? raw.sortNumber ?? 0,
status: raw.status,
views: raw.views ?? 0,
// 置顶 / 推荐(当前上游 cms-case 暂无此字段,透传以便后续版本自动生效;
// 前端 useRecommend 检测到该字段后会将案例区块自动切换为「推荐」过滤)
top: raw.top ?? 0,
recommend: raw.recommend ?? 0,
createTime: raw.createTime ?? '',
updateTime: raw.updateTime ?? ''
}
}