jihuaqiang 1 semana atrás
pai
commit
c2e37538cd

+ 3 - 2
src/views/publishContent/weGZH/components/editTitleCoverModal/index.tsx

@@ -42,8 +42,8 @@ const EditTitleCoverModal: React.FC<EditTitleCoverModalProps> = ({ visible, onCa
 	useEffect(() => {
 		if (video && visible) {
 			// Reset form based on incoming video data
-			const hasCustomTitle = !isNil(video.customTitle);
-			const isCustomCover = !isNil(video.customCover);
+			const hasCustomTitle = !isNil(video.customTitle) || video.customTitle === '';
+			const isCustomCover = video.customCoverType === 1 || video.customCoverType === 2;
 			const isScreenshotCover = video.customCoverType === 1;
 
 			const initialTitleType = hasCustomTitle ? 'custom' : 'original';
@@ -60,6 +60,7 @@ const EditTitleCoverModal: React.FC<EditTitleCoverModalProps> = ({ visible, onCa
 					setFileList([{ uid: '-1', name: 'custom_cover.png', status: 'done', url: video.customCover }]);
 				}
 			} else {
+				initialCoverType = 'original';
 				setSelectedScreenshot(null);
 				setFileList([]);
 			}

+ 3 - 4
src/views/publishContent/weGZH/components/publishPlanModal/index.tsx

@@ -62,8 +62,8 @@ const AddPunlishPlanModal: React.FC<AddPunlishPlanModalProps> = ({ visible, isSu
 		// Merge existing custom data with newly selected videos
 		const currentCustomData = new Map<number, Partial<VideoItem>>();
 		selectedVideos.forEach(v => {
-			if (v.cover) {
-				currentCustomData.set(v.videoId, { title: v.title, cover: v.cover });
+			if (v.videoId) {
+				currentCustomData.set(v.videoId, { customTitle: v.customTitle, customCover: v.customCover, customCoverType: v.customCoverType });
 			}
 		});
 
@@ -190,7 +190,6 @@ const AddPunlishPlanModal: React.FC<AddPunlishPlanModalProps> = ({ visible, isSu
 										onClick={() => removeVideo(video.videoId)}
 									/>
 									<div className="p-0">
-										<Text type="secondary" className="text-xs">票圈 | 3亿人喜欢的视频平台</Text>
 										<Text className="block mt-1 mb-2 leading-tight line-clamp-2" title={video.customTitle || video.title}>{video.customTitle || video.title}</Text>
 									</div>
 									<div
@@ -206,7 +205,6 @@ const AddPunlishPlanModal: React.FC<AddPunlishPlanModalProps> = ({ visible, isSu
 										</div>
 									</div>
 									<div className="p-3">
-										<Text type="secondary" className="text-xs">传播效率: {video.score?.toFixed(2)}</Text>
 										<Button
 											icon={<EditOutlined />}
 											className="w-full mt-2"
@@ -238,6 +236,7 @@ const AddPunlishPlanModal: React.FC<AddPunlishPlanModalProps> = ({ visible, isSu
 				visible={isVideoSelectVisible}
 				onClose={handleVideoSelectionCancel}
 				onOk={handleVideoSelectionOk}
+				selectedVideos={selectedVideos}
 				initialSelectedIds={selectedVideos.map(v => v.videoId)} // Pass current selection IDs
 			/>
 

+ 14 - 9
src/views/publishContent/weGZH/components/videoSelectModal/index.tsx

@@ -24,9 +24,10 @@ interface VideoSelectModalProps {
 	onClose: () => void;
 	onOk: (selectedVideos: VideoItem[]) => void;
 	initialSelectedIds?: number[];
+	selectedVideos?: VideoItem[];
 }
 
-const VideoSelectModal: React.FC<VideoSelectModalProps> = ({ visible, onClose, onOk, initialSelectedIds = [] }) => {
+const VideoSelectModal: React.FC<VideoSelectModalProps> = ({ visible, onClose, onOk, initialSelectedIds = [], selectedVideos = [] }) => {
 	const { videoCategoryOptions } = useVideoCategoryOptions();
 	const [category, setCategory] = useState<string>();
 	const [searchTerm, setSearchTerm] = useState<string>('');
@@ -54,15 +55,19 @@ const VideoSelectModal: React.FC<VideoSelectModalProps> = ({ visible, onClose, o
 			setLoading(false);
 		});
 		if (res && res.code === 0) {
-			setVideoList(res.data.objs);
-			setVideoListAll(old => [...old, ...res.data.objs]);
+			setVideoList([...selectedVideos, ...res.data.objs.filter(v => !selectedVideos.find(ov => ov.videoId === v.videoId))]);
+			setVideoListAll(old => [...old, ...res.data.objs.filter(v => !old.find(ov => ov.videoId === v.videoId))]);
 			setTotal(res.data.totalSize);
 		}
 	}
 
 	useEffect(() => {
-		getVideoList();
-	}, []);
+		if (visible) {
+			setVideoList(selectedVideos);
+			setVideoListAll(selectedVideos);
+			getVideoList(0);
+		}
+	}, [visible]);
 
 	useEffect(() => {
 		if (visible) {
@@ -93,8 +98,8 @@ const VideoSelectModal: React.FC<VideoSelectModalProps> = ({ visible, onClose, o
 	};
 
 	const handleOk = () => {
-		const selectedVideos = videoListAll.filter(video => selectedVideoIds.has(video.videoId));
-		onOk(selectedVideos);
+		const _selectedVideos = videoListAll.filter(video => selectedVideoIds.has(video.videoId));
+		onOk(_selectedVideos);
 		onClose();
 	};
 
@@ -177,13 +182,13 @@ const VideoSelectModal: React.FC<VideoSelectModalProps> = ({ visible, onClose, o
 							>
 								<div className="p-3">
 									<Text type="secondary" className="text-xs">票圈 | 3亿人喜欢的视频平台</Text>
-									<Text className="block mt-1 mb-2 leading-tight line-clamp-2" title={video.title}>{video.title}</Text>
+									<Text className="block mt-1 mb-2 leading-tight line-clamp-2" title={video.customTitle || video.title}>{video.customTitle || video.title}</Text>
 								</div>
 								<div
 									className="relative h-[120px] bg-gray-200 group/thumb"
 									onClick={(e) => { e.stopPropagation(); playVideo(video); }}
 								>
-									<img src={video.cover} alt={video.title} referrerPolicy="no-referrer" className="w-full h-full object-cover" />
+									<img src={video.customCover || video.cover} alt={video.customTitle || video.title} referrerPolicy="no-referrer" className="w-full h-full object-cover" />
 									<div className="absolute inset-0 flex justify-center items-center cursor-pointer">
 										<CaretRightFilled className="!text-white text-4xl bg-black/20 rounded-full p-1 pl-2" />
 									</div>

+ 2 - 2
src/views/publishContent/weGZH/index.tsx

@@ -148,8 +148,8 @@ const WeGZHContent: React.FC = () => {
 			title: videoTitle,
 			accountId: selectedAccount ? parseInt(selectedAccount) : undefined,
 			publishStage: selectedPublisher,
-			createTimestampStart: dateRange?.[0]?.unix(),
-			createTimestampEnd: dateRange?.[1]?.unix(),
+			createTimestampStart: dateRange?.[0]?.unix() ? dateRange[0].unix() * 1000 : undefined,
+			createTimestampEnd: dateRange?.[1]?.unix() ? dateRange[1].unix() * 1000 : undefined,
 		});
 	}