feat: 清理无用的 MacOS 文件和更新组件,提升代码整洁性
- 删除多个无用的 MacOS 生成文件,减少项目冗余。 - 在 layout 组件中添加 ScaledPortal 和相关类型,增强组件功能。 - 更新 puzzleData 中的学校名称,确保信息准确性。 - 调整 internalization 组件中的提示文本,提升用户体验。 - 在多个场景中引入新的选择题和成功提示,增强学习互动性。
This commit is contained in:
1 parent
a365964f54
commit
45dd648d21
60 files changed
+558
-63
No files matched your search
@@ -6,12 +6,15 @@ import {
|
||||
Cursor,
|
||||
GuideSteps,
|
||||
GuideStepsItem,
|
||||
MultipleChoiceQuizPanel,
|
||||
} from "@/components";
|
||||
import { getBackgroundImage, getPublicPath, getStaticImage } from "@/lib/utils";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import { useChenyunStore } from "@/store/chenyunStore";
|
||||
import { usePuzzleAnimation } from "@/contexts/PuzzleAnimationContext";
|
||||
import { useCursorController } from "@/hooks/useCursorController";
|
||||
import SuccessAlert from "@/components/layout/alert/success-alert";
|
||||
import ScaledPortal from "@/components/layout/ScaledPortal";
|
||||
|
||||
// starName 固定为 chenyun
|
||||
const starName = "chenyun";
|
||||
@@ -34,8 +37,7 @@ const ChenyunPlace4 = () => {
|
||||
|
||||
// 使用持久化的访问状态
|
||||
const place = "place4";
|
||||
const { isExhibitVisited, markExhibitVisited, getVisitedExhibits } =
|
||||
useChenyunStore();
|
||||
const { markExhibitVisited, getVisitedExhibits } = useChenyunStore();
|
||||
|
||||
// 从 store 获取已访问的展品,转换为 Set 用于兼容现有代码
|
||||
const visitedExhibits = getVisitedExhibits(place);
|
||||
@@ -52,6 +54,10 @@ const ChenyunPlace4 = () => {
|
||||
const [guideVisible2, setGuideVisible2] = useState(false);
|
||||
const [guideStep2, setGuideStep2] = useState(0);
|
||||
|
||||
// 展品2关闭后的题目状态(多选)
|
||||
const [quiz2Visible, setQuiz2Visible] = useState(false);
|
||||
const [successAlert2Visible, setSuccessAlert2Visible] = useState(false);
|
||||
|
||||
const handleOpenExhibit = (index: 1 | 2) => {
|
||||
if (index === 1) {
|
||||
// 展品1:点击时同时打开展品和引导对话
|
||||
@@ -148,6 +154,14 @@ const ChenyunPlace4 = () => {
|
||||
}
|
||||
}}
|
||||
onClose={() => {
|
||||
// 展品2:关闭后先进入答题,答对后再标记已读
|
||||
if (activeExhibitId === 2) {
|
||||
setActiveExhibitId(null);
|
||||
setQuiz2Visible(true);
|
||||
return;
|
||||
}
|
||||
|
||||
// 其他展品:关闭即标记已读
|
||||
if (activeExhibitId !== null) {
|
||||
markExhibitVisited(place, activeExhibitId);
|
||||
}
|
||||
@@ -155,6 +169,62 @@ const ChenyunPlace4 = () => {
|
||||
}}
|
||||
/>
|
||||
|
||||
{/* 展品2的题目 + 成功提示(使用 ScaledPortal 保证层级与缩放) */}
|
||||
<ScaledPortal enabled={quiz2Visible || successAlert2Visible} zIndex={10050}>
|
||||
<>
|
||||
<MultipleChoiceQuizPanel
|
||||
visible={quiz2Visible}
|
||||
title="【多选】中央苏区时期,陈云开展经济工作的主要做法包括:"
|
||||
options={[
|
||||
{
|
||||
value: "A",
|
||||
label:
|
||||
"A.从实际出发,实事求是地制定符合企业发展需求的劳动政策",
|
||||
},
|
||||
{
|
||||
value: "B",
|
||||
label:
|
||||
"B.提议建立合作社,吸收失业工人并增强企业管理的民主性",
|
||||
},
|
||||
{
|
||||
value: "C",
|
||||
label: "C.照搬“左”倾经济政策,严格推行统一的劳动标准",
|
||||
},
|
||||
{
|
||||
value: "D",
|
||||
label: "D.审查企业、作坊的实际承受能力,避免政策脱离实际",
|
||||
},
|
||||
]}
|
||||
correctAnswer={["A", "B", "D"]}
|
||||
minSelections={1}
|
||||
maxSelections={4}
|
||||
errorMessage={(selectedValues) => {
|
||||
// 选了 C:给出截图中的专属提示
|
||||
if (selectedValues.includes("C")) {
|
||||
return "陈云反对“左”倾错误。请你再想想吧!";
|
||||
}
|
||||
// 没选 C 但仍不正确:通常是“选不全”
|
||||
return "你的选择还不够全面哦~请你再想想吧!";
|
||||
}}
|
||||
onSubmit={(_values, isCorrect) => {
|
||||
if (isCorrect) {
|
||||
setQuiz2Visible(false);
|
||||
setSuccessAlert2Visible(true);
|
||||
}
|
||||
}}
|
||||
zIndex={10000}
|
||||
/>
|
||||
|
||||
<SuccessAlert
|
||||
visible={successAlert2Visible}
|
||||
onContinue={() => {
|
||||
setSuccessAlert2Visible(false);
|
||||
markExhibitVisited(place, 2);
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
</ScaledPortal>
|
||||
|
||||
{/* 展品1的引导对话 */}
|
||||
<GuideSteps
|
||||
visible={guideVisible}
|
||||
|
||||
Reference in new issue
Block a user