feat:init

This commit is contained in:
zhongyidian committed 2025-12-29 19:19:10 +08:00
1 parent 53d0eeac6b
commit ae0c050010
494 files changed
+17701 -2318

No files matched your search

+135
View File
@@ -0,0 +1,135 @@
import {
ExhibitOverlay,
GuideSteps,
GuideStepsItem,
Image,
Title,
Cursor,
} from "@/components";
import { useNavigate, useParams } from "react-router-dom";
import { getBackgroundImage, getStaticImage } from "@/lib/utils";
import { useState } from "react";
// starName 固定为 luxun
const starName = "luxun";
// 展品 ID 与资源路径映射,ID 用来做唯一标识
const exhibitSrcMap: Record<1 | 2, string> = {
1: "luxun/place1/展品1",
2: "luxun/place1/展品2",
};
const LuxunPlace1 = () => {
const navigate = useNavigate();
const { moduleName } = useParams<{
moduleName: string;
}>();
// 引导对话显示状态
const [visible, setVisible] = useState(true);
// 当前激活的展品 ID(只存 ID,不直接存路径,便于作为唯一标识)
const [activeExhibitId, setActiveExhibitId] = useState<1 | 2 | null>(null);
// 已浏览展品的 ID 集合
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(`luxun/place1/背景`),
}}
>
{/* 标题 */}
<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}/home`);
}
}}
/>
{/* 展品1 */}
<Cursor
className="absolute left-[calc(50%-48px)] top-80"
onClick={() => handleOpenExhibit(1)}
read={visited.has(1)}
/>
{/* 展品2 */}
<Cursor
className="absolute left-[calc(50%)] bottom-60"
onClick={() => handleOpenExhibit(2)}
read={visited.has(2)}
/>
{/* 继续前进 - 仅在完成所有展品后显示 */}
{completed && (
<Image
className="absolute bottom-0 left-130"
src={getStaticImage("luxun/place1/前进")}
button
onClick={() => {
navigate(`/${moduleName}/${starName}/place2`);
}}
/>
)}
{/* 遮罩层 */}
<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);
}}
/>
{/* 引导 */}
<GuideSteps
visible={visible}
onVisibleChange={setVisible}
showMask={true}
highlightSelectors={[]}
>
<GuideStepsItem speaker="guide">
同学你好,欢迎来到走进故居-对话学习模块!
进入鲁迅故居纪念馆后,我们一起来了解鲁迅先生的思想历程和文学成就。
</GuideStepsItem>
<GuideStepsItem speaker="guide">
在这个场景中,我们将探索鲁迅故居一楼客厅,了解风雨前夕的思想淬炼。
</GuideStepsItem>
</GuideSteps>
</div>
);
};
export default LuxunPlace1;
+115
View File
@@ -0,0 +1,115 @@
import { ExhibitOverlay, Image, Title, Cursor } from "@/components";
import { useNavigate, useParams } from "react-router-dom";
import { getBackgroundImage, getStaticImage } from "@/lib/utils";
import { useState } from "react";
// starName 固定为 luxun
const starName = "luxun";
// 展品 ID 与资源路径映射
const exhibitSrcMap: Record<1 | 2 | 3, string> = {
1: "luxun/place2/展品3",
2: "luxun/place2/展品4",
3: "luxun/place2/展品5",
};
const LuxunPlace2 = () => {
const navigate = useNavigate();
const { moduleName } = useParams<{
moduleName: string;
}>();
const [activeExhibitId, setActiveExhibitId] = useState<1 | 2 | 3 | null>(
null
);
const [visited, setVisited] = useState<Set<number>>(new Set());
const handleOpenExhibit = (index: 1 | 2 | 3) => {
setActiveExhibitId(index);
};
const progressCount = visited.size;
const total = 3;
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(`luxun/place2/背景`),
}}
>
<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}/place1`);
}
}}
/>
{/* 展品 */}
<Cursor
className="absolute right-218 bottom-104"
size={0.4}
onClick={() => handleOpenExhibit(1)}
read={visited.has(1)}
/>
<Cursor
className="absolute right-225 bottom-95"
size={0.4}
onClick={() => handleOpenExhibit(2)}
read={visited.has(2)}
/>
<Cursor
className="absolute right-232 bottom-84"
size={0.4}
onClick={() => handleOpenExhibit(3)}
read={visited.has(3)}
/>
{completed && (
<Image
className="absolute bottom-10 left-42"
src={getStaticImage("luxun/place2/前进")}
button
onClick={() => {
navigate(`/${moduleName}/${starName}/place3`);
}}
/>
)}
<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);
}}
/>
</div>
);
};
export default LuxunPlace2;
+115
View File
@@ -0,0 +1,115 @@
import { ExhibitOverlay, Image, Title, Cursor } from "@/components";
import { useNavigate, useParams } from "react-router-dom";
import { getBackgroundImage, getStaticImage } from "@/lib/utils";
import { useState } from "react";
// starName 固定为 luxun
const starName = "luxun";
// 展品 ID 与资源路径映射
const exhibitSrcMap: Record<1 | 2 | 3, string> = {
1: "luxun/place3/展品8",
2: "luxun/place3/展品7",
3: "luxun/place3/展品6",
};
const LuxunPlace3 = () => {
const navigate = useNavigate();
const { moduleName } = useParams<{
moduleName: string;
}>();
const [activeExhibitId, setActiveExhibitId] = useState<1 | 2 | 3 | null>(
null
);
const [visited, setVisited] = useState<Set<number>>(new Set());
const handleOpenExhibit = (index: 1 | 2 | 3) => {
setActiveExhibitId(index);
};
const progressCount = visited.size;
const total = 3;
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(`luxun/place3/背景`),
}}
>
<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}/place2`);
}
}}
/>
{/* 展品 */}
<Cursor
className="absolute left-90 bottom-140"
onClick={() => handleOpenExhibit(1)}
size={0.4}
read={visited.has(1)}
/>
<Cursor
className="absolute right-225 bottom-120"
onClick={() => handleOpenExhibit(2)}
size={0.4}
read={visited.has(2)}
/>
<Cursor
className="absolute right-214 bottom-123"
onClick={() => handleOpenExhibit(3)}
size={0.4}
read={visited.has(3)}
/>
{completed && (
<Image
className="absolute bottom-25 right-[calc(50%-270px)]"
src={getStaticImage("luxun/place3/前进")}
button
onClick={() => {
navigate(`/${moduleName}/${starName}/place4`);
}}
/>
)}
<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);
}}
/>
</div>
);
};
export default LuxunPlace3;
+106
View File
@@ -0,0 +1,106 @@
import { ExhibitOverlay, Image, Title, Cursor } from "@/components";
import { useNavigate, useParams } from "react-router-dom";
import { getBackgroundImage, getStaticImage } from "@/lib/utils";
import { useState } from "react";
// starName 固定为 luxun
const starName = "luxun";
// 展品 ID 与资源路径映射
const exhibitSrcMap: Record<1 | 2, string> = {
1: "luxun/place4/展品9_t",
2: "luxun/place4/展品9_b",
};
const LuxunPlace4 = () => {
const navigate = useNavigate();
const { moduleName } = useParams<{
moduleName: string;
}>();
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(`luxun/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 left-170 bottom-115"
size={0.4}
onClick={() => handleOpenExhibit(1)}
read={visited.has(1)}
/>
<Cursor
className="absolute left-183 bottom-115"
size={0.4}
onClick={() => handleOpenExhibit(2)}
read={visited.has(2)}
/>
{completed && (
<Image
className="absolute bottom-0 right-120"
src={getStaticImage("luxun/place4/前进")}
button
onClick={() => {
navigate(`/${moduleName}/${starName}/place5`);
}}
/>
)}
<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);
}}
/>
</div>
);
};
export default LuxunPlace4;
+112
View File
@@ -0,0 +1,112 @@
import { ExhibitOverlay, Image, Title, Cursor } from "@/components";
import { useNavigate, useParams } from "react-router-dom";
import { getBackgroundImage, getStaticImage } from "@/lib/utils";
import { useState } from "react";
// starName 固定为 luxun
const starName = "luxun";
// 展品 ID 与资源路径映射
const exhibitSrcMap: Record<1 | 2 | 3, string> = {
1: "luxun/place5/展品11",
2: "luxun/place5/展品12",
3: "luxun/place5/展品13",
};
const LuxunPlace5 = () => {
const navigate = useNavigate();
const { moduleName } = useParams<{
moduleName: string;
}>();
const [activeExhibitId, setActiveExhibitId] = useState<1 | 2 | 3 | null>(
null
);
const [visited, setVisited] = useState<Set<number>>(new Set());
const handleOpenExhibit = (index: 1 | 2 | 3) => {
setActiveExhibitId(index);
};
const progressCount = visited.size;
const total = 3;
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(`luxun/place5/背景`),
}}
>
<Title
title="6平方米的红色庇护所"
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}/place4`);
}
}}
/>
{/* 展品 */}
<Cursor
className="absolute left-167 bottom-30"
onClick={() => handleOpenExhibit(1)}
read={visited.has(1)}
/>
<Cursor
className="absolute left-228 bottom-30"
onClick={() => handleOpenExhibit(2)}
read={visited.has(2)}
/>
<Cursor
className="absolute right-115 bottom-18 z-20"
onClick={() => handleOpenExhibit(3)}
read={visited.has(3)}
/>
{completed && (
<Image
className="absolute bottom-0 right-0"
src={getStaticImage("luxun/place5/离开")}
button
onClick={() => {
navigate(`/${moduleName}/${starName}/home`);
}}
/>
)}
<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);
}}
/>
</div>
);
};
export default LuxunPlace5;