diff --git a/frontend/src/pages/Outline.tsx b/frontend/src/pages/Outline.tsx index d02e751..fb81b61 100644 --- a/frontend/src/pages/Outline.tsx +++ b/frontend/src/pages/Outline.tsx @@ -105,6 +105,17 @@ function parseOutlineStructure(structure?: string): OutlineStructureData { } } +function getOutlinePreview(content: string, maxLength = 120): { text: string; truncated: boolean } { + const normalized = (content || '').replace(/\s+/g, ' ').trim(); + if (normalized.length <= maxLength) { + return { text: normalized, truncated: false }; + } + return { + text: `${normalized.slice(0, maxLength).trimEnd()}...`, + truncated: true + }; +} + const { TextArea } = Input; export default function Outline() { @@ -123,6 +134,9 @@ export default function Outline() { const alphaColor = (color: string, alpha: number) => `color-mix(in srgb, ${color} ${(alpha * 100).toFixed(0)}%, transparent)`; + // ✅ 新增:记录大纲卡片内容的展开/折叠状态(默认折叠) + const [outlineContentExpandStatus, setOutlineContentExpandStatus] = useState>({}); + // ✅ 新增:记录场景区域的展开/折叠状态 const [scenesExpandStatus, setScenesExpandStatus] = useState>({}); @@ -1993,6 +2007,8 @@ export default function Outline() { const characterEntries = parseCharacterEntries(structureData.characters); const characterNames = getCharacterNames(characterEntries); const organizationNames = getOrganizationNames(characterEntries); + const isOutlineExpanded = outlineContentExpandStatus[item.id] || false; + const previewContent = getOutlinePreview(item.content, isMobile ? 70 : 140); return (
- 📝 大纲内容 +
+ 📝 大纲内容 +
+
- {item.content} + {isOutlineExpanded ? item.content : previewContent.text || '暂无内容'}
- + + {isOutlineExpanded && ( + <> {/* ✨ 涉及角色展示 - 优化版(支持角色/组织分类显示) */} {characterNames.length > 0 && (
)} + + )} } /> diff --git a/frontend/src/pages/ProjectWizardNew.tsx b/frontend/src/pages/ProjectWizardNew.tsx index 3af6180..668b901 100644 --- a/frontend/src/pages/ProjectWizardNew.tsx +++ b/frontend/src/pages/ProjectWizardNew.tsx @@ -372,7 +372,7 @@ export default function ProjectWizardNew() {
{currentStep === 'form' && renderForm()} {currentStep === 'generating' && generationConfig && (