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) => ( - - ))} -
- )}