Merge pull request !5 from 白书科技/fix/0905
This commit is contained in:
白书科技 2023-09-05 10:09:23 +00:00 committed by Gitee
commit fd4bc958cc
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
10 changed files with 65 additions and 15 deletions

View File

@ -13,7 +13,7 @@
.menu-box {
width: 200px;
height: 100%;
height: calc(100% - 74px);
overflow-y: auto;
overflow-x: hidden;
}

View File

@ -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>

View File

@ -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>

View File

@ -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);
});
};

View File

@ -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);
});
};

View File

@ -389,7 +389,6 @@ const DepartmentPage = () => {
blockNode
onDragEnter={onDragEnter}
onDrop={onDrop}
defaultExpandAll={true}
switcherIcon={<i className="iconfont icon-icon-fold c-gray" />}
/>
)}

View File

@ -122,26 +122,22 @@ const ResourceCoursewarePage = () => {
{
title: "课件格式",
dataIndex: "type",
width: 204,
render: (type: string) => <span>{type}</span>,
},
{
title: "课件大小",
dataIndex: "size",
width: 204,
render: (size: number) => <span>{(size / 1024 / 1024).toFixed(2)}M</span>,
},
{
title: "创建人",
dataIndex: "admin_id",
width: 204,
render: (text: number) =>
JSON.stringify(adminUsers) !== "{}" && <span>{adminUsers[text]}</span>,
},
{
title: "创建时间",
dataIndex: "created_at",
width: 204,
render: (text: string) => <span>{dateFormat(text)}</span>,
},
{

View File

@ -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);
});
};

View File

@ -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);
});
};

View File

@ -399,7 +399,6 @@ const ResourceCategoryPage = () => {
blockNode
onDragEnter={onDragEnter}
onDrop={onDrop}
defaultExpandAll={true}
switcherIcon={<i className="iconfont icon-icon-fold c-gray" />}
/>
)}