|
@@ -57,7 +57,7 @@ const VideoSelectModal: React.FC<VideoSelectModalProps> = ({ planType, visible,
|
|
setLoading(false);
|
|
setLoading(false);
|
|
});
|
|
});
|
|
if (res && res.code === 0) {
|
|
if (res && res.code === 0) {
|
|
- const mappedVideos = res.data.objs.map(video => ({ ...video, scene: videoList.find(v => v.videoId === video.videoId)?.scene || 0 as 0 | 1 }));
|
|
|
|
|
|
+ const mappedVideos = (res.data.objs || []).map(video => ({ ...video, scene: videoList.find(v => v.videoId === video.videoId)?.scene || 0 as 0 | 1 }));
|
|
setVideoList(mappedVideos);
|
|
setVideoList(mappedVideos);
|
|
setVideoListAll(old => [...old, ...mappedVideos]);
|
|
setVideoListAll(old => [...old, ...mappedVideos]);
|
|
setTotal(res.data.totalSize);
|
|
setTotal(res.data.totalSize);
|
|
@@ -76,8 +76,9 @@ const VideoSelectModal: React.FC<VideoSelectModalProps> = ({ planType, visible,
|
|
|
|
|
|
const handleSearch = () => {
|
|
const handleSearch = () => {
|
|
console.log('Searching for:', { category, searchTerm });
|
|
console.log('Searching for:', { category, searchTerm });
|
|
- setCurrentPage(1);
|
|
|
|
- getVideoList();
|
|
|
|
|
|
+ const newPageNum = 1;
|
|
|
|
+ setCurrentPage(newPageNum);
|
|
|
|
+ getVideoList(newPageNum);
|
|
};
|
|
};
|
|
|
|
|
|
const handleSelectVideo = (videoId: number) => {
|
|
const handleSelectVideo = (videoId: number) => {
|
|
@@ -187,7 +188,9 @@ const VideoSelectModal: React.FC<VideoSelectModalProps> = ({ planType, visible,
|
|
placeholder="搜索视频标题"
|
|
placeholder="搜索视频标题"
|
|
style={{ width: 200 }}
|
|
style={{ width: 200 }}
|
|
value={searchTerm}
|
|
value={searchTerm}
|
|
|
|
+ allowClear
|
|
onChange={e => setSearchTerm(e.target.value)}
|
|
onChange={e => setSearchTerm(e.target.value)}
|
|
|
|
+ onPressEnter={handleSearch}
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
<Button type="primary" onClick={handleSearch}>搜索</Button>
|
|
<Button type="primary" onClick={handleSearch}>搜索</Button>
|