From 2850b6bef882874833f2981a8fe2faed02216e56 Mon Sep 17 00:00:00 2001 From: mtvpls Date: Thu, 15 Jan 2026 12:43:40 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=93=E5=86=B2=E7=AD=96=E7=95=A5=E4=BB=8E?= =?UTF-8?q?=E4=B8=8B=E6=8B=89=E6=A1=86=E6=94=B9=E4=B8=BA=E6=BB=91=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/UserMenu.tsx | 109 +++++++++++++++++------------------- 1 file changed, 51 insertions(+), 58 deletions(-) diff --git a/src/components/UserMenu.tsx b/src/components/UserMenu.tsx index 6b24e1c..b72c635 100644 --- a/src/components/UserMenu.tsx +++ b/src/components/UserMenu.tsx @@ -106,7 +106,6 @@ export const UserMenu: React.FC = () => { const [bufferStrategy, setBufferStrategy] = useState('medium'); const [nextEpisodePreCache, setNextEpisodePreCache] = useState(true); const [nextEpisodeDanmakuPreload, setNextEpisodeDanmakuPreload] = useState(true); - const [isBufferStrategyDropdownOpen, setIsBufferStrategyDropdownOpen] = useState(false); const [searchTraditionalToSimplified, setSearchTraditionalToSimplified] = useState(false); // 折叠面板状态 @@ -429,23 +428,6 @@ export const UserMenu: React.FC = () => { } }, [isDoubanImageProxyDropdownOpen]); - useEffect(() => { - const handleClickOutside = (event: MouseEvent) => { - if (isBufferStrategyDropdownOpen) { - const target = event.target as Element; - if (!target.closest('[data-dropdown="buffer-strategy"]')) { - setIsBufferStrategyDropdownOpen(false); - } - } - }; - - if (isBufferStrategyDropdownOpen) { - document.addEventListener('mousedown', handleClickOutside); - return () => - document.removeEventListener('mousedown', handleClickOutside); - } - }, [isBufferStrategyDropdownOpen]); - const handleMenuClick = () => { setIsOpen(!isOpen); }; @@ -647,6 +629,19 @@ export const UserMenu: React.FC = () => { } }; + // 将滑块值转换为策略值 + const getBufferStrategyFromSlider = (sliderValue: number): string => { + const strategies = ['low', 'medium', 'high', 'ultra']; + return strategies[sliderValue] || 'medium'; + }; + + // 将策略值转换为滑块值 + const getSliderValueFromStrategy = (strategy: string): number => { + const strategies = ['low', 'medium', 'high', 'ultra']; + const index = strategies.indexOf(strategy); + return index >= 0 ? index : 1; // 默认返回 1 (medium) + }; + const handleNextEpisodePreCacheToggle = (value: boolean) => { setNextEpisodePreCache(value); if (typeof window !== 'undefined') { @@ -1515,52 +1510,50 @@ export const UserMenu: React.FC = () => { 设置视频缓冲块大小,影响播放流畅度和流量消耗

-
- {/* 自定义下拉选择框 */} - - - {/* 下拉箭头 */} -
-
- - {/* 下拉选项列表 */} - {isBufferStrategyDropdownOpen && ( -
- {bufferStrategyOptions.map((option) => ( - - ))} -
- )}