feat: 添加引导页、视频播放和触摸交互功能

- 新增引导页组件(Guide.tsx)及相关资源
- 添加视频播放功能和相关资源文件
- 实现useTouch自定义hook支持触摸交互
- 添加store状态管理
- 更新多个页面组件(Content, Menu, Publicity)
- 优化图片组件和背景图片组件
- 更新项目依赖
This commit is contained in:
zhongyidian committed 2025-10-31 17:49:13 +08:00
1 parent 4ce7520066
commit 53d0eeac6b
24 files changed
+1390 -84

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
import { create } from "zustand";
import { persist } from "zustand/middleware";
interface FirstVisitState {
hasSeenIntro: boolean;
timestamp: number | null; // 存储时间戳
setHasSeenIntro: () => void;
isExpired: () => boolean; // 检查是否过期
reset: () => void; // 重置状态
}
// 存储有效期(毫秒),默认5分钟
const STORAGE_EXPIRY_TIME = 5 * 60 * 1000;
export const useFirstVisitStore = create<FirstVisitState>()(
persist(
(set, get) => ({
hasSeenIntro: false,
timestamp: null,
setHasSeenIntro: () => {
set({ hasSeenIntro: true, timestamp: Date.now() });
},
isExpired: () => {
const state = get();
if (!state.timestamp) {
return false;
}
const now = Date.now();
return now - state.timestamp > STORAGE_EXPIRY_TIME;
},
reset: () => {
set({ hasSeenIntro: false, timestamp: null });
},
}),
{
name: "first-visit-storage", // 存储到localStorage的key
}
)
);
+1
View File
@@ -0,0 +1 @@
export * from "./firstVisitStore";