From 9ac679d437c7b40f5895e85501acbafba2e71ee3 Mon Sep 17 00:00:00 2001 From: jialin Date: Fri, 14 Mar 2025 19:37:49 +0800 Subject: [PATCH] fix: block body scroll when view version --- src/components/seal-form/seal-slider.tsx | 21 +++------------------ src/layouts/index.tsx | 6 +++++- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/components/seal-form/seal-slider.tsx b/src/components/seal-form/seal-slider.tsx index bfa1a915..418e9dc1 100644 --- a/src/components/seal-form/seal-slider.tsx +++ b/src/components/seal-form/seal-slider.tsx @@ -1,13 +1,7 @@ import { INPUT_WIDTH } from '@/constants'; -import { InfoCircleOutlined } from '@ant-design/icons'; -import { - Form, - InputNumber, - Slider, - Tooltip, - type SliderSingleProps -} from 'antd'; +import { Form, InputNumber, Slider, type SliderSingleProps } from 'antd'; import React from 'react'; +import LabelInfo from './components/label-info'; import FieldWrapper from './field-wrapper'; import SliderStyles from './styles/slider.less'; @@ -61,16 +55,7 @@ const SealSlider: React.FC = (props) => { style={{ width: labelWidth || INPUT_WIDTH.mini }} > - {description ? ( - - {label} - - - - - ) : ( - {label} - )} + {inputnumber ? ( diff --git a/src/layouts/index.tsx b/src/layouts/index.tsx index 09d9e83b..69907a96 100644 --- a/src/layouts/index.tsx +++ b/src/layouts/index.tsx @@ -7,6 +7,7 @@ import ShortCuts, { } from '@/components/short-cuts'; import VersionInfo, { modalConfig } from '@/components/version-info'; import routeCachekey from '@/config/route-cachekey'; +import useBodyScroll from '@/hooks/use-body-scroll'; import useOverlayScroller from '@/hooks/use-overlay-scroller'; import { logout } from '@/pages/login/apis'; import { useAccessMarkedRoutes } from '@@/plugin-access'; @@ -97,6 +98,7 @@ export default (props: any) => { const { initialize: initialize } = useOverlayScroller({ defer: false }); + const { saveScrollHeight, restoreScrollHeight } = useBodyScroll(); const { initialize: initializeMenu } = useOverlayScroller(); const [userInfo] = useAtom(userAtom); const [routeCache] = useAtom(routeCacheAtom); @@ -127,10 +129,12 @@ export default (props: any) => { }; const showVersion = () => { + saveScrollHeight(); Modal.info({ ...modalConfig, width: 460, - content: + content: , + onCancel: restoreScrollHeight }); };