diff --git a/src/compenents/left-menu/index.module.less b/src/compenents/left-menu/index.module.less index 771d7ab..6f1b239 100644 --- a/src/compenents/left-menu/index.module.less +++ b/src/compenents/left-menu/index.module.less @@ -13,7 +13,7 @@ .menu-box { width: 200px; - height: 100%; + height: calc(100% - 74px); overflow-y: auto; overflow-x: hidden; } diff --git a/src/pages/course/compenents/create.tsx b/src/pages/course/compenents/create.tsx index 19de948..07ce256 100644 --- a/src/pages/course/compenents/create.tsx +++ b/src/pages/course/compenents/create.tsx @@ -51,7 +51,7 @@ export const CourseCreate: React.FC = ({ const defaultThumb1 = courseDefaultThumbs[0]; const defaultThumb2 = courseDefaultThumbs[1]; const defaultThumb3 = courseDefaultThumbs[2]; - const [loading, setLoading] = useState(true); + const [loading, setLoading] = useState(false); const [departments, setDepartments] = useState([]); const [categories, setCategories] = useState([]); const [thumb, setThumb] = useState(""); @@ -220,6 +220,9 @@ export const CourseCreate: React.FC = ({ }; const onFinish = (values: any) => { + if (loading) { + return; + } let dep_ids: any[] = []; if (type === "elective") { dep_ids = values.dep_ids; @@ -228,6 +231,7 @@ export const CourseCreate: React.FC = ({ message.error("请配置课时"); return; } + setLoading(true); course .storeCourse( values.title, @@ -242,8 +246,12 @@ export const CourseCreate: React.FC = ({ attachmentData ) .then((res: any) => { + setLoading(false); message.success("保存成功!"); onCancel(); + }) + .catch((e) => { + setLoading(false); }); }; @@ -480,7 +488,11 @@ export const CourseCreate: React.FC = ({ footer={ - diff --git a/src/pages/course/compenents/update.tsx b/src/pages/course/compenents/update.tsx index 4b33f05..33cc846 100644 --- a/src/pages/course/compenents/update.tsx +++ b/src/pages/course/compenents/update.tsx @@ -44,7 +44,7 @@ export const CourseUpdate: React.FC = ({ const defaultThumb1 = courseDefaultThumbs[0]; const defaultThumb2 = courseDefaultThumbs[1]; const defaultThumb3 = courseDefaultThumbs[2]; - const [loading, setLoading] = useState(true); + const [loading, setLoading] = useState(false); const [departments, setDepartments] = useState([]); const [categories, setCategories] = useState([]); const [thumb, setThumb] = useState(""); @@ -148,10 +148,14 @@ export const CourseUpdate: React.FC = ({ }; const onFinish = (values: any) => { + if (loading) { + return; + } let dep_ids: any[] = []; if (type === "elective") { dep_ids = values.dep_ids; } + setLoading(true); course .updateCourse( id, @@ -167,8 +171,12 @@ export const CourseUpdate: React.FC = ({ values.published_at ) .then((res: any) => { + setLoading(false); message.success("保存成功!"); onCancel(); + }) + .catch((e) => { + setLoading(false); }); }; @@ -191,7 +199,11 @@ export const CourseUpdate: React.FC = ({ footer={ - diff --git a/src/pages/department/compenents/create.tsx b/src/pages/department/compenents/create.tsx index ca8ca80..e21e533 100644 --- a/src/pages/department/compenents/create.tsx +++ b/src/pages/department/compenents/create.tsx @@ -19,7 +19,7 @@ export const DepartmentCreate: React.FC = ({ onCancel, }) => { const [form] = Form.useForm(); - const [loading, setLoading] = useState(true); + const [loading, setLoading] = useState(false); const [departments, setDepartments] = useState([]); const [parent_id, setParentId] = useState(0); @@ -78,11 +78,19 @@ export const DepartmentCreate: React.FC = ({ }; const onFinish = (values: any) => { + if (loading) { + return; + } + setLoading(true); department .storeDepartment(values.name, parent_id || 0, 0) .then((res: any) => { + setLoading(false); message.success("保存成功!"); onCancel(); + }) + .catch((e) => { + setLoading(false); }); }; diff --git a/src/pages/department/compenents/update.tsx b/src/pages/department/compenents/update.tsx index 1a1f813..aed2541 100644 --- a/src/pages/department/compenents/update.tsx +++ b/src/pages/department/compenents/update.tsx @@ -22,7 +22,7 @@ export const DepartmentUpdate: React.FC = ({ }) => { const [form] = Form.useForm(); const [init, setInit] = useState(true); - const [loading, setLoading] = useState(true); + const [loading, setLoading] = useState(false); const [departments, setDepartments] = useState([]); const [parent_id, setParentId] = useState(0); const [sort, setSort] = useState(0); @@ -93,11 +93,19 @@ export const DepartmentUpdate: React.FC = ({ }; const onFinish = (values: any) => { + if (loading) { + return; + } + setLoading(true); department .updateDepartment(id, values.name, parent_id || 0, sort) .then((res: any) => { + setLoading(false); message.success("保存成功!"); onCancel(); + }) + .catch((e) => { + setLoading(false); }); }; diff --git a/src/pages/department/index.tsx b/src/pages/department/index.tsx index 7617bc5..221cd7e 100644 --- a/src/pages/department/index.tsx +++ b/src/pages/department/index.tsx @@ -389,7 +389,6 @@ const DepartmentPage = () => { blockNode onDragEnter={onDragEnter} onDrop={onDrop} - defaultExpandAll={true} switcherIcon={} /> )} diff --git a/src/pages/resource/resource-category/compenents/create.tsx b/src/pages/resource/resource-category/compenents/create.tsx index f22632f..13cba4a 100644 --- a/src/pages/resource/resource-category/compenents/create.tsx +++ b/src/pages/resource/resource-category/compenents/create.tsx @@ -19,7 +19,7 @@ export const ResourceCategoryCreate: React.FC = ({ onCancel, }) => { const [form] = Form.useForm(); - const [loading, setLoading] = useState(true); + const [loading, setLoading] = useState(false); const [categories, setCategories] = useState([]); const [parent_id, setParentId] = useState(0); @@ -78,11 +78,19 @@ export const ResourceCategoryCreate: React.FC = ({ }; const onFinish = (values: any) => { + if (loading) { + return; + } + setLoading(true); resourceCategory .storeResourceCategory(values.name, parent_id || 0, 0) .then((res: any) => { + setLoading(false); message.success("保存成功!"); onCancel(); + }) + .catch((e) => { + setLoading(false); }); }; diff --git a/src/pages/resource/resource-category/compenents/update.tsx b/src/pages/resource/resource-category/compenents/update.tsx index bbe2f84..b563ea7 100644 --- a/src/pages/resource/resource-category/compenents/update.tsx +++ b/src/pages/resource/resource-category/compenents/update.tsx @@ -22,7 +22,7 @@ export const ResourceCategoryUpdate: React.FC = ({ }) => { const [form] = Form.useForm(); const [init, setInit] = useState(true); - const [loading, setLoading] = useState(true); + const [loading, setLoading] = useState(false); const [categories, setCategories] = useState([]); const [parent_id, setParentId] = useState(0); const [sort, setSort] = useState(0); @@ -91,11 +91,19 @@ export const ResourceCategoryUpdate: React.FC = ({ }; const onFinish = (values: any) => { + if (loading) { + return; + } + setLoading(true); resourceCategory .updateResourceCategory(id, values.name, parent_id || 0, sort) .then((res: any) => { + setLoading(false); message.success("保存成功!"); onCancel(); + }) + .catch((e) => { + setLoading(false); }); }; diff --git a/src/pages/resource/resource-category/index.tsx b/src/pages/resource/resource-category/index.tsx index c0312b6..07e5677 100644 --- a/src/pages/resource/resource-category/index.tsx +++ b/src/pages/resource/resource-category/index.tsx @@ -399,7 +399,6 @@ const ResourceCategoryPage = () => { blockNode onDragEnter={onDragEnter} onDrop={onDrop} - defaultExpandAll={true} switcherIcon={} /> )}