diff --git a/frontend/src/pages/task/components/TaskCreate.tsx b/frontend/src/pages/task/components/TaskCreate.tsx index 69825e1..dcb363e 100644 --- a/frontend/src/pages/task/components/TaskCreate.tsx +++ b/frontend/src/pages/task/components/TaskCreate.tsx @@ -22,11 +22,11 @@ export interface TaskCreateProps { const steps: Step[] = [ { id: 1, title: '步骤1', type: 'src' } as Step, { id: 2, title: '步骤2', type: 'mid' } as Step, - { id: 2, title: '步骤3', type: 'mid' } as Step, - { id: 2, title: '步骤4', type: 'mid' } as Step, - { id: 2, title: '步骤5', type: 'mid' } as Step, - { id: 2, title: '步骤6', type: 'mid' } as Step, - { id: 3, title: '步骤7', type: 'dst' } as Step, + { id: 3, title: '步骤3', type: 'mid' } as Step, + { id: 4, title: '步骤4', type: 'mid' } as Step, + { id: 5, title: '步骤5', type: 'mid' } as Step, + { id: 6, title: '步骤6', type: 'mid' } as Step, + { id: 7, title: '步骤7', type: 'dst' } as Step, ] @@ -37,14 +37,13 @@ export const TaskCreate = (props: TaskCreateProps) => { const onDragEnd = ({ active, over }) => { if (active.id !== over?.id) { setItems(items => { - const oldIndex = items.indexOf(active.id); - const newIndex = items.indexOf(over.id); + const oldIndex = items.findIndex(item => item.id === active.id); + const newIndex = items.findIndex(item => item.id === over.id); return arrayMove(items, oldIndex, newIndex); }); } }; - return (