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