资源视频编辑组件优化

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

View File

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