资源视频编辑组件优化

This commit is contained in:
禺狨 2023-06-13 11:10:57 +08:00
parent e29744ea88
commit 9dc959b064
2 changed files with 10 additions and 1 deletions

View File

@ -6,12 +6,14 @@ interface PropInterface {
id: number;
open: boolean;
onCancel: () => void;
onSuccess: () => void;
}
export const VideosUpdateDialog: React.FC<PropInterface> = ({
id,
open,
onCancel,
onSuccess,
}) => {
const [form] = Form.useForm();
const [loading, setLoading] = useState<boolean>(true);
@ -72,9 +74,12 @@ export const VideosUpdateDialog: React.FC<PropInterface> = ({
};
const onFinish = (values: any) => {
if (Array.isArray(values.category_id)) {
values.category_id = values.category_id[0];
}
resource.videoUpdate(id, values).then((res: any) => {
message.success("保存成功!");
onCancel();
onSuccess();
});
};

View File

@ -341,6 +341,10 @@ const ResourceVideosPage = () => {
id={Number(updateId)}
open={updateVisible}
onCancel={() => setUpdateVisible(false)}
onSuccess={() => {
setUpdateVisible(false);
setRefresh(!refresh);
}}
></VideosUpdateDialog>
</div>
</>