diff --git a/frontend/src/pages/TestPage.tsx b/frontend/src/pages/TestPage.tsx deleted file mode 100644 index 3bfe311..0000000 --- a/frontend/src/pages/TestPage.tsx +++ /dev/null @@ -1,80 +0,0 @@ -import { makeStyles } from "@mui/styles"; -import { Tag } from "antd"; - -const useStyles = makeStyles({ - container: { - height: '200px', - width: '600px', - border: '1px solid black', - margin: "100px", - display: 'flex', - flexDirection: 'column', - flexWrap: 'wrap', - overflowY: 'scroll', - }, - names: { - maxWidth: '140px', - minWidth: '140px', - }, - phones: { - maxWidth: '140px', - minWidth: '140px', - }, - address: { - maxWidth: '140px', - minWidth: '140px', - } -}); -export const TestPage = () => { - const style = useStyles(); - return ( -
-
- name1 - name2 - name3 - name4 - name5 - name6 - name7 - name8 - name9 - name10 - name11 - name12 - name13 - name14 - name15 -
-
- phone1 - phone2 - phone3 - phone4 - phone5 - phone6 - phone7 - phone8 - phone9 -
-
- address1 - address2 - address3 - address4 - address5 - address6 - address7 - address8 -
-
- birthday - birthday - birthday - birthday - birthday - birthday -
-
- ); -} \ No newline at end of file diff --git a/frontend/src/pages/task/components/TaskCreate.tsx b/frontend/src/pages/task/components/TaskCreate.tsx index dcb363e..62e9b54 100644 --- a/frontend/src/pages/task/components/TaskCreate.tsx +++ b/frontend/src/pages/task/components/TaskCreate.tsx @@ -1,6 +1,6 @@ import { makeStyles } from "@mui/styles" import { Modal, Collapse } from "antd" -import { DndContext } from '@dnd-kit/core' +import { DndContext, } from '@dnd-kit/core' import { SortableContext, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable'; import { CSS } from '@dnd-kit/utilities' import { arrayMove } from '@dnd-kit/sortable' @@ -11,7 +11,8 @@ const useStyle = makeStyles({ footer: { display: 'flex', flexDirection: 'row', - } + }, + dnd: {} }) export interface TaskCreateProps { @@ -34,7 +35,7 @@ export const TaskCreate = (props: TaskCreateProps) => { const style = useStyle(); const [items, setItems] = useState(steps); - const onDragEnd = ({ active, over }) => { + const onDragEnd = ({ active, over }: { active: any, over: any }) => { if (active.id !== over?.id) { setItems(items => { const oldIndex = items.findIndex(item => item.id === active.id); @@ -57,44 +58,59 @@ export const TaskCreate = (props: TaskCreateProps) => { title="新建任务" open={props.open} > + + + { return { key: v.id, label: v.title, children:

hello

} })}> +
+
- - {items.map(item => ( - - - {'步骤内容-' + item.type} - - - ))} - + { + items.filter(v => v.type === "mid").map(v => { + return ( + + hello

}]} style={{ flex: 1 }}> +
+
+ ) + }) + }
+ + { return { key: v.id, label: v.title, children:

hello

} })}> +
+
); }; -const SortableItem = ({ id, children }: { id: number; children: JSX.Element }) => { +const SortableItem = ({ id, children, disabled=false }: { id: number; children: JSX.Element;disabled? : boolean}) => { const { attributes, listeners, setNodeRef, transform, transition } = useSortable({ id }); const style = { - transform: CSS.Transform.toString(transform), + 'transform': CSS.Transform.toString(transform), transition, - cursor: 'move', - backgroundColor: 'white', - marginBottom: 8, - borderRadius: 4, - boxShadow: '0 2px 4px rgba(0,0,0,0.1)' + 'cursor': disabled? 'not-allowed': 'move', + 'background-color': 'white', + 'margin-bottom': 8, + 'border-radius': 4, + 'box-shadow': '0 2px 4px rgba(0,0,0,0.1)', + 'display': 'flex', // Add this line to make the item a flex container + 'flex-direction': 'row', // Add this line to set the direction of the flex container to row + 'padding': '10px', }; return (
⋮⋮
{children} diff --git a/frontend/src/routes.tsx b/frontend/src/routes.tsx index 5d74c88..efe8697 100644 --- a/frontend/src/routes.tsx +++ b/frontend/src/routes.tsx @@ -3,7 +3,6 @@ import { HomePage } from './pages/HomePage'; import { AboutPage } from './pages/AboutPage'; import TaskPage from './pages/task/TaskPage'; import LoginPage from './pages/LoginPage'; -import { TestPage } from './pages/TestPage'; const AppRoutes = () => { return ( @@ -13,7 +12,6 @@ const AppRoutes = () => { } /> } /> } /> - } /> );