mirror of
https://github.com/PlayEdu/backend
synced 2025-06-08 10:24:10 +08:00
资源视频编辑组件优化
This commit is contained in:
parent
e29744ea88
commit
9dc959b064
@ -6,12 +6,14 @@ interface PropInterface {
|
|||||||
id: number;
|
id: number;
|
||||||
open: boolean;
|
open: boolean;
|
||||||
onCancel: () => void;
|
onCancel: () => void;
|
||||||
|
onSuccess: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const VideosUpdateDialog: React.FC<PropInterface> = ({
|
export const VideosUpdateDialog: React.FC<PropInterface> = ({
|
||||||
id,
|
id,
|
||||||
open,
|
open,
|
||||||
onCancel,
|
onCancel,
|
||||||
|
onSuccess,
|
||||||
}) => {
|
}) => {
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [loading, setLoading] = useState<boolean>(true);
|
const [loading, setLoading] = useState<boolean>(true);
|
||||||
@ -72,9 +74,12 @@ export const VideosUpdateDialog: React.FC<PropInterface> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onFinish = (values: any) => {
|
const onFinish = (values: any) => {
|
||||||
|
if (Array.isArray(values.category_id)) {
|
||||||
|
values.category_id = values.category_id[0];
|
||||||
|
}
|
||||||
resource.videoUpdate(id, values).then((res: any) => {
|
resource.videoUpdate(id, values).then((res: any) => {
|
||||||
message.success("保存成功!");
|
message.success("保存成功!");
|
||||||
onCancel();
|
onSuccess();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -341,6 +341,10 @@ const ResourceVideosPage = () => {
|
|||||||
id={Number(updateId)}
|
id={Number(updateId)}
|
||||||
open={updateVisible}
|
open={updateVisible}
|
||||||
onCancel={() => setUpdateVisible(false)}
|
onCancel={() => setUpdateVisible(false)}
|
||||||
|
onSuccess={() => {
|
||||||
|
setUpdateVisible(false);
|
||||||
|
setRefresh(!refresh);
|
||||||
|
}}
|
||||||
></VideosUpdateDialog>
|
></VideosUpdateDialog>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user