From 4606a8f8965aa4da04efaea21d71759913e2dd68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BA=E7=8B=A8?= <18119604035@163.com> Date: Mon, 22 May 2023 11:08:32 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BA=BF=E4=B8=8A=E8=AF=BE=E8=AF=BE=E6=97=B6?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compenents/select-resource/index.tsx | 6 +++++- src/compenents/upload-video-sub/index.tsx | 2 +- src/pages/course/compenents/create.tsx | 22 +++++---------------- src/pages/course/compenents/hour-update.tsx | 8 ++++++++ 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/compenents/select-resource/index.tsx b/src/compenents/select-resource/index.tsx index b0f74f7..e7f9525 100644 --- a/src/compenents/select-resource/index.tsx +++ b/src/compenents/select-resource/index.tsx @@ -62,7 +62,11 @@ export const SelectResource = (props: PropsInterface) => { open={props.open} width={800} maskClosable={false} - onOk={() => props.onSelected(selectKeys, selectVideos)} + onOk={() => { + props.onSelected(selectKeys, selectVideos); + setSelectKeys([]); + setSelectVideos([]); + }} > diff --git a/src/compenents/upload-video-sub/index.tsx b/src/compenents/upload-video-sub/index.tsx index d7819fb..ce9179f 100644 --- a/src/compenents/upload-video-sub/index.tsx +++ b/src/compenents/upload-video-sub/index.tsx @@ -218,7 +218,7 @@ export const UploadVideoSub = (props: PropsInterface) => { paddingLeft: 10, }} > - {videoList.length > 0 && ( + {videoList.length > 0 && total > 10 && ( = ({ }; const selectData = (arr: any, videos: any) => { - let keys = [...hours]; - let init = false; - keys.map((item: any) => { - if (arr.indexOf(item) !== -1) { - init = true; - } - }); - if (init) { + if (arr.length === 0) { message.error("请选择视频"); return; } + let keys = [...hours]; let data = [...treeData]; keys = keys.concat(arr); data = data.concat(videos); @@ -261,18 +255,12 @@ export const CourseCreate: React.FC = ({ }; const selectChapterData = (arr: any, videos: any) => { - const data = [...chapters]; - const keys = [...chapterHours]; - let init = false; - keys[addvideoCurrent].map((item: any) => { - if (arr.indexOf(item) !== -1) { - init = true; - } - }); - if (init) { + if (arr.length === 0) { message.error("请选择视频"); return; } + const data = [...chapters]; + const keys = [...chapterHours]; keys[addvideoCurrent] = keys[addvideoCurrent].concat(arr); data[addvideoCurrent].hours = data[addvideoCurrent].hours.concat(videos); setChapters(data); diff --git a/src/pages/course/compenents/hour-update.tsx b/src/pages/course/compenents/hour-update.tsx index 5d25b7d..cf7529f 100644 --- a/src/pages/course/compenents/hour-update.tsx +++ b/src/pages/course/compenents/hour-update.tsx @@ -117,6 +117,10 @@ export const CourseHourUpdate: React.FC = ({ }); } } + if (hours.length === 0) { + message.error("请选择视频"); + return; + } courseHour .storeCourseHourMulti(id, hours) .then((res: any) => { @@ -148,6 +152,10 @@ export const CourseHourUpdate: React.FC = ({ }); } } + if (hours.length === 0) { + message.error("请选择视频"); + return; + } courseHour .storeCourseHourMulti(id, hours) .then((res: any) => {