From 05e55761058e2089e81fb93dd4000dc3f42f40b3 Mon Sep 17 00:00:00 2001 From: hongjli <3117313295@qq.com> Date: 星期四, 05 六月 2025 16:17:12 +0800 Subject: [PATCH] 页面调整优化 --- src/components/SceneIntroDialog.tsx | 138 +++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 125 insertions(+), 13 deletions(-) diff --git a/src/components/SceneIntroDialog.tsx b/src/components/SceneIntroDialog.tsx index fea9b41..15ae804 100644 --- a/src/components/SceneIntroDialog.tsx +++ b/src/components/SceneIntroDialog.tsx @@ -44,11 +44,66 @@ const handleStartChat = () => { onClose(); - document.body.classList.add('page-transitioning'); - setTimeout(() => { - window.location.href = `/ai-scene/chat?scene=${scene.chatbotId}`; - }, 100); + // 渚涘簲閾惧叏鏅礊瀵熷満鏅娇鐢ㄤ笓鐢ㄧ殑鑱婂ぉ椤甸潰 + if (scene.chatbotId === 'SCPanoramaInsight') { + window.location.href = `/supply-chain-chat?key=app-6IZEwVNGfHrlLFlgLauLHtHo`; + } else { + window.location.href = `/ai-scene/chat?chatbotId=${scene.chatbotId}`; + } }; + + // 瑙f瀽鍦烘櫙鑳屾櫙鍐呭 + const parseBackground = (background: string): { simple: string } | { intro: string; sections: Array<{ title: string; items: string[] }> } | null => { + if (!background) return null; + + // 妫�鏌ユ槸鍚﹀寘鍚粨鏋勫寲鍐呭锛堝渚涘簲閾惧叏鏅礊瀵熺殑鏍煎紡锛� + if (background.includes('**') && background.includes('锛�')) { + const sections = background.split('\n\n').filter(section => section.trim()); + const intro = sections[0]; + const detailSections = sections.slice(1); + + return { + intro, + sections: detailSections.map(section => { + const lines = section.split('\n'); + const title = lines[0].replace(/\*\*/g, '').replace('锛�', ''); + const items = lines.slice(1).filter(line => line.trim().startsWith('-')).map(line => line.replace('- ', '')); + return { title, items }; + }) + }; + } + + return { simple: background }; + }; + + // 瑙f瀽浣跨敤璇存槑鍐呭 + const parseInstructions = (instructions: string): { simple: string } | { intro: string; scenarios: Array<{ title: string; description: string }>; conclusion: string } | null => { + if (!instructions) return null; + + // 妫�鏌ユ槸鍚﹀寘鍚満鏅牸寮� + if (instructions.includes('**鍦烘櫙') && instructions.includes('锛�')) { + const sections = instructions.split('\n\n').filter(section => section.trim()); + const intro = sections[0]; + const scenarios = sections.slice(1, -1).map(section => { + const lines = section.split('\n'); + const title = lines[0].replace(/\*\*/g, '').replace('锛�', ''); + const description = lines[1] || ''; + return { title, description }; + }); + const conclusion = sections[sections.length - 1]; + + return { + intro, + scenarios, + conclusion + }; + } + + return { simple: instructions }; + }; + + const backgroundData = parseBackground(scene.background || ''); + const instructionsData = parseInstructions(scene.instructions || ''); return ( <AnimatePresence> @@ -202,10 +257,36 @@ }} className="bg-[#1A2547] rounded-lg p-6 border border-[#6ADBFF]/10" > - <h3 className="text-lg font-medium text-[#6ADBFF] mb-3">鍦烘櫙鑳屾櫙</h3> - <p className="text-gray-300 leading-relaxed"> - {scene.background} - </p> + <h3 className="text-lg font-medium text-[#6ADBFF] mb-4">鍦烘櫙鑳屾櫙</h3> + {backgroundData && 'simple' in backgroundData ? ( + <p className="text-gray-300 leading-relaxed"> + {backgroundData.simple} + </p> + ) : backgroundData && 'sections' in backgroundData && ( + <div className="space-y-4"> + <p className="text-gray-300 leading-relaxed"> + {backgroundData.intro} + </p> + <div className="grid gap-4"> + {backgroundData.sections.map((section, index) => ( + <div key={index} className="bg-[#0F1629] rounded-lg p-4 border border-[#6ADBFF]/5"> + <h4 className="text-[#FF6A88] font-medium mb-3 flex items-center"> + <div className="w-2 h-2 rounded-full bg-[#FF6A88] mr-2"></div> + {section.title} + </h4> + <ul className="space-y-2"> + {section.items.map((item, itemIndex) => ( + <li key={itemIndex} className="text-gray-300 text-sm flex items-start"> + <div className="w-1 h-1 rounded-full bg-[#6ADBFF]/60 mt-2 mr-3 flex-shrink-0"></div> + <span>{item}</span> + </li> + ))} + </ul> + </div> + ))} + </div> + </div> + )} </motion.div> {/* 浣跨敤璇存槑 */} @@ -219,10 +300,40 @@ }} className="bg-[#1A2547] rounded-lg p-6 border border-[#6ADBFF]/10" > - <h3 className="text-lg font-medium text-[#6ADBFF] mb-3">浣跨敤璇存槑</h3> - <p className="text-gray-300 leading-relaxed"> - {scene.instructions} - </p> + <h3 className="text-lg font-medium text-[#6ADBFF] mb-4">浣跨敤璇存槑</h3> + {instructionsData && 'simple' in instructionsData ? ( + <p className="text-gray-300 leading-relaxed"> + {instructionsData.simple} + </p> + ) : instructionsData && 'scenarios' in instructionsData && ( + <div className="space-y-4"> + <p className="text-gray-300 leading-relaxed"> + {instructionsData.intro} + </p> + <div className="grid gap-3"> + {instructionsData.scenarios.map((scenario, index) => ( + <div key={index} className="bg-[#0F1629] rounded-lg p-4 border border-[#6ADBFF]/5 hover:border-[#6ADBFF]/20 transition-colors duration-300"> + <div className="flex items-center mb-2"> + <div className="w-6 h-6 rounded-full bg-gradient-to-r from-[#6ADBFF] to-[#5E72EB] flex items-center justify-center mr-3"> + <span className="text-white text-xs font-medium">{index + 1}</span> + </div> + <h4 className="text-[#F5A800] font-medium"> + {scenario.title} + </h4> + </div> + <p className="text-gray-300 text-sm ml-9"> + {scenario.description} + </p> + </div> + ))} + </div> + <div className="mt-4 p-4 bg-[#0F1629] rounded-lg border border-[#6ADBFF]/5"> + <p className="text-gray-300 text-sm"> + {instructionsData.conclusion} + </p> + </div> + </div> + )} </motion.div> {/* 鏁版嵁璇存槑鍖哄潡 - 鍙湪鐗瑰畾鍦烘櫙鏄剧ず */} @@ -265,7 +376,8 @@ onClose={() => setShowDataPreview(false)} markdownContent={scene.exampleData} sceneType={scene.chatbotId === 'RhMYLHI1SZNiX4kl' || scene.chatbotId === 'zO9YQDEHdIApG9zC' ? 'chadan' : - scene.chatbotId === 'JELkWpPLHQfRNhEH' ? 'buliao' : undefined} + scene.chatbotId === 'JELkWpPLHQfRNhEH' ? 'buliao' : + scene.chatbotId === 'SCPanoramaInsight' ? 'panorama' : undefined} /> )} </div> -- Gitblit v1.9.3