jihuaqiang 2 天之前
父節點
當前提交
4bd7a310be
共有 1 個文件被更改,包括 6 次插入3 次删除
  1. 6 3
      src/views/publishContent/weCom/components/videoSelectModal/index.tsx

+ 6 - 3
src/views/publishContent/weCom/components/videoSelectModal/index.tsx

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