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) => {