123 lines
3.8 KiB
TypeScript
123 lines
3.8 KiB
TypeScript
import { useState } from "react";
|
|
import {
|
|
ExhibitOverlay,
|
|
Title,
|
|
Image,
|
|
Cursor,
|
|
StudyGuideModal,
|
|
} from "@/components";
|
|
import { getBackgroundImage, getStaticImage } from "@/lib/utils";
|
|
import { useNavigate, useParams } from "react-router-dom";
|
|
|
|
const starName = "sunzhongshan";
|
|
|
|
const exhibitSrcMap: Record<1 | 2, string> = {
|
|
1: "sunzhongshan/place4/国事遗嘱",
|
|
2: "sunzhongshan/place4/上海各界人士在外滩码头欢迎孙中山",
|
|
};
|
|
|
|
const SunzhongshanPlace4 = () => {
|
|
const navigate = useNavigate();
|
|
const { moduleName } = useParams<{
|
|
moduleName: string;
|
|
}>();
|
|
|
|
// 学习引导弹窗(进入场景即显示)
|
|
const [showGuideModal, setShowGuideModal] = useState(true);
|
|
const [activeExhibitId, setActiveExhibitId] = useState<1 | 2 | null>(null);
|
|
const [visited, setVisited] = useState<Set<number>>(new Set());
|
|
|
|
const handleOpenExhibit = (index: 1 | 2) => {
|
|
setActiveExhibitId(index);
|
|
};
|
|
|
|
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 (
|
|
<div
|
|
className="w-full h-full bg-cover bg-center bg-no-repeat"
|
|
style={{
|
|
backgroundImage: getBackgroundImage(`sunzhongshan/place4/背景`),
|
|
}}
|
|
>
|
|
<Title
|
|
title="抱病北上·鞠躬尽瘁"
|
|
subtitle={subtitle}
|
|
subtitleClassName={subtitleClassName}
|
|
className="absolute top-10 left-1/2 -translate-x-1/2"
|
|
/>
|
|
|
|
<Image
|
|
className="absolute right-5 top-5"
|
|
src={getStaticImage("components/离开")}
|
|
button
|
|
onClick={() => {
|
|
if (moduleName && starName) {
|
|
navigate(`/${moduleName}/${starName}/place3`);
|
|
}
|
|
}}
|
|
/>
|
|
|
|
<Cursor
|
|
className="absolute right-209 top-128"
|
|
onClick={() => handleOpenExhibit(1)}
|
|
read={visited.has(1)}
|
|
/>
|
|
<Cursor
|
|
className="absolute right-150 top-88"
|
|
onClick={() => handleOpenExhibit(2)}
|
|
read={visited.has(2)}
|
|
/>
|
|
|
|
{completed && (
|
|
<Image
|
|
className="absolute bottom-0 right-140"
|
|
src={getStaticImage("components/place/l-前进")}
|
|
button
|
|
onClick={() => {
|
|
navigate(`/${moduleName}/${starName}`);
|
|
}}
|
|
/>
|
|
)}
|
|
|
|
<ExhibitOverlay
|
|
visible={activeExhibitId !== null}
|
|
src={activeExhibitId ? exhibitSrcMap[activeExhibitId] : ""}
|
|
onClose={() => {
|
|
if (activeExhibitId !== null) {
|
|
setVisited((prev) => {
|
|
const next = new Set(prev);
|
|
next.add(activeExhibitId);
|
|
return next;
|
|
});
|
|
}
|
|
setActiveExhibitId(null);
|
|
}}
|
|
/>
|
|
|
|
{/* 学习引导(进入场景即显示,与 place1 保持一致) */}
|
|
<StudyGuideModal
|
|
visible={showGuideModal}
|
|
onContinue={() => setShowGuideModal(false)}
|
|
ailgn="left"
|
|
>
|
|
1、场景中出现动态光点的展品表示未浏览,可通过点击光点来了解展品背后的故事,通过滚轮可以放大展品,浏览展品后蓝色动态光点会变为已浏览状态;
|
|
{"\n"}
|
|
2、在学习过程中会掉落拼图碎片,拼图碎片会自动收入拼图盒中,拼图盒可以点击查看当前拼图收集情况,点击单个拼图可以回到获得拼图的场景再次学习;
|
|
{"\n"}
|
|
3、所有动态光点的展品全部学习后才能进入下一个场景学习;
|
|
</StudyGuideModal>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default SunzhongshanPlace4;
|