import { ExhibitOverlay, GuideSteps, GuideStepsItem, Image, Title, Overlay, StudyGuideModal, } from '@/components' import { useNavigate, useParams } from 'react-router-dom' import { getBackgroundImage, getPublicPath, getStaticImage } from '@/lib/utils' import { useState, useEffect } from 'react' import Cursor from '@/components/cursor' import { usePuzzleAnimation } from '@/contexts/PuzzleAnimationContext' import { useChenyunStore, saveChenyunStore } from '@/store/chenyunStore' import { useCursorController } from '@/hooks/useCursorController' // starName 固定为 chenyun const starName = 'chenyun' // 展品 ID 与资源路径映射,ID 用来做唯一标识 const exhibitSrcMap: Record<1 | 2, string> = { 1: 'chenyun/place1/场景1展品1', 2: 'chenyun/place1/场景1展品2', // 3: "chenyun/place1/场景1展品3", // 4: "chenyun/place1/场景1展品4", } const ChenyunPlace1 = () => { const navigate = useNavigate() const { moduleName } = useParams<{ moduleName: string }>() // 获取碎片动画触发方法 const { triggerPuzzleAnimation } = usePuzzleAnimation() // 学习引导弹窗 const [showGuideModal, setShowGuideModal] = useState(true) // 对话结束后的学习引导弹窗 const [showAfterDialogGuide, setShowAfterDialogGuide] = useState(false) const [afterDialogGuideShown, setAfterDialogGuideShown] = useState(false) // 学习说明对话框显示状态 const [showIntroDialog, setShowIntroDialog] = useState(false) // 引导对话显示状态 const [visible, setVisible] = useState(false) // 当前激活的展品 ID(只存 ID,不直接存路径,便于作为唯一标识) const [activeExhibitId, setActiveExhibitId] = useState<1 | 2 | null>(null) // 使用持久化的访问状态 const place = 'place1' const { markExhibitVisited, getVisitedExhibits, setLastVisitedPlace } = useChenyunStore() useEffect(() => { setLastVisitedPlace(place) }, [setLastVisitedPlace]) // 从 store 获取已访问的展品,转换为 Set 用于兼容现有代码 const visitedExhibits = getVisitedExhibits(place) const visited = new Set(visitedExhibits) // Cursor 控制器:使用依赖映射实现自动解锁 // cursor 1 初始启用,cursor 2 依赖展品1(当展品1被访问后自动解锁) const { isEnabled } = useCursorController({ initialEnabled: [1], dependencies: { 2: [1], // cursor 2 依赖展品 1,当展品1被访问后自动解锁 }, visited, // 传入数组,而不是 Set }) const handleOpenExhibit = (index: 1 | 2) => { setActiveExhibitId(index) // ExhibitOverlay 打开时会自动通过 onOpen 通知 ResidenceLayout 执行动画 } const handleStartLearning = () => { setShowIntroDialog(false) setVisible(true) } const progressCount = visited.size const total = 2 const completed = progressCount >= total const subtitle = completed ? '探索陈云纪念馆老宅堂屋(已完成)' : `探索陈云纪念馆老宅堂屋(${progressCount}/${total})` const subtitleClassName = completed ? 'text-[#fff998] [text-shadow:_0_8px_8px_rgba(0,0,0,0.35),_0_0_16px_rgba(0,0,0,0.25)]' : undefined return (
同学你好,欢迎来到走进故居-对话学习模块!
进入陈云故居场景后,我们将通过参观陈云故居和陈云纪念馆的形式,带你游览陈云同志经历的7个阶段:
{feature}