diff --git a/web/src/components/QuestionFloatButton.module.less b/web/src/components/QuestionFloatButton.module.less index c4ee41f..c4ff246 100644 --- a/web/src/components/QuestionFloatButton.module.less +++ b/web/src/components/QuestionFloatButton.module.less @@ -93,8 +93,8 @@ position: absolute; top: 0; left: 0; - width: 64px; - height: 64px; + width: 100%; + height: 100%; transform: rotate(-90deg); pointer-events: none; } @@ -135,8 +135,9 @@ .statsCard { padding: 6px 12px; - gap: 10px; + gap: 8px; border-radius: 10px; + font-size: 12px; } .statsLabel { @@ -144,11 +145,11 @@ } .statsValue { - font-size: 14px; + font-size: 13px; } .statsDivider { - height: 18px; + height: 16px; } .floatButton { @@ -156,13 +157,43 @@ height: 58px; } - .progressRing { - width: 58px; - height: 58px; + .icon { + font-size: 22px; + } +} + +// 超小屏幕优化 +@media (max-width: 380px) { + .floatButtonWrapper { + right: 12px; + bottom: 75px; + } + + .statsCard { + padding: 5px 10px; + gap: 6px; + border-radius: 8px; + } + + .statsLabel { + font-size: 9px; + } + + .statsValue { + font-size: 12px; + } + + .statsDivider { + height: 14px; + } + + .floatButton { + width: 54px; + height: 54px; } .icon { - font-size: 22px; + font-size: 20px; } } diff --git a/web/src/components/QuestionFloatButton.tsx b/web/src/components/QuestionFloatButton.tsx index b0b0ed4..7d78057 100644 --- a/web/src/components/QuestionFloatButton.tsx +++ b/web/src/components/QuestionFloatButton.tsx @@ -32,7 +32,7 @@ const QuestionFloatButton: React.FC = ({
进度 - {currentIndex + 1}/{totalQuestions} + {answeredCount}/{totalQuestions}
@@ -54,7 +54,7 @@ const QuestionFloatButton: React.FC = ({ {/* 悬浮球 */}
{/* 进度环 */} - + { // 随机模式:从题库中随机选择一题 if (randomMode) { - // 生成一个不等于当前索引的随机索引 - do { - nextIndex = Math.floor(Math.random() * allQuestions.length); - } while (nextIndex === currentIndex && allQuestions.length > 1); + // 获取所有未答题目的索引 + const unansweredIndexes: number[] = []; + for (let i = 0; i < allQuestions.length; i++) { + if (!answeredStatus.has(i)) { + unansweredIndexes.push(i); + } + } + + // 如果所有题目都已回答,显示总结页面 + if (unansweredIndexes.length === 0) { + setShowSummary(true); + // 清除进度 + localStorage.removeItem(getStorageKey()); + return; + } + + // 从未答题目中随机选择一题 + const randomIdx = Math.floor(Math.random() * unansweredIndexes.length); + nextIndex = unansweredIndexes[randomIdx]; } else { // 顺序模式:检查是否完成所有题目 if (currentIndex + 1 >= allQuestions.length) {