diff --git a/biome.json b/biome.json new file mode 100644 index 0000000..832be5f --- /dev/null +++ b/biome.json @@ -0,0 +1,28 @@ +{ + "formatter": { + "enabled": true, + "formatWithErrors": false, + "ignore": [], + "attributePosition": "auto", + "indentStyle": "tab", + "indentWidth": 2, + "lineEnding": "lf", + "lineWidth": 80 + }, + "javascript": { + "formatter": { + "arrowParentheses":"always", + "bracketSameLine": false, + "bracketSpacing": true, + "jsxQuoteStyle": "double", + "quoteProperties": "asNeeded", + "semicolons": "always", + "trailingCommas": "all" + } + }, + "json": { + "formatter": { + "trailingCommas": "none" + } + } +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index b5ef6fd..1ff953b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ "react-dom": "^19.1.0" }, "devDependencies": { + "@biomejs/biome": "1.9.4", "@rsbuild/core": "^1.3.1", "@rsbuild/plugin-react": "^1.1.1", "@tailwindcss/postcss": "^4.1.4", @@ -35,6 +36,161 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/@biomejs/biome": { + "version": "1.9.4", + "resolved": "https://registry.npmmirror.com/@biomejs/biome/-/biome-1.9.4.tgz", + "integrity": "sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog==", + "dev": true, + "hasInstallScript": true, + "bin": { + "biome": "bin/biome" + }, + "engines": { + "node": ">=14.21.3" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/biome" + }, + "optionalDependencies": { + "@biomejs/cli-darwin-arm64": "1.9.4", + "@biomejs/cli-darwin-x64": "1.9.4", + "@biomejs/cli-linux-arm64": "1.9.4", + "@biomejs/cli-linux-arm64-musl": "1.9.4", + "@biomejs/cli-linux-x64": "1.9.4", + "@biomejs/cli-linux-x64-musl": "1.9.4", + "@biomejs/cli-win32-arm64": "1.9.4", + "@biomejs/cli-win32-x64": "1.9.4" + } + }, + "node_modules/@biomejs/cli-darwin-arm64": { + "version": "1.9.4", + "resolved": "https://registry.npmmirror.com/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.9.4.tgz", + "integrity": "sha512-bFBsPWrNvkdKrNCYeAp+xo2HecOGPAy9WyNyB/jKnnedgzl4W4Hb9ZMzYNbf8dMCGmUdSavlYHiR01QaYR58cw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-darwin-x64": { + "version": "1.9.4", + "resolved": "https://registry.npmmirror.com/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.9.4.tgz", + "integrity": "sha512-ngYBh/+bEedqkSevPVhLP4QfVPCpb+4BBe2p7Xs32dBgs7rh9nY2AIYUL6BgLw1JVXV8GlpKmb/hNiuIxfPfZg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-arm64": { + "version": "1.9.4", + "resolved": "https://registry.npmmirror.com/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.9.4.tgz", + "integrity": "sha512-fJIW0+LYujdjUgJJuwesP4EjIBl/N/TcOX3IvIHJQNsAqvV2CHIogsmA94BPG6jZATS4Hi+xv4SkBBQSt1N4/g==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-arm64-musl": { + "version": "1.9.4", + "resolved": "https://registry.npmmirror.com/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.9.4.tgz", + "integrity": "sha512-v665Ct9WCRjGa8+kTr0CzApU0+XXtRgwmzIf1SeKSGAv+2scAlW6JR5PMFo6FzqqZ64Po79cKODKf3/AAmECqA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-x64": { + "version": "1.9.4", + "resolved": "https://registry.npmmirror.com/@biomejs/cli-linux-x64/-/cli-linux-x64-1.9.4.tgz", + "integrity": "sha512-lRCJv/Vi3Vlwmbd6K+oQ0KhLHMAysN8lXoCI7XeHlxaajk06u7G+UsFSO01NAs5iYuWKmVZjmiOzJ0OJmGsMwg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-x64-musl": { + "version": "1.9.4", + "resolved": "https://registry.npmmirror.com/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-1.9.4.tgz", + "integrity": "sha512-gEhi/jSBhZ2m6wjV530Yy8+fNqG8PAinM3oV7CyO+6c3CEh16Eizm21uHVsyVBEB6RIM8JHIl6AGYCv6Q6Q9Tg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-win32-arm64": { + "version": "1.9.4", + "resolved": "https://registry.npmmirror.com/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.9.4.tgz", + "integrity": "sha512-tlbhLk+WXZmgwoIKwHIHEBZUwxml7bRJgk0X2sPyNR3S93cdRq6XulAZRQJ17FYGGzWne0fgrXBKpl7l4M87Hg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-win32-x64": { + "version": "1.9.4", + "resolved": "https://registry.npmmirror.com/@biomejs/cli-win32-x64/-/cli-win32-x64-1.9.4.tgz", + "integrity": "sha512-8Y5wMhVIPaWe6jw2H+KlEm4wP/f7EW3810ZLmDlrEEy5KvBsb9ECEfu/kMWD484ijfQ8+nIi0giMgu9g1UAuuA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=14.21.3" + } + }, "node_modules/@fortawesome/fontawesome-free": { "version": "6.7.2", "resolved": "https://registry.npmmirror.com/@fortawesome/fontawesome-free/-/fontawesome-free-6.7.2.tgz", diff --git a/package.json b/package.json index f510724..749a1b2 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "react-dom": "^19.1.0" }, "devDependencies": { + "@biomejs/biome": "1.9.4", "@rsbuild/core": "^1.3.1", "@rsbuild/plugin-react": "^1.1.1", "@tailwindcss/postcss": "^4.1.4", diff --git a/postcss.config.mjs b/postcss.config.mjs index 2716b7b..a34a3d5 100644 --- a/postcss.config.mjs +++ b/postcss.config.mjs @@ -1,5 +1,5 @@ export default { - plugins: { - '@tailwindcss/postcss': {}, - }, - }; \ No newline at end of file + plugins: { + '@tailwindcss/postcss': {}, + }, +}; diff --git a/src/App.tsx b/src/App.tsx index 13122d5..a4790e1 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,49 +1,51 @@ // The exported code uses Tailwind CSS. Install Tailwind CSS in your dev environment to ensure all styles work. -import React, {useState, useEffect} from "react"; +import React, { useState, useEffect } from "react"; import Navbar from "./components/Navbar"; import Footer from "./components/Footer"; import Home from "./pages/Home"; +import LoginModal from "./components/LoginModal"; const App: React.FC = () => { - const [isMenuOpen, setIsMenuOpen] = useState(false); - const [isLoginModalOpen, setIsLoginModalOpen] = useState(false); - const [currentSlide, setCurrentSlide] = useState(0); - useEffect(() => { - const interval = setInterval(() => { - setCurrentSlide((prev) => (prev === 2 ? 0 : prev + 1)); - }, 5000); - return () => clearInterval(interval); - }, []); + const [isMenuOpen, setIsMenuOpen] = useState(false); + const [isLoginModalOpen, setIsLoginModalOpen] = useState(false); + const [currentSlide, setCurrentSlide] = useState(0); + useEffect(() => { + const interval = setInterval(() => { + setCurrentSlide((prev) => (prev === 2 ? 0 : prev + 1)); + }, 5000); + return () => clearInterval(interval); + }, []); - // 添加 ESC 键关闭功能 - useEffect(() => { - const handleEscKey = (event: KeyboardEvent) => { - if (event.key === 'Escape' && isLoginModalOpen) { - closeLoginModal(); - } - }; + // 添加 ESC 键关闭功能 + useEffect(() => { + const handleEscKey = (event: KeyboardEvent) => { + if (event.key === "Escape" && isLoginModalOpen) { + closeLoginModal(); + } + }; - window.addEventListener('keydown', handleEscKey); - return () => { - window.removeEventListener('keydown', handleEscKey); - }; - }, [isLoginModalOpen]); + window.addEventListener("keydown", handleEscKey); + return () => { + window.removeEventListener("keydown", handleEscKey); + }; + }, [isLoginModalOpen]); - const handleLoginClick = () => { - setIsLoginModalOpen(true); - }; - const closeLoginModal = () => { - setIsLoginModalOpen(false); - }; - - return ( -
- -
- -
-
- ); + const handleLoginClick = () => { + setIsLoginModalOpen(true); + }; + const closeLoginModal = () => { + setIsLoginModalOpen(false); + }; + + return ( +
+ +
+ +
+
+ ); }; export default App; diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx index 167285b..ef9d89d 100644 --- a/src/components/Footer.tsx +++ b/src/components/Footer.tsx @@ -1,116 +1,158 @@ -import React from 'react'; +import React from "react"; const Footer: React.FC = () => { - return ( - - ); + return ( + + ); }; -export default Footer; \ No newline at end of file +export default Footer; diff --git a/src/components/LoginModal.tsx b/src/components/LoginModal.tsx new file mode 100644 index 0000000..0e8cf85 --- /dev/null +++ b/src/components/LoginModal.tsx @@ -0,0 +1,125 @@ +import React from "react"; + +interface LoginModalProps { + isOpen: boolean; + onClose: () => void; +} + +const LoginModal: React.FC = ({ isOpen, onClose }) => { + if (!isOpen) return null; + + return ( +
+
+ + +
+
+ +
+
+
+
+

+ 登录账号 +

+
+
+ + +
+
+ + +
+
+
+ + +
+ +
+ +
+
+
+
+
+
+
+ + 或使用以下方式登录 + +
+
+
+
+ + + +
+
+ + + +
+
+ + + +
+
+
+
+

+ 还没有账号?{" "} + + 立即注册 + +

+
+
+
+
+
+
+
+ ); +}; + +export default LoginModal; \ No newline at end of file diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index bfce590..c22e9c4 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -1,97 +1,133 @@ -import React, { useState } from 'react'; +import React, { useState } from "react"; interface NavbarProps { - onLoginClick: () => void; + onLoginClick: () => void; } const Navbar: React.FC = ({ onLoginClick }) => { - const [isMenuOpen, setIsMenuOpen] = useState(false); + const [isMenuOpen, setIsMenuOpen] = useState(false); - return ( - - ); + return ( + + ); }; -export default Navbar; \ No newline at end of file +export default Navbar; diff --git a/src/pages/Home.tsx b/src/pages/Home.tsx index 3549704..c76c4bd 100644 --- a/src/pages/Home.tsx +++ b/src/pages/Home.tsx @@ -1,665 +1,836 @@ -import React, {useState, useEffect} from 'react'; +import React, { useState, useEffect, useRef } from "react"; const Home: React.FC = () => { - const [currentSlide, setCurrentSlide] = useState(0); + const [currentSlide, setCurrentSlide] = useState(0); + const [isDragging, setIsDragging] = useState(false); + const [startX, setStartX] = useState(0); + const [dragX, setDragX] = useState(0); + const sliderRef = useRef(null); + const dragThreshold = 100; // 拖动阈值,超过这个值才会切换 + const [slideTransition, setSlideTransition] = useState(true); - // 轮播图数据 - const slides = [ - { - id: 1, - image: "https://public.readdy.ai/ai/img_res/524ed52dc79e61a10101d4b2290f77ff.jpg", - title: "暗影崛起", - subtitle: "全新赛季来临", - description: "全新角色平衡调整,暗影刺客获得重做,元素系统全面升级,多项游戏体验优化。立即体验前所未有的战斗体验!", - version: "版本 3.8.5 现已上线" - }, - { - id: 2, - image: "https://public.readdy.ai/ai/img_res/524ed52dc79e61a10101d4b2290f77ff.jpg", - title: "暗影刺客", - subtitle: "全新技能组合", - description: "暗影刺客获得全新技能组合,突进能力和爆发伤害大幅提升,成为战场上的致命杀手。", - version: "新英雄登场" - }, - { - id: 3, - image: "https://public.readdy.ai/ai/img_res/fad8f5cdf974a6cdf13f117039146645.jpg", - title: "元素法师", - subtitle: "控场能力加强", - description: "元素法师的控场能力得到全面加强,新增区域冻结效果,成为团战中的核心控制者。", - version: "平衡性调整" - } - ]; + // 轮播图数据 + const slides = [ + { + id: 1, + image: + "https://public.readdy.ai/ai/img_res/524ed52dc79e61a10101d4b2290f77ff.jpg", + title: "暗影崛起", + subtitle: "全新赛季来临", + description: + "全新角色平衡调整,暗影刺客获得重做,元素系统全面升级,多项游戏体验优化。立即体验前所未有的战斗体验!", + version: "版本 3.8.5 现已上线", + }, + { + id: 2, + image: + "https://public.readdy.ai/ai/img_res/524ed52dc79e61a10101d4b2290f77ff.jpg", + title: "暗影刺客", + subtitle: "全新技能组合", + description: + "暗影刺客获得全新技能组合,突进能力和爆发伤害大幅提升,成为战场上的致命杀手。", + version: "新英雄登场", + }, + { + id: 3, + image: + "https://public.readdy.ai/ai/img_res/fad8f5cdf974a6cdf13f117039146645.jpg", + title: "元素法师", + subtitle: "控场能力加强", + description: + "元素法师的控场能力得到全面加强,新增区域冻结效果,成为团战中的核心控制者。", + version: "平衡性调整", + }, + ]; - useEffect(() => { - const interval = setInterval(() => { - setCurrentSlide((prev) => (prev === slides.length - 1 ? 0 : prev + 1)); - }, 5000); - return () => clearInterval(interval); - }, [slides.length]); + useEffect(() => { + const interval = setInterval(() => { + if (!isDragging) { + handleNextSlide(); + } + }, 5000); + return () => clearInterval(interval); + }, [slides.length, isDragging]); - // 手动切换轮播图 - const goToSlide = (index: number) => { - setCurrentSlide(index); - }; + // 切换到下一张 + const handleNextSlide = () => { + setSlideTransition(true); + setCurrentSlide((prev) => (prev === slides.length - 1 ? 0 : prev + 1)); + }; - // 即将登场的角色数据 - const upcomingCharacters = [ - { - id: 1, - name: "星璇法师", - role: "法师", - image: "", - description: "掌控星辰能量的神秘法师,可以操纵时空进行战斗。", - features: "星辰轨道 / 时空裂隙 / 引力操控", - color: "purple" - }, - { - id: 2, - name: "炎武士", - role: "战士", - image: "", - description: "融合古代武士精神与现代能量技术的战士。", - features: "能量刀刃 / 武士之魂 / 烈焰斩击", - color: "red" - }, - { - id: 3, - name: "生态猎手", - role: "射手", - image: "https://readdy.ai/api/search-image?query=A%20high-tech%20archer%20character%20with%20sleek%20armor%20and%20holographic%20bow%2C%20nature-themed%20accessories%2C%20standing%20in%20a%20dynamic%20pose%20against%20a%20dark%20misty%20background%20with%20green%20energy%20effects%2C%20high-quality%20gaming%20character%20render%2C%20detailed%20futuristic%20design&width=400&height=500&seq=upcoming3&orientation=portrait", - description: "运用生态能量的远程射手,善于控制战场环境。", - features: "自然之力 / 生态屏障 / 藤蔓控制", - color: "green" - } - ]; + // 切换到上一张 + const handlePrevSlide = () => { + setSlideTransition(true); + setCurrentSlide((prev) => (prev === 0 ? slides.length - 1 : prev - 1)); + }; - // 最新更新的角色数据 - const updatedCharacters = [ - { - id: 1, - name: "暗影刺客", - role: "刺客", - image: "https://public.readdy.ai/ai/img_res/2d91abc57bd6b7d125bf2f87ed449c3d.jpg", - description: "暗影刺客获得了全新的技能组合,提升了突进能力和爆发伤害。", - changes: "基础攻击力 +15%,技能冷却时间 -10%" - }, - { - id: 2, - name: "元素法师", - role: "法师", - image: "https://public.readdy.ai/ai/img_res/fad8f5cdf974a6cdf13f117039146645.jpg", - description: "元素法师的控场能力得到加强,新增了区域冻结效果。", - changes: "法术穿透 +8%,控制效果持续时间 +1秒" - }, - { - id: 3, - name: "钢铁守卫", - role: "坦克", - image: "https://public.readdy.ai/ai/img_res/618fff0b876f9d124ad1921db66683e5.jpg", - description: "钢铁守卫现在拥有更强的生存能力和团队保护机制。", - changes: "护甲值 +20%,生命回复速度 +15%" - } - ]; + // 手动切换轮播图 + const goToSlide = (index: number) => { + setSlideTransition(true); + setCurrentSlide(index); + }; - const battleData = [ - { - rank: 1, - character: "暗影刺客", - winRate: "68%", - pickRate: "42%", - banRate: "38%", - }, - { - rank: 2, - character: "元素法师", - winRate: "62%", - pickRate: "38%", - banRate: "25%", - }, - { - rank: 3, - character: "狂战士", - winRate: "65%", - pickRate: "40%", - banRate: "22%", - }, - { - rank: 4, - character: "钢铁守卫", - winRate: "58%", - pickRate: "35%", - banRate: "18%", - }, - { - rank: 5, - character: "神射手", - winRate: "59%", - pickRate: "32%", - banRate: "15%", - }, - ]; - const equipmentBuilds = [ - { - id: 1, - character: "暗影刺客", - avatar: - "https://public.readdy.ai/ai/img_res/5488e233cf11243801c148778a6c1d46.jpg", - items: [ - "暗影匕首", - "刺客护甲", - "速度之靴", - "致命宝石", - "隐形披风", - "破甲短剑", - ], - winRate: "68%", - usageRate: "42%", - tags: ["高爆发", "单体刺杀", "灵活机动"], - }, - { - id: 2, - character: "元素法师", - avatar: - "https://public.readdy.ai/ai/img_res/fc1ca2fe0c579530ebb48af702a00a69.jpg", - items: [ - "法师法杖", - "魔力长袍", - "法术之靴", - "魔法水晶", - "奥术宝珠", - "时间怀表", - ], - winRate: "62%", - usageRate: "38%", - tags: ["范围控制", "高法术伤害", "团战核心"], - }, - { - id: 3, - character: "钢铁守卫", - avatar: - "https://public.readdy.ai/ai/img_res/f2961785fd8feb60a369a8224515c980.jpg", - items: [ - "守护者盾牌", - "重型护甲", - "抵抗之靴", - "生命宝石", - "荆棘背心", - "反伤护符", - ], - winRate: "58%", - usageRate: "35%", - tags: ["高生存", "团队保护", "前排坦克"], - }, - { - id: 4, - character: "狂战士", - avatar: - "https://public.readdy.ai/ai/img_res/09dab9a842b7ba916d91f6ddffed0178.jpg", - items: [ - "狂战斧", - "战士护甲", - "狂暴之靴", - "力量宝石", - "嗜血项链", - "狂怒手套", - ], - winRate: "65%", - usageRate: "40%", - tags: ["高持续伤害", "团战切入", "半肉战士"], - }, - ]; + // 处理轮播图切换 + const handleSlideChange = (dragDistance: number) => { + if (Math.abs(dragDistance) > dragThreshold) { + if (dragDistance > 0) { + // 向右拖动,切换到上一张 + handlePrevSlide(); + } else { + // 向左拖动,切换到下一张 + handleNextSlide(); + } + } + }; - return ( -
- {/* 英雄区 */} -
-
-
- {slides.map((slide, index) => ( -
-
-
- {slide.title} -
-
- ))} -
-
-
-
- - {slides[currentSlide].version} - -
-

- - {slides[currentSlide].title} - - {slides[currentSlide].subtitle} -

-

- {slides[currentSlide].description} -

-
- - -
-
-
- {/* 轮播图指示器 */} -
- {slides.map((_, index) => ( -
-
-
+ // 鼠标按下事件处理 + const handleMouseDown = (e: React.MouseEvent) => { + setIsDragging(true); + setStartX(e.pageX); + setDragX(0); + setSlideTransition(false); + }; - {/* 最新角色更新区 */} -
-
-
- {/* 即将登场 */} -
-
-
-
- - 新英雄预告 - -
-

即将登场

-
- - 查看全部 - - -
-
- {upcomingCharacters.map((character) => ( -
-
-
- {character.role} -
- {character.name} -
-
-
-

{character.name}

- 即将登场 -
-

- {character.description} -

-
-

核心特性

-

{character.features}

-
- -
-
- ))} -
-
+ // 鼠标移动事件处理 + const handleMouseMove = (e: React.MouseEvent) => { + if (!isDragging) return; + e.preventDefault(); + const currentX = e.pageX; + const dragDistance = currentX - startX; + setDragX(dragDistance); + }; - {/* 最新更新 */} -
-
-
-
- - 平衡性调整 - -
-

最新更新

-
- - 查看全部 - - -
-
- {updatedCharacters.map((character) => ( -
-
-
- {character.role} -
- {character.name} -
-
-
-

{character.name}

- 最新更新 -
-

- {character.description} -

-
-

变更数据

-

{character.changes}

-
- -
-
- ))} -
-
-
-
-
+ // 鼠标释放事件处理 + const handleMouseUp = () => { + if (isDragging) { + handleSlideChange(dragX); + setIsDragging(false); + setDragX(0); + } + }; - {/* 热门配装推荐 */} -
-
-
-

热门配装推荐

- - 更多配装 - - -
-
- {equipmentBuilds.map((build) => ( -
-
-
- {build.character} -
-

- {build.character} -

-
- - 胜率: {build.winRate} - - - 使用率: {build.usageRate} - -
-
-
-
-

推荐装备

-
- {build.items.map((item, index) => ( -
-
- -
-
- ))} -
-
-
- {build.tags.map((tag, index) => ( - - {tag} - - ))} -
- -
-
- ))} -
-
-
- {/* 对战数据板块 */} -
-
-
-

实时对战数据

- - 查看完整数据 - - -
-
-
-
-
-

- 角色使用率排行 -

-
- - - - - - - - - - - - {battleData.map((data) => ( - - - - - - - - ))} - -
- 排名 - - 角色 - - 胜率 - - 选取率 - - 禁用率 -
-
- {data.rank} -
-
- {data.character} - - {data.winRate} - - {data.pickRate} - - {data.banRate} -
-
-
-
-
-
-
-
-

- 当前赛季 -

-
- 赛季名称 - 暗影崛起 -
-
- 开始时间 - 2025-03-15 -
-
- 结束时间 - 2025-06-15 -
-
- 剩余时间 - 66 天 -
-
-
-
-
-

- 最新比赛结果 -

-
-
-
- 职业联赛 - 2小时前 -
-
-
- - 龙族战队 - - - 3 - -
- VS -
- 1 - - 风暴战队 - -
-
-
-
-
- 职业联赛 - 5小时前 -
-
-
- - 火焰战队 - - - 3 - -
- VS -
- 2 - - 雷霆战队 - -
-
-
-
-
- 职业联赛 - 昨天 -
-
-
- - 幽灵战队 - - 0 -
- VS -
- - 3 - - - 星辰战队 - -
-
-
-
-
-
-
-
-
-
-
- ); + // 鼠标离开事件处理 + const handleMouseLeave = () => { + if (isDragging) { + handleSlideChange(dragX); + setIsDragging(false); + setDragX(0); + } + }; + + // 触摸开始事件处理 + const handleTouchStart = (e: React.TouchEvent) => { + setIsDragging(true); + setStartX(e.touches[0].pageX); + setDragX(0); + setSlideTransition(false); + }; + + // 触摸移动事件处理 + const handleTouchMove = (e: React.TouchEvent) => { + if (!isDragging) return; + const currentX = e.touches[0].pageX; + const dragDistance = currentX - startX; + setDragX(dragDistance); + }; + + // 触摸结束事件处理 + const handleTouchEnd = () => { + if (isDragging) { + handleSlideChange(dragX); + setIsDragging(false); + setDragX(0); + } + }; + + // 计算当前显示的幻灯片 + const getVisibleSlides = () => { + const normalizedDragX = dragX / dragThreshold; + if (isDragging && Math.abs(normalizedDragX) > 0) { + if (dragX > 0) { + // 向右拖动,显示上一张 + const prevIndex = currentSlide === 0 ? slides.length - 1 : currentSlide - 1; + return [ + { index: prevIndex, opacity: Math.min(normalizedDragX, 1) }, + { index: currentSlide, opacity: Math.max(1 - normalizedDragX, 0) }, + ]; + } else { + // 向左拖动,显示下一张 + const nextIndex = currentSlide === slides.length - 1 ? 0 : currentSlide + 1; + return [ + { index: currentSlide, opacity: Math.max(1 + normalizedDragX, 0) }, + { index: nextIndex, opacity: Math.min(-normalizedDragX, 1) }, + ]; + } + } + return [{ index: currentSlide, opacity: 1 }]; + }; + + // 即将登场的角色数据 + const upcomingCharacters = [ + { + id: 1, + name: "星璇法师", + role: "法师", + image: "", + description: "掌控星辰能量的神秘法师,可以操纵时空进行战斗。", + features: "星辰轨道 / 时空裂隙 / 引力操控", + color: "purple", + }, + { + id: 2, + name: "炎武士", + role: "战士", + image: "", + description: "融合古代武士精神与现代能量技术的战士。", + features: "能量刀刃 / 武士之魂 / 烈焰斩击", + color: "red", + }, + { + id: 3, + name: "生态猎手", + role: "射手", + image: + "https://readdy.ai/api/search-image?query=A%20high-tech%20archer%20character%20with%20sleek%20armor%20and%20holographic%20bow%2C%20nature-themed%20accessories%2C%20standing%20in%20a%20dynamic%20pose%20against%20a%20dark%20misty%20background%20with%20green%20energy%20effects%2C%20high-quality%20gaming%20character%20render%2C%20detailed%20futuristic%20design&width=400&height=500&seq=upcoming3&orientation=portrait", + description: "运用生态能量的远程射手,善于控制战场环境。", + features: "自然之力 / 生态屏障 / 藤蔓控制", + color: "green", + }, + ]; + + // 最新更新的角色数据 + const updatedCharacters = [ + { + id: 1, + name: "暗影刺客", + role: "刺客", + image: + "https://public.readdy.ai/ai/img_res/2d91abc57bd6b7d125bf2f87ed449c3d.jpg", + description: "暗影刺客获得了全新的技能组合,提升了突进能力和爆发伤害。", + changes: "基础攻击力 +15%,技能冷却时间 -10%", + }, + { + id: 2, + name: "元素法师", + role: "法师", + image: + "https://public.readdy.ai/ai/img_res/fad8f5cdf974a6cdf13f117039146645.jpg", + description: "元素法师的控场能力得到加强,新增了区域冻结效果。", + changes: "法术穿透 +8%,控制效果持续时间 +1秒", + }, + { + id: 3, + name: "钢铁守卫", + role: "坦克", + image: + "https://public.readdy.ai/ai/img_res/618fff0b876f9d124ad1921db66683e5.jpg", + description: "钢铁守卫现在拥有更强的生存能力和团队保护机制。", + changes: "护甲值 +20%,生命回复速度 +15%", + }, + ]; + + const battleData = [ + { + rank: 1, + character: "暗影刺客", + winRate: "68%", + pickRate: "42%", + banRate: "38%", + }, + { + rank: 2, + character: "元素法师", + winRate: "62%", + pickRate: "38%", + banRate: "25%", + }, + { + rank: 3, + character: "狂战士", + winRate: "65%", + pickRate: "40%", + banRate: "22%", + }, + { + rank: 4, + character: "钢铁守卫", + winRate: "58%", + pickRate: "35%", + banRate: "18%", + }, + { + rank: 5, + character: "神射手", + winRate: "59%", + pickRate: "32%", + banRate: "15%", + }, + ]; + const equipmentBuilds = [ + { + id: 1, + character: "暗影刺客", + avatar: + "https://public.readdy.ai/ai/img_res/5488e233cf11243801c148778a6c1d46.jpg", + items: [ + "暗影匕首", + "刺客护甲", + "速度之靴", + "致命宝石", + "隐形披风", + "破甲短剑", + ], + winRate: "68%", + usageRate: "42%", + tags: ["高爆发", "单体刺杀", "灵活机动"], + }, + { + id: 2, + character: "元素法师", + avatar: + "https://public.readdy.ai/ai/img_res/fc1ca2fe0c579530ebb48af702a00a69.jpg", + items: [ + "法师法杖", + "魔力长袍", + "法术之靴", + "魔法水晶", + "奥术宝珠", + "时间怀表", + ], + winRate: "62%", + usageRate: "38%", + tags: ["范围控制", "高法术伤害", "团战核心"], + }, + { + id: 3, + character: "钢铁守卫", + avatar: + "https://public.readdy.ai/ai/img_res/f2961785fd8feb60a369a8224515c980.jpg", + items: [ + "守护者盾牌", + "重型护甲", + "抵抗之靴", + "生命宝石", + "荆棘背心", + "反伤护符", + ], + winRate: "58%", + usageRate: "35%", + tags: ["高生存", "团队保护", "前排坦克"], + }, + { + id: 4, + character: "狂战士", + avatar: + "https://public.readdy.ai/ai/img_res/09dab9a842b7ba916d91f6ddffed0178.jpg", + items: [ + "狂战斧", + "战士护甲", + "狂暴之靴", + "力量宝石", + "嗜血项链", + "狂怒手套", + ], + winRate: "65%", + usageRate: "40%", + tags: ["高持续伤害", "团战切入", "半肉战士"], + }, + ]; + + return ( +
+ {/* 背景装饰 */} +
+ + {/* 英雄区 */} +
+
+
+
+
+ {getVisibleSlides().map(({ index, opacity }) => ( +
+
+
+ {slides[index].title} +
+
+ ))} +
+
+
+
+ + {slides[currentSlide].version} + +
+

+ + {slides[currentSlide].title} + + + {slides[currentSlide].subtitle} + +

+

+ {slides[currentSlide].description} +

+
+ + +
+
+
+ {/* 轮播图指示器 */} +
+ {slides.map((_, index) => ( +
+
+
+
+ + {/* 最新角色更新区 */} +
+
+
+
+ {/* 即将登场 */} +
+
+
+
+ + 新英雄预告 + +
+

即将登场

+
+ + 查看全部 + + +
+
+ {upcomingCharacters.map((character) => ( +
+
+
+ + {character.role} + +
+ {character.name} +
+
+
+

+ {character.name} +

+ + 即将登场 + +
+

+ {character.description} +

+
+

+ 核心特性 +

+

+ {character.features} +

+
+ +
+
+ ))} +
+
+ + {/* 最新更新 */} +
+
+
+
+ + 平衡性调整 + +
+

最新更新

+
+ + 查看全部 + + +
+
+ {updatedCharacters.map((character) => ( +
+
+
+ + {character.role} + +
+ {character.name} +
+
+
+

+ {character.name} +

+ + 最新更新 + +
+

+ {character.description} +

+
+

+ 变更数据 +

+

+ {character.changes} +

+
+ +
+
+ ))} +
+
+
+
+
+ + {/* 热门配装推荐 */} +
+
+
+
+

热门配装推荐

+ + 更多配装 + + +
+
+ {equipmentBuilds.map((build) => ( +
+
+
+ {build.character} +
+

+ {build.character} +

+
+ + 胜率: {build.winRate} + + + 使用率: {build.usageRate} + +
+
+
+
+

推荐装备

+
+ {build.items.map((item, index) => ( +
+
+ +
+
+ ))} +
+
+
+ {build.tags.map((tag, index) => ( + + {tag} + + ))} +
+ +
+
+ ))} +
+
+
+ + {/* 对战数据板块 */} +
+
+
+
+

实时对战数据

+ + 查看完整数据 + + +
+
+
+
+
+

+ 角色使用率排行 +

+
+ + + + + + + + + + + + {battleData.map((data) => ( + + + + + + + + ))} + +
+ 排名 + + 角色 + + 胜率 + + 选取率 + + 禁用率 +
+
+ {data.rank} +
+
+ {data.character} + + {data.winRate} + + {data.pickRate} + + {data.banRate} +
+
+
+
+
+
+
+
+

+ 当前赛季 +

+
+ 赛季名称 + 暗影崛起 +
+
+ 开始时间 + 2025-03-15 +
+
+ 结束时间 + 2025-06-15 +
+
+ 剩余时间 + 66 天 +
+
+
+
+
+

+ 最新比赛结果 +

+
+
+
+ 职业联赛 + 2小时前 +
+
+
+ + 龙族战队 + + + 3 + +
+ VS +
+ 1 + + 风暴战队 + +
+
+
+
+
+ 职业联赛 + 5小时前 +
+
+
+ + 火焰战队 + + + 3 + +
+ VS +
+ 2 + + 雷霆战队 + +
+
+
+
+
+ 职业联赛 + 昨天 +
+
+
+ + 幽灵战队 + + 0 +
+ VS +
+ + 3 + + + 星辰战队 + +
+
+
+
+
+
+
+
+
+
+
+ ); }; -export default Home; \ No newline at end of file +export default Home; diff --git a/tsconfig.json b/tsconfig.json index df6fbac..807e766 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,18 +6,14 @@ "noEmit": true, "skipLibCheck": true, "useDefineForClassFields": true, - - /* modules */ "module": "ESNext", "isolatedModules": true, "resolveJsonModule": true, "moduleResolution": "bundler", "allowImportingTsExtensions": true, - - /* type checking */ "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true + "noUnusedLocals": false, + "noUnusedParameters": false }, "include": ["src", "postcss.config.mjs"] }