diff --git a/packages/lb-components/src/views/MainView/toolHeader/index.tsx b/packages/lb-components/src/views/MainView/toolHeader/index.tsx index dffebafcc..7d6eb94c2 100644 --- a/packages/lb-components/src/views/MainView/toolHeader/index.tsx +++ b/packages/lb-components/src/views/MainView/toolHeader/index.tsx @@ -2,7 +2,7 @@ import { ESubmitType, prefix } from '@/constant'; import { EToolName } from '@/data/enums/ToolType'; import useSize from '@/hooks/useSize'; import { AppState } from '@/store'; -import { ToNextStep, ToSubmitFileData } from '@/store/annotation/actionCreators'; +import { loadImgList, ToNextStep, ToSubmitFileData } from '@/store/annotation/actionCreators'; import { IFileItem } from '@/types/data'; import { Header } from '@/types/main'; import { IStepInfo } from '@/types/step'; @@ -24,19 +24,36 @@ interface INextStep { stepProgress: number; stepList: IStepInfo[]; step: number; // 当前步骤 + imgList: IFileItem[]; } -const NextButton: React.FC<{ disabled: boolean }> = ({ disabled }) => { +const NextButton: React.FC<{ disabled: boolean; imgList: IFileItem[] }> = ({ + disabled, + imgList, +}) => { const { t } = useTranslation(); + + const toNext = () => { + const { dispatch, getState } = store; + // 点击下一步跳转到第一页 第一页没有图片的话则需要先加载图片 + if (imgList[0]) { + dispatch(ToNextStep(0) as any); + } else { + loadImgList(dispatch, getState, 0).then((isSuccess) => { + if (isSuccess) { + dispatch(ToNextStep(0) as any); + } + }); + } + }; + return (