mirror of
https://github.com/PlayEdu/backend
synced 2025-06-28 23:42:51 +08:00
分类、部门、线上课的添加、编辑确认按钮优化
This commit is contained in:
parent
c7977f2956
commit
c34f8dae8e
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
.menu-box {
|
.menu-box {
|
||||||
width: 200px;
|
width: 200px;
|
||||||
height: 100%;
|
height: calc(100% - 74px);
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ export const CourseCreate: React.FC<PropInterface> = ({
|
|||||||
const defaultThumb1 = courseDefaultThumbs[0];
|
const defaultThumb1 = courseDefaultThumbs[0];
|
||||||
const defaultThumb2 = courseDefaultThumbs[1];
|
const defaultThumb2 = courseDefaultThumbs[1];
|
||||||
const defaultThumb3 = courseDefaultThumbs[2];
|
const defaultThumb3 = courseDefaultThumbs[2];
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(false);
|
||||||
const [departments, setDepartments] = useState<Option[]>([]);
|
const [departments, setDepartments] = useState<Option[]>([]);
|
||||||
const [categories, setCategories] = useState<Option[]>([]);
|
const [categories, setCategories] = useState<Option[]>([]);
|
||||||
const [thumb, setThumb] = useState("");
|
const [thumb, setThumb] = useState("");
|
||||||
@ -220,6 +220,9 @@ export const CourseCreate: React.FC<PropInterface> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onFinish = (values: any) => {
|
const onFinish = (values: any) => {
|
||||||
|
if (loading) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let dep_ids: any[] = [];
|
let dep_ids: any[] = [];
|
||||||
if (type === "elective") {
|
if (type === "elective") {
|
||||||
dep_ids = values.dep_ids;
|
dep_ids = values.dep_ids;
|
||||||
@ -228,6 +231,7 @@ export const CourseCreate: React.FC<PropInterface> = ({
|
|||||||
message.error("请配置课时");
|
message.error("请配置课时");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
setLoading(true);
|
||||||
course
|
course
|
||||||
.storeCourse(
|
.storeCourse(
|
||||||
values.title,
|
values.title,
|
||||||
@ -242,8 +246,12 @@ export const CourseCreate: React.FC<PropInterface> = ({
|
|||||||
attachmentData
|
attachmentData
|
||||||
)
|
)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
|
setLoading(false);
|
||||||
message.success("保存成功!");
|
message.success("保存成功!");
|
||||||
onCancel();
|
onCancel();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
setLoading(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -480,7 +488,11 @@ export const CourseCreate: React.FC<PropInterface> = ({
|
|||||||
footer={
|
footer={
|
||||||
<Space className="j-r-flex">
|
<Space className="j-r-flex">
|
||||||
<Button onClick={() => onCancel()}>取 消</Button>
|
<Button onClick={() => onCancel()}>取 消</Button>
|
||||||
<Button onClick={() => form.submit()} type="primary">
|
<Button
|
||||||
|
loading={loading}
|
||||||
|
onClick={() => form.submit()}
|
||||||
|
type="primary"
|
||||||
|
>
|
||||||
确 认
|
确 认
|
||||||
</Button>
|
</Button>
|
||||||
</Space>
|
</Space>
|
||||||
|
@ -44,7 +44,7 @@ export const CourseUpdate: React.FC<PropInterface> = ({
|
|||||||
const defaultThumb1 = courseDefaultThumbs[0];
|
const defaultThumb1 = courseDefaultThumbs[0];
|
||||||
const defaultThumb2 = courseDefaultThumbs[1];
|
const defaultThumb2 = courseDefaultThumbs[1];
|
||||||
const defaultThumb3 = courseDefaultThumbs[2];
|
const defaultThumb3 = courseDefaultThumbs[2];
|
||||||
const [loading, setLoading] = useState<boolean>(true);
|
const [loading, setLoading] = useState(false);
|
||||||
const [departments, setDepartments] = useState<Option[]>([]);
|
const [departments, setDepartments] = useState<Option[]>([]);
|
||||||
const [categories, setCategories] = useState<Option[]>([]);
|
const [categories, setCategories] = useState<Option[]>([]);
|
||||||
const [thumb, setThumb] = useState("");
|
const [thumb, setThumb] = useState("");
|
||||||
@ -148,10 +148,14 @@ export const CourseUpdate: React.FC<PropInterface> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onFinish = (values: any) => {
|
const onFinish = (values: any) => {
|
||||||
|
if (loading) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let dep_ids: any[] = [];
|
let dep_ids: any[] = [];
|
||||||
if (type === "elective") {
|
if (type === "elective") {
|
||||||
dep_ids = values.dep_ids;
|
dep_ids = values.dep_ids;
|
||||||
}
|
}
|
||||||
|
setLoading(true);
|
||||||
course
|
course
|
||||||
.updateCourse(
|
.updateCourse(
|
||||||
id,
|
id,
|
||||||
@ -167,8 +171,12 @@ export const CourseUpdate: React.FC<PropInterface> = ({
|
|||||||
values.published_at
|
values.published_at
|
||||||
)
|
)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
|
setLoading(false);
|
||||||
message.success("保存成功!");
|
message.success("保存成功!");
|
||||||
onCancel();
|
onCancel();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
setLoading(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -191,7 +199,11 @@ export const CourseUpdate: React.FC<PropInterface> = ({
|
|||||||
footer={
|
footer={
|
||||||
<Space className="j-r-flex">
|
<Space className="j-r-flex">
|
||||||
<Button onClick={() => onCancel()}>取 消</Button>
|
<Button onClick={() => onCancel()}>取 消</Button>
|
||||||
<Button onClick={() => form.submit()} type="primary">
|
<Button
|
||||||
|
loading={loading}
|
||||||
|
onClick={() => form.submit()}
|
||||||
|
type="primary"
|
||||||
|
>
|
||||||
确 认
|
确 认
|
||||||
</Button>
|
</Button>
|
||||||
</Space>
|
</Space>
|
||||||
|
@ -19,7 +19,7 @@ export const DepartmentCreate: React.FC<PropInterface> = ({
|
|||||||
onCancel,
|
onCancel,
|
||||||
}) => {
|
}) => {
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [loading, setLoading] = useState<boolean>(true);
|
const [loading, setLoading] = useState(false);
|
||||||
const [departments, setDepartments] = useState<any>([]);
|
const [departments, setDepartments] = useState<any>([]);
|
||||||
const [parent_id, setParentId] = useState<number>(0);
|
const [parent_id, setParentId] = useState<number>(0);
|
||||||
|
|
||||||
@ -78,11 +78,19 @@ export const DepartmentCreate: React.FC<PropInterface> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onFinish = (values: any) => {
|
const onFinish = (values: any) => {
|
||||||
|
if (loading) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setLoading(true);
|
||||||
department
|
department
|
||||||
.storeDepartment(values.name, parent_id || 0, 0)
|
.storeDepartment(values.name, parent_id || 0, 0)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
|
setLoading(false);
|
||||||
message.success("保存成功!");
|
message.success("保存成功!");
|
||||||
onCancel();
|
onCancel();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
setLoading(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ export const DepartmentUpdate: React.FC<PropInterface> = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [init, setInit] = useState(true);
|
const [init, setInit] = useState(true);
|
||||||
const [loading, setLoading] = useState<boolean>(true);
|
const [loading, setLoading] = useState(false);
|
||||||
const [departments, setDepartments] = useState<any>([]);
|
const [departments, setDepartments] = useState<any>([]);
|
||||||
const [parent_id, setParentId] = useState<number>(0);
|
const [parent_id, setParentId] = useState<number>(0);
|
||||||
const [sort, setSort] = useState<number>(0);
|
const [sort, setSort] = useState<number>(0);
|
||||||
@ -93,11 +93,19 @@ export const DepartmentUpdate: React.FC<PropInterface> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onFinish = (values: any) => {
|
const onFinish = (values: any) => {
|
||||||
|
if (loading) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setLoading(true);
|
||||||
department
|
department
|
||||||
.updateDepartment(id, values.name, parent_id || 0, sort)
|
.updateDepartment(id, values.name, parent_id || 0, sort)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
|
setLoading(false);
|
||||||
message.success("保存成功!");
|
message.success("保存成功!");
|
||||||
onCancel();
|
onCancel();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
setLoading(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -389,7 +389,6 @@ const DepartmentPage = () => {
|
|||||||
blockNode
|
blockNode
|
||||||
onDragEnter={onDragEnter}
|
onDragEnter={onDragEnter}
|
||||||
onDrop={onDrop}
|
onDrop={onDrop}
|
||||||
defaultExpandAll={true}
|
|
||||||
switcherIcon={<i className="iconfont icon-icon-fold c-gray" />}
|
switcherIcon={<i className="iconfont icon-icon-fold c-gray" />}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
@ -19,7 +19,7 @@ export const ResourceCategoryCreate: React.FC<PropInterface> = ({
|
|||||||
onCancel,
|
onCancel,
|
||||||
}) => {
|
}) => {
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [loading, setLoading] = useState<boolean>(true);
|
const [loading, setLoading] = useState(false);
|
||||||
const [categories, setCategories] = useState<any>([]);
|
const [categories, setCategories] = useState<any>([]);
|
||||||
const [parent_id, setParentId] = useState<number>(0);
|
const [parent_id, setParentId] = useState<number>(0);
|
||||||
|
|
||||||
@ -78,11 +78,19 @@ export const ResourceCategoryCreate: React.FC<PropInterface> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onFinish = (values: any) => {
|
const onFinish = (values: any) => {
|
||||||
|
if (loading) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setLoading(true);
|
||||||
resourceCategory
|
resourceCategory
|
||||||
.storeResourceCategory(values.name, parent_id || 0, 0)
|
.storeResourceCategory(values.name, parent_id || 0, 0)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
|
setLoading(false);
|
||||||
message.success("保存成功!");
|
message.success("保存成功!");
|
||||||
onCancel();
|
onCancel();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
setLoading(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ export const ResourceCategoryUpdate: React.FC<PropInterface> = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [init, setInit] = useState(true);
|
const [init, setInit] = useState(true);
|
||||||
const [loading, setLoading] = useState<boolean>(true);
|
const [loading, setLoading] = useState(false);
|
||||||
const [categories, setCategories] = useState<any>([]);
|
const [categories, setCategories] = useState<any>([]);
|
||||||
const [parent_id, setParentId] = useState<number>(0);
|
const [parent_id, setParentId] = useState<number>(0);
|
||||||
const [sort, setSort] = useState<number>(0);
|
const [sort, setSort] = useState<number>(0);
|
||||||
@ -91,11 +91,19 @@ export const ResourceCategoryUpdate: React.FC<PropInterface> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onFinish = (values: any) => {
|
const onFinish = (values: any) => {
|
||||||
|
if (loading) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setLoading(true);
|
||||||
resourceCategory
|
resourceCategory
|
||||||
.updateResourceCategory(id, values.name, parent_id || 0, sort)
|
.updateResourceCategory(id, values.name, parent_id || 0, sort)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
|
setLoading(false);
|
||||||
message.success("保存成功!");
|
message.success("保存成功!");
|
||||||
onCancel();
|
onCancel();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
setLoading(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -399,7 +399,6 @@ const ResourceCategoryPage = () => {
|
|||||||
blockNode
|
blockNode
|
||||||
onDragEnter={onDragEnter}
|
onDragEnter={onDragEnter}
|
||||||
onDrop={onDrop}
|
onDrop={onDrop}
|
||||||
defaultExpandAll={true}
|
|
||||||
switcherIcon={<i className="iconfont icon-icon-fold c-gray" />}
|
switcherIcon={<i className="iconfont icon-icon-fold c-gray" />}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user