diff --git a/web/frontend/src/pages/DouyuTasksPage.tsx b/web/frontend/src/pages/DouyuTasksPage.tsx index 4d0d0d1..9dfc3b3 100644 --- a/web/frontend/src/pages/DouyuTasksPage.tsx +++ b/web/frontend/src/pages/DouyuTasksPage.tsx @@ -252,6 +252,8 @@ export default function DouyuTasksPage({ handbook }: { handbook: HandbookKind }) const [giftCount, setGiftCount] = useState(() => savedPositiveInteger(DOUYU_GIFT_COUNT_STORAGE_KEY)); const [selectedGoodsId, setSelectedGoodsId] = useState(''); const [accountSearch, setAccountSearch] = useState(''); + const taskRecordAreaRef = useRef(null); + const [taskRecordAreaHeight, setTaskRecordAreaHeight] = useState(360); const [importOpen, setImportOpen] = useState(false); const [importPool, setImportPool] = useState([]); @@ -383,6 +385,23 @@ export default function DouyuTasksPage({ handbook }: { handbook: HandbookKind }) useEffect(() => { loadData(); }, [loadData]); + // 监听任务记录区域高度变化,动态计算 scroll.y 实现表体内部滚动 + useEffect(() => { + const node = taskRecordAreaRef.current; + if (!node) return; + const updateHeight = () => { + setTaskRecordAreaHeight(Math.max(200, Math.floor(node.getBoundingClientRect().height))); + }; + updateHeight(); + if (typeof ResizeObserver === 'undefined') { + window.addEventListener('resize', updateHeight); + return () => window.removeEventListener('resize', updateHeight); + } + const observer = new ResizeObserver(updateHeight); + observer.observe(node); + return () => observer.disconnect(); + }, []); + useEffect(() => { localStorage.setItem(DOUYU_GOLD_AMOUNT_STORAGE_KEY, String(goldAmount)); }, [goldAmount]); @@ -1222,20 +1241,22 @@ export default function DouyuTasksPage({ handbook }: { handbook: HandbookKind }) style={{ flex: 1, minHeight: 0, display: 'flex', flexDirection: 'column', overflow: 'hidden' }} styles={{ body: { flex: 1, minHeight: 0, padding: '4px 6px', overflow: 'hidden', display: 'flex', flexDirection: 'column' } }} > - `共 ${total} 条`, - }} - tableLayout="fixed" - scroll={{ x: 850 }} - /> +
+
`共 ${total} 条`, + }} + tableLayout="fixed" + scroll={{ x: 850, y: Math.max(120, taskRecordAreaHeight - 80) }} + /> +