feat: 更新 ESLint 和 Prettier 配置,增强代码质量管理
- 在 .gitignore 中添加 public/audio/* 以忽略音频文件。 - 更新 bun.lock,添加 eslint-config-prettier 和 eslint-plugin-prettier 依赖,确保 ESLint 与 Prettier 的兼容性。 - 修改 eslint.config.ts,整合 Prettier 规则,优化代码风格一致性。 - 在 package.json 中添加 lint:fix 和 format 脚本,简化代码格式化和修复流程。 - 更新 tailwind.config.ts 和其他组件文件,统一代码风格,提升可读性。
This commit is contained in:
1 parent
5d00adc1a5
commit
76c67b492e
216 files changed
+12454
-13976
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { useState } from "react";
|
||||
import { useState } from 'react'
|
||||
import {
|
||||
ExhibitOverlay,
|
||||
Title,
|
||||
@@ -8,24 +8,24 @@ import {
|
||||
GuideSteps,
|
||||
GuideStepsItem,
|
||||
MultipleChoiceQuizPanel,
|
||||
} from "@/components";
|
||||
import { getBackgroundImage, getStaticImage, getPublicPath } 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";
|
||||
} from '@/components'
|
||||
import { getBackgroundImage, getStaticImage, getPublicPath } from '@/lib/utils'
|
||||
import { useNavigate, useParams } from 'react-router-dom'
|
||||
import { useChenyunStore, saveChenyunStore } 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";
|
||||
const starName = 'chenyun'
|
||||
|
||||
// 展品 ID 与资源路径映射
|
||||
const exhibitSrcMap: Record<1 | 2 | 3, string> = {
|
||||
1: "chenyun/place5/场景5展品1",
|
||||
2: "chenyun/place5/场景5展品2",
|
||||
3: "chenyun/place5/场景5展品3",
|
||||
};
|
||||
1: 'chenyun/place5/场景5展品1',
|
||||
2: 'chenyun/place5/场景5展品2',
|
||||
3: 'chenyun/place5/场景5展品3',
|
||||
}
|
||||
// 展品描述映射(目前未使用,后续如需在展品弹窗中显示可恢复)
|
||||
// const exhibitDescriptionMap: Record<1 | 2 | 3, string> = {
|
||||
// 1: "",
|
||||
@@ -33,60 +33,58 @@ const exhibitSrcMap: Record<1 | 2 | 3, string> = {
|
||||
// 3: "",
|
||||
// };
|
||||
const ChenyunPlace5 = () => {
|
||||
const navigate = useNavigate();
|
||||
const navigate = useNavigate()
|
||||
const { moduleName } = useParams<{
|
||||
moduleName: string;
|
||||
}>();
|
||||
moduleName: string
|
||||
}>()
|
||||
|
||||
// 获取碎片动画触发方法
|
||||
const { triggerPuzzleAnimation } = usePuzzleAnimation();
|
||||
const { triggerPuzzleAnimation } = usePuzzleAnimation()
|
||||
|
||||
const [activeExhibitId, setActiveExhibitId] = useState<1 | 2 | 3 | null>(
|
||||
null
|
||||
);
|
||||
const [activeExhibitId, setActiveExhibitId] = useState<1 | 2 | 3 | null>(null)
|
||||
|
||||
// 使用持久化的访问状态
|
||||
const place = "place5";
|
||||
const { markExhibitVisited, getVisitedExhibits } = useChenyunStore();
|
||||
const place = 'place5'
|
||||
const { markExhibitVisited, getVisitedExhibits } = useChenyunStore()
|
||||
|
||||
// 从 store 获取已访问的展品,转换为 Set 用于兼容现有代码
|
||||
const visitedExhibits = getVisitedExhibits(place);
|
||||
const visited = new Set(visitedExhibits);
|
||||
const visitedExhibits = getVisitedExhibits(place)
|
||||
const visited = new Set(visitedExhibits)
|
||||
const { isEnabled } = useCursorController({
|
||||
initialEnabled: [1, 2],
|
||||
dependencies: { 3: [1, 2] },
|
||||
visited,
|
||||
});
|
||||
const [videoVisible3, setVideoVisible3] = useState(false);
|
||||
const [quiz3Visible, setQuiz3Visible] = useState(false);
|
||||
const [successAlert3Visible, setSuccessAlert3Visible] = useState(false);
|
||||
})
|
||||
const [videoVisible3, setVideoVisible3] = useState(false)
|
||||
const [quiz3Visible, setQuiz3Visible] = useState(false)
|
||||
const [successAlert3Visible, setSuccessAlert3Visible] = useState(false)
|
||||
|
||||
// 展品1引导对话
|
||||
const [guideVisible, setGuideVisible] = useState(false);
|
||||
const [guideStep, setGuideStep] = useState(0);
|
||||
const [guideVisible, setGuideVisible] = useState(false)
|
||||
const [guideStep, setGuideStep] = useState(0)
|
||||
|
||||
const handleOpenExhibit = (index: 1 | 2 | 3) => {
|
||||
if (index === 3) {
|
||||
// 展品3:播放视频,不打开展品
|
||||
setVideoVisible3(true);
|
||||
return;
|
||||
setVideoVisible3(true)
|
||||
return
|
||||
}
|
||||
if (index === 2) {
|
||||
setGuideVisible(true);
|
||||
setGuideStep(0);
|
||||
setGuideVisible(true)
|
||||
setGuideStep(0)
|
||||
}
|
||||
setActiveExhibitId(index);
|
||||
};
|
||||
setActiveExhibitId(index)
|
||||
}
|
||||
|
||||
const progressCount = visited.size;
|
||||
const total = 3;
|
||||
const completed = progressCount >= total;
|
||||
const progressCount = visited.size
|
||||
const total = 3
|
||||
const completed = progressCount >= total
|
||||
const subtitle = completed
|
||||
? "探索该阶段相关资料(已完成)"
|
||||
: `探索该阶段相关资料(${progressCount}/${total})`;
|
||||
? '探索该阶段相关资料(已完成)'
|
||||
: `探索该阶段相关资料(${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;
|
||||
? '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"
|
||||
@@ -105,11 +103,11 @@ const ChenyunPlace5 = () => {
|
||||
{/* 返回上一章 */}
|
||||
<Image
|
||||
className="absolute right-5 top-5"
|
||||
src={getStaticImage("components/离开")}
|
||||
src={getStaticImage('components/离开')}
|
||||
button
|
||||
onClick={() => {
|
||||
if (moduleName && starName) {
|
||||
navigate(`/${moduleName}/${starName}/place4`);
|
||||
navigate(`/${moduleName}/${starName}/place4`)
|
||||
}
|
||||
}}
|
||||
/>
|
||||
@@ -141,10 +139,11 @@ const ChenyunPlace5 = () => {
|
||||
{completed && (
|
||||
<Image
|
||||
className="absolute bottom-5 right-20"
|
||||
src={getStaticImage("chenyun/place5/继续前进4")}
|
||||
src={getStaticImage('chenyun/place5/继续前进4')}
|
||||
button
|
||||
onClick={() => {
|
||||
navigate(`/${moduleName}/${starName}/place6`);
|
||||
saveChenyunStore()
|
||||
navigate(`/${moduleName}/${starName}/place6`)
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
@@ -161,13 +160,13 @@ const ChenyunPlace5 = () => {
|
||||
>
|
||||
<GuideStepsItem
|
||||
speaker="student"
|
||||
audioSrc={getPublicPath("audio/chenyun/mp3_chenyun_15.mp3")}
|
||||
audioSrc={getPublicPath('audio/chenyun/mp3_chenyun_15.mp3')}
|
||||
>
|
||||
小沪,延安时期因为国民党的封锁,陕甘宁边区经济困难。陈云转战陕甘宁边区主持财经工作,他一定遇到了很多经济难题吧。
|
||||
</GuideStepsItem>
|
||||
<GuideStepsItem
|
||||
speaker="guide"
|
||||
audioSrc={getPublicPath("audio/chenyun/mp3_chenyun_16.mp3")}
|
||||
audioSrc={getPublicPath('audio/chenyun/mp3_chenyun_16.mp3')}
|
||||
>
|
||||
1944年新春伊始,陈云开始担任西北财经办事处副主任,工作转到财经方面,这是陈云以主要精力从事领导经济工作的开始。当时,陕甘宁边区在国民党严密封锁下,财经状况严峻,边区物价猛涨,老百姓日常生活必需的布匹和粮食十分缺乏。
|
||||
</GuideStepsItem>
|
||||
@@ -179,14 +178,14 @@ const ChenyunPlace5 = () => {
|
||||
{/* 展品3视频播放(全屏) */}
|
||||
{videoVisible3 && (
|
||||
<Video
|
||||
src={getPublicPath("video/chenyun/chenyun_07.mp4")}
|
||||
src={getPublicPath('video/chenyun/chenyun_07.mp4')}
|
||||
className="w-full h-full"
|
||||
autoPlay
|
||||
playsInline
|
||||
showSkipButton
|
||||
onEnded={() => {
|
||||
setVideoVisible3(false);
|
||||
setQuiz3Visible(true);
|
||||
setVideoVisible3(false)
|
||||
setQuiz3Visible(true)
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
@@ -198,31 +197,29 @@ const ChenyunPlace5 = () => {
|
||||
visible={quiz3Visible}
|
||||
title="【多选】陈云主持陕甘宁边区财经工作期间,提出的解决当时经济困难的应对之策包括:"
|
||||
options={[
|
||||
{ value: "A", label: "A.实行贸易统一" },
|
||||
{ value: 'A', label: 'A.实行贸易统一' },
|
||||
{
|
||||
value: "B",
|
||||
label: "B.事先准确估计情况,预测市场商情,以争取主动",
|
||||
value: 'B',
|
||||
label: 'B.事先准确估计情况,预测市场商情,以争取主动',
|
||||
},
|
||||
{
|
||||
value: "C",
|
||||
label:
|
||||
"C.不断总结封锁状态下对外贸易的经验,摸索实现等价交换的途径",
|
||||
value: 'C',
|
||||
label: 'C.不断总结封锁状态下对外贸易的经验,摸索实现等价交换的途径',
|
||||
},
|
||||
{
|
||||
value: "D",
|
||||
label:
|
||||
"D.贸易公司对边区内部贸易也要采取市场上做生意的办法",
|
||||
value: 'D',
|
||||
label: 'D.贸易公司对边区内部贸易也要采取市场上做生意的办法',
|
||||
},
|
||||
{ value: "E", label: "E.做贸易工作的干部要精通业务" },
|
||||
{ value: 'E', label: 'E.做贸易工作的干部要精通业务' },
|
||||
]}
|
||||
correctAnswer={["A", "B", "C", "D", "E"]}
|
||||
correctAnswer={['A', 'B', 'C', 'D', 'E']}
|
||||
minSelections={1}
|
||||
maxSelections={5}
|
||||
errorMessage="你的选择还不够全面哦~请你再想想吧!"
|
||||
onSubmit={(_values, isCorrect) => {
|
||||
if (isCorrect) {
|
||||
setQuiz3Visible(false);
|
||||
setSuccessAlert3Visible(true);
|
||||
setQuiz3Visible(false)
|
||||
setSuccessAlert3Visible(true)
|
||||
}
|
||||
}}
|
||||
zIndex={10000}
|
||||
@@ -231,9 +228,9 @@ const ChenyunPlace5 = () => {
|
||||
<SuccessAlert
|
||||
visible={successAlert3Visible}
|
||||
onContinue={() => {
|
||||
setSuccessAlert3Visible(false);
|
||||
markExhibitVisited(place, 3);
|
||||
triggerPuzzleAnimation(8);
|
||||
setSuccessAlert3Visible(false)
|
||||
markExhibitVisited(place, 3)
|
||||
triggerPuzzleAnimation(8)
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
@@ -242,25 +239,25 @@ const ChenyunPlace5 = () => {
|
||||
{/* 遮罩层 */}
|
||||
<ExhibitOverlay
|
||||
visible={activeExhibitId !== null}
|
||||
src={activeExhibitId ? exhibitSrcMap[activeExhibitId] : ""}
|
||||
src={activeExhibitId ? exhibitSrcMap[activeExhibitId] : ''}
|
||||
// description={
|
||||
// activeExhibitId ? exhibitDescriptionMap[activeExhibitId] : undefined
|
||||
// }
|
||||
autoPlayDescription={activeExhibitId === 2}
|
||||
onOpen={() => {
|
||||
if (activeExhibitId === 2) {
|
||||
triggerPuzzleAnimation(7);
|
||||
triggerPuzzleAnimation(7)
|
||||
}
|
||||
}}
|
||||
onClose={() => {
|
||||
if (activeExhibitId !== null) {
|
||||
markExhibitVisited(place, activeExhibitId);
|
||||
markExhibitVisited(place, activeExhibitId)
|
||||
}
|
||||
setActiveExhibitId(null);
|
||||
setActiveExhibitId(null)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
)
|
||||
}
|
||||
|
||||
export default ChenyunPlace5;
|
||||
export default ChenyunPlace5
|
||||
Reference in new issue
Block a user