feat: 更新包管理器为 bun,优化项目配置和资源管理
- 将包管理器从 pnpm 更改为 bun,提升依赖管理效率。 - 在 index.html 中引入 jQuery 和 videoajax.js,增强页面功能。 - 删除 pnpm-lock.yaml 文件,清理不必要的锁定文件。 - 在多个组件中优化状态管理和访问逻辑,提升用户体验。 - 更新多个页面和组件以支持新的状态管理方式,确保数据一致性。
This commit is contained in:
1 parent
ac5a2159a1
commit
7bbeb10e57
33 files changed
+2291
-4531
No files matched your search
@@ -1,6 +1,23 @@
|
||||
import { useEffect } from "react";
|
||||
import { getBackgroundImage, getStaticImage } from "@/lib/utils";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import { Image } from "@/components";
|
||||
import { getUserDefine } from "@/lib/utils/api-common";
|
||||
import { useChenyunStore } from "@/store/chenyunStore";
|
||||
|
||||
const CHENYUN_LESSON_ID = "chenyunStore";
|
||||
const CHENYUN_KEY = 1;
|
||||
|
||||
const deserializeVisitedExhibits = (
|
||||
data: Record<string, number[]> | undefined
|
||||
): Record<string, Set<number>> => {
|
||||
if (!data || typeof data !== "object") return {};
|
||||
const visitedExhibits: Record<string, Set<number>> = {};
|
||||
for (const [place, exhibits] of Object.entries(data)) {
|
||||
visitedExhibits[place] = new Set(Array.isArray(exhibits) ? exhibits : []);
|
||||
}
|
||||
return visitedExhibits;
|
||||
};
|
||||
|
||||
const Chenyun = () => {
|
||||
const navigate = useNavigate();
|
||||
@@ -11,6 +28,35 @@ const Chenyun = () => {
|
||||
// starName 固定为 chenyun
|
||||
const starName = "chenyun";
|
||||
|
||||
useEffect(() => {
|
||||
try {
|
||||
const raw = getUserDefine(CHENYUN_LESSON_ID, CHENYUN_KEY);
|
||||
console.log(raw)
|
||||
if (!raw) return;
|
||||
|
||||
const data = JSON.parse(raw) as {
|
||||
visitedExhibits?: Record<string, number[]>;
|
||||
isYinyuanSolved?: boolean;
|
||||
isMimianSolved?: boolean;
|
||||
};
|
||||
|
||||
useChenyunStore.setState((prev) => ({
|
||||
...prev,
|
||||
visitedExhibits: deserializeVisitedExhibits(data.visitedExhibits),
|
||||
isYinyuanSolved:
|
||||
data.isYinyuanSolved !== undefined
|
||||
? data.isYinyuanSolved
|
||||
: prev.isYinyuanSolved,
|
||||
isMimianSolved:
|
||||
data.isMimianSolved !== undefined
|
||||
? data.isMimianSolved
|
||||
: prev.isMimianSolved,
|
||||
}));
|
||||
} catch (error) {
|
||||
console.error("Failed to load Chenyun store", error);
|
||||
}
|
||||
}, []);
|
||||
|
||||
if (!moduleName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user