Skip to content

Commit 0900fca

Browse files
committed
更新题目yml文件和主页组件
1 parent 64766a3 commit 0900fca

File tree

6 files changed

+78
-30
lines changed

6 files changed

+78
-30
lines changed

docs/challenges/jsjiami JS最牛加密-V7.yml

Lines changed: 12 additions & 0 deletions
Large diffs are not rendered by default.

docs/challenges/sojson加密结果逆向.yml

Lines changed: 16 additions & 0 deletions
Large diffs are not rendered by default.

docs/challenges/微店登录参数分析.yml

Lines changed: 15 additions & 0 deletions
Large diffs are not rendered by default.

docs/challenges/网易易盾.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@ challenges:
4141
特点:多种验证方式结合,设备指纹识别与行为分析相结合。
4242
4343
破解难点:需要绕过多层验证机制,处理动态变化的验证逻辑。
44-
45-
# 挑战目标网站URL的base64编码
46-
base64-url: aHR0cHM6Ly9kLnlpZHVuLmNvbS8=
44+
45+
base64-url: aHR0cHM6Ly9kdW4uMTYzLmNvbS8=
4746

4847
# 链接有效性状态(布尔值)
4948
# 标记挑战链接是否失效,true表示已失效

src/components/HomePage/HeroSection.tsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ const { Title, Text, Paragraph } = Typography;
2424
interface HeroSectionProps {
2525
challenges: number;
2626
difficultyCounts: {
27-
easy: number;
28-
medium: number;
29-
hard: number;
27+
beginner: number;
28+
intermediate: number;
29+
advanced: number;
3030
};
3131
animatedStats: boolean;
3232
}
@@ -40,10 +40,10 @@ const HeroSection: React.FC<HeroSectionProps> = ({ challenges, difficultyCounts,
4040
const isMobile = useMediaQuery({ maxWidth: 768 });
4141

4242
// 计算每个难度级别的百分比
43-
const total = difficultyCounts.easy + difficultyCounts.medium + difficultyCounts.hard || 1;
44-
const easyPercent = Math.round((difficultyCounts.easy / total) * 100);
45-
const mediumPercent = Math.round((difficultyCounts.medium / total) * 100);
46-
const hardPercent = Math.round((difficultyCounts.hard / total) * 100);
43+
const total = difficultyCounts.beginner + difficultyCounts.intermediate + difficultyCounts.advanced || 1;
44+
const beginnerPercent = Math.round((difficultyCounts.beginner / total) * 100);
45+
const intermediatePercent = Math.round((difficultyCounts.intermediate / total) * 100);
46+
const advancedPercent = Math.round((difficultyCounts.advanced / total) * 100);
4747

4848
// 难度级别卡片样式
4949
const difficultyCardStyle = {
@@ -174,7 +174,7 @@ const HeroSection: React.FC<HeroSectionProps> = ({ challenges, difficultyCounts,
174174
<Row gutter={[isMobile ? 8 : 16, isMobile ? 8 : 16]}>
175175
{/* 初级难度 */}
176176
<Col span={24} sm={8}>
177-
<Tooltip title={`${easyPercent}% ${t('home.hero.stats.ofTotal')}`}>
177+
<Tooltip title={`${beginnerPercent}% ${t('home.hero.stats.ofTotal')}`}>
178178
<div
179179
style={{
180180
...difficultyCardStyle,
@@ -200,10 +200,10 @@ const HeroSection: React.FC<HeroSectionProps> = ({ challenges, difficultyCounts,
200200
marginBottom: '8px',
201201
textShadow: '0 0 10px rgba(82, 196, 26, 0.4)'
202202
}}>
203-
{difficultyCounts.easy}
203+
{difficultyCounts.beginner}
204204
</div>
205205
<Progress
206-
percent={easyPercent}
206+
percent={beginnerPercent}
207207
showInfo={false}
208208
strokeColor="#52c41a"
209209
trailColor="rgba(255,255,255,0.1)"
@@ -215,7 +215,7 @@ const HeroSection: React.FC<HeroSectionProps> = ({ challenges, difficultyCounts,
215215

216216
{/* 中级难度 */}
217217
<Col span={24} sm={8}>
218-
<Tooltip title={`${mediumPercent}% ${t('home.hero.stats.ofTotal')}`}>
218+
<Tooltip title={`${intermediatePercent}% ${t('home.hero.stats.ofTotal')}`}>
219219
<div
220220
style={{
221221
...difficultyCardStyle,
@@ -241,10 +241,10 @@ const HeroSection: React.FC<HeroSectionProps> = ({ challenges, difficultyCounts,
241241
marginBottom: '8px',
242242
textShadow: '0 0 10px rgba(250, 173, 20, 0.4)'
243243
}}>
244-
{difficultyCounts.medium}
244+
{difficultyCounts.intermediate}
245245
</div>
246246
<Progress
247-
percent={mediumPercent}
247+
percent={intermediatePercent}
248248
showInfo={false}
249249
strokeColor="#faad14"
250250
trailColor="rgba(255,255,255,0.1)"
@@ -256,7 +256,7 @@ const HeroSection: React.FC<HeroSectionProps> = ({ challenges, difficultyCounts,
256256

257257
{/* 高级难度 */}
258258
<Col span={24} sm={8}>
259-
<Tooltip title={`${hardPercent}% ${t('home.hero.stats.ofTotal')}`}>
259+
<Tooltip title={`${advancedPercent}% ${t('home.hero.stats.ofTotal')}`}>
260260
<div
261261
style={{
262262
...difficultyCardStyle,
@@ -282,10 +282,10 @@ const HeroSection: React.FC<HeroSectionProps> = ({ challenges, difficultyCounts,
282282
marginBottom: '8px',
283283
textShadow: '0 0 10px rgba(245, 34, 45, 0.4)'
284284
}}>
285-
{difficultyCounts.hard}
285+
{difficultyCounts.advanced}
286286
</div>
287287
<Progress
288-
percent={hardPercent}
288+
percent={advancedPercent}
289289
showInfo={false}
290290
strokeColor="#f5222d"
291291
trailColor="rgba(255,255,255,0.1)"

src/components/HomePage/index.tsx

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,22 @@ import { pageContainerStyle, animationStyles } from './styles';
88
import { useMediaQuery } from 'react-responsive';
99

1010
// 获取不同难度的挑战数量
11-
const getDifficultyCounts = () => {
12-
const counts = { easy: 0, medium: 0, hard: 0 };
13-
challenges.forEach(challenge => {
14-
// 匹配新的难度分类:
15-
// easy: 1星, medium: 2-3星, hard: 4-5星
16-
if (challenge.difficulty === 1) counts.easy++;
17-
else if (challenge.difficulty === 2 || challenge.difficulty === 3) counts.medium++;
18-
else if (challenge.difficulty >= 4) counts.hard++;
19-
});
20-
return counts;
11+
const getDifficultyCounts = (challenges: Challenge[]) => {
12+
let beginner = 0;
13+
let intermediate = 0;
14+
let advanced = 0;
15+
16+
challenges.forEach(challenge => {
17+
if (challenge.difficulty === 1) {
18+
beginner++;
19+
} else if (challenge.difficulty >= 2 && challenge.difficulty <= 3) {
20+
intermediate++;
21+
} else if (challenge.difficulty >= 4) {
22+
advanced++;
23+
}
24+
});
25+
26+
return { beginner, intermediate, advanced };
2127
};
2228

2329
/**
@@ -27,7 +33,7 @@ const getDifficultyCounts = () => {
2733
const HomePage = () => {
2834
const [animatedStats, setAnimatedStats] = useState(false);
2935
const navigate = useNavigate();
30-
const difficultyCounts = getDifficultyCounts();
36+
const difficultyCounts = getDifficultyCounts(challenges);
3137
const isMobile = useMediaQuery({ maxWidth: 768 });
3238

3339
// 获取最新的3个挑战

0 commit comments

Comments
 (0)