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,5 +1,6 @@
|
||||
import { create } from "zustand";
|
||||
import { persist } from "zustand/middleware";
|
||||
import { STORE_NAMES } from "./storeNames";
|
||||
|
||||
interface ChenyunStore {
|
||||
// 存储每个场景(place)的已访问展品ID集合
|
||||
@@ -116,7 +117,7 @@ export const useChenyunStore = create<ChenyunStore>()(
|
||||
},
|
||||
}),
|
||||
{
|
||||
name: "chenyun-storage", // localStorage key
|
||||
name: STORE_NAMES.CHENYUN, // localStorage key
|
||||
partialize: (state) => ({
|
||||
visitedExhibits: serializeVisitedExhibits(state.visitedExhibits),
|
||||
isYinyuanSolved: state.isYinyuanSolved,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { create } from "zustand";
|
||||
import { persist } from "zustand/middleware";
|
||||
import { STORE_NAMES } from "./storeNames";
|
||||
|
||||
export interface Clue {
|
||||
id: string; // 格式: "sunzhongshan/reflection/scene1/clue1"
|
||||
@@ -76,7 +77,7 @@ export const useClueStore = create<ClueStore>()(
|
||||
},
|
||||
}),
|
||||
{
|
||||
name: "clue-storage", // localStorage key
|
||||
name: STORE_NAMES.CLUE, // localStorage key
|
||||
}
|
||||
)
|
||||
);
|
||||
@@ -1,5 +1,6 @@
|
||||
import { create } from "zustand";
|
||||
import { persist } from "zustand/middleware";
|
||||
import { STORE_NAMES } from "./storeNames";
|
||||
|
||||
interface HuangyanpeiStore {
|
||||
// 存储每个场景(place)的已访问展品ID集合
|
||||
@@ -154,7 +155,7 @@ export const useHuangyanpeiStore = create<HuangyanpeiStore>()(
|
||||
},
|
||||
}),
|
||||
{
|
||||
name: "huangyanpei-storage", // localStorage key
|
||||
name: STORE_NAMES.HUANGYANPEI, // localStorage key
|
||||
partialize: (state) => ({
|
||||
visitedExhibits: serializeVisitedExhibits(state.visitedExhibits),
|
||||
visitedReflectionCursors: serializeVisitedExhibits(
|
||||
|
||||
@@ -4,3 +4,5 @@ export { useLuxunStore } from "./luxunStore";
|
||||
export { useSunzhongshanStore } from "./sunzhongshanStore";
|
||||
export { useClueStore } from "./clueStore";
|
||||
export { usePuzzleStore } from "./puzzleStore";
|
||||
export { useUserStore } from "./userStore";
|
||||
export { STORE_NAMES } from "./storeNames";
|
||||
@@ -1,5 +1,6 @@
|
||||
import { create } from "zustand";
|
||||
import { persist } from "zustand/middleware";
|
||||
import { STORE_NAMES } from "./storeNames";
|
||||
|
||||
interface LuxunStore {
|
||||
// 存储每个场景(place)的已访问展品ID集合
|
||||
@@ -94,7 +95,7 @@ export const useLuxunStore = create<LuxunStore>()(
|
||||
},
|
||||
}),
|
||||
{
|
||||
name: "luxun-storage",
|
||||
name: STORE_NAMES.LUXUN,
|
||||
partialize: (state) => ({
|
||||
visitedExhibits: serializeVisitedExhibits(state.visitedExhibits),
|
||||
}),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { create } from "zustand";
|
||||
import { persist } from "zustand/middleware";
|
||||
import { STORE_NAMES } from "./storeNames";
|
||||
|
||||
interface PuzzleStore {
|
||||
// 每个故居的已解锁碎片集合,格式:{ residence: Set<pieceId> }
|
||||
@@ -135,7 +136,7 @@ export const usePuzzleStore = create<PuzzleStore>()(
|
||||
},
|
||||
}),
|
||||
{
|
||||
name: "puzzle-storage", // localStorage key
|
||||
name: STORE_NAMES.PUZZLE, // localStorage key
|
||||
partialize: (state) => ({
|
||||
puzzles: serializePuzzles(state.puzzles),
|
||||
}),
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
//lessonId 课时唯一id
|
||||
export const STORE_NAMES = {
|
||||
USER: "user-storage",
|
||||
SUNZHONGSHAN: "sunzhongshan-storage",
|
||||
LUXUN: "luxun-storage",
|
||||
HUANGYANPEI: "huangyanpei-storage",
|
||||
CHENYUN: "chenyun-storage",
|
||||
PUZZLE: "puzzle-storage",
|
||||
CLUE: "clue-storage",
|
||||
} as const;
|
||||
|
||||
//课程的第几课时
|
||||
export const COURSE_ORDER = {
|
||||
COURSE_ORDER_1: 1,
|
||||
COURSE_ORDER_2: 2,
|
||||
COURSE_ORDER_3: 3,
|
||||
COURSE_ORDER_4: 4,
|
||||
COURSE_ORDER_5: 5,
|
||||
COURSE_ORDER_6: 6,
|
||||
COURSE_ORDER_7: 7,
|
||||
} as const;
|
||||
|
||||
export type StoreNameKey = keyof typeof STORE_NAMES;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { create } from "zustand";
|
||||
import { persist } from "zustand/middleware";
|
||||
import { STORE_NAMES } from "./storeNames";
|
||||
|
||||
interface SunzhongshanStore {
|
||||
// 存储每个场景(place)的已访问展品ID集合
|
||||
@@ -118,7 +119,7 @@ export const useSunzhongshanStore = create<SunzhongshanStore>()(
|
||||
},
|
||||
}),
|
||||
{
|
||||
name: "sunzhongshan-storage",
|
||||
name: STORE_NAMES.SUNZHONGSHAN,
|
||||
partialize: (state) => ({
|
||||
visitedExhibits: serializeVisitedExhibits(state.visitedExhibits),
|
||||
reflectionFlags: state.reflectionFlags,
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
import { create } from "zustand";
|
||||
import { persist } from "zustand/middleware";
|
||||
import { STORE_NAMES } from "./storeNames";
|
||||
|
||||
interface UserStore {
|
||||
courseId: string | null;
|
||||
uid: string | null;
|
||||
|
||||
setCourseInfo: (info: { courseId?: string | null; uid?: string | null }) => void;
|
||||
resetCourseInfo: () => void;
|
||||
}
|
||||
|
||||
export const useUserStore = create<UserStore>()(
|
||||
persist(
|
||||
(set) => ({
|
||||
courseId: null,
|
||||
uid: null,
|
||||
|
||||
setCourseInfo: (info) => {
|
||||
set((state) => ({
|
||||
courseId: info.courseId ?? state.courseId,
|
||||
uid: info.uid ?? state.uid,
|
||||
}));
|
||||
},
|
||||
|
||||
resetCourseInfo: () => {
|
||||
set({ courseId: null, uid: null });
|
||||
},
|
||||
}),
|
||||
{
|
||||
name: STORE_NAMES.USER,
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
Reference in new issue
Block a user