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:
zhongyidian committed 2026-03-05 13:50:47 +08:00
1 parent 5d00adc1a5
commit 76c67b492e
216 files changed
+12454 -13976

No files matched your search

+49 -50
View File
@@ -1,64 +1,63 @@
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";
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 = "hsgrl_Cheny_duihua";
const CHENYUN_KEY = 22;
const CHENYUN_LESSON_ID = 'Cheny_duihua'
const CHENYUN_KEY = 22
const deserializeVisitedExhibits = (
data: Record<string, number[]> | undefined
): Record<string, Set<number>> => {
if (!data || typeof data !== "object") return {};
const visitedExhibits: 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 : []);
visitedExhibits[place] = new Set(Array.isArray(exhibits) ? exhibits : [])
}
return visitedExhibits;
};
return visitedExhibits
}
const Chenyun = () => {
const navigate = useNavigate();
const navigate = useNavigate()
const { moduleName } = useParams<{
moduleName: string;
}>();
moduleName: string
}>()
// starName 固定为 chenyun
const starName = "chenyun";
const starName = 'chenyun'
useEffect(() => {
try {
const raw = getUserDefine(CHENYUN_LESSON_ID, CHENYUN_KEY);
console.log(raw)
if (!raw) return;
;(async () => {
console.log('1233')
try {
const raw = await 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;
};
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);
}
}, []);
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;
return null
}
return (
@@ -70,7 +69,7 @@ const Chenyun = () => {
>
<Image
className="absolute right-37 top-22"
src={getStaticImage("components/革命先驱故居-返回")}
src={getStaticImage('components/革命先驱故居-返回')}
button
onClick={() => navigate(`/entrance/${moduleName}`)}
/>
@@ -79,24 +78,24 @@ const Chenyun = () => {
{/* 对话 */}
<Image
button
src={getStaticImage("star/一-解锁")}
src={getStaticImage('star/一-解锁')}
onClick={() => navigate(`/${moduleName}/${starName}/place1`)}
/>
{/* 体悟 */}
<Image
button
src={getStaticImage("star/二-解锁")}
src={getStaticImage('star/二-解锁')}
onClick={() => navigate(`/${moduleName}/${starName}/reflection`)}
/>
{/* 内化 */}
<Image
button
src={getStaticImage("star/三-解锁")}
src={getStaticImage('star/三-解锁')}
onClick={() => navigate(`/${moduleName}/${starName}/internalization`)}
/>
</div>
</div>
);
};
)
}
export default Chenyun;
export default Chenyun