浏览代码

videoItem types

jihuaqiang 1 周之前
父节点
当前提交
1cf334e681

+ 19 - 0
src/views/publishContent/types.ts

@@ -0,0 +1,19 @@
+export interface VideoItem {
+  videoId: number;
+  video: string;
+  title: string;
+  cover: string;
+  customCover?: string;
+  customCoverType?: number;
+  customTitle?: string;
+  score?: number;
+  pageUrl?: string;
+  shareCover?: string;
+  industryFissionRate?: number;
+  channelFissionRate?: number;
+  videoLibraryType?: number;
+  recommendScore?: number;
+  tags?: string[];
+  scene?: 0 | 1;
+}
+

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

@@ -20,7 +20,7 @@ import { VideoItem, VideoListResponse } from '@src/views/publishContent/weGZH/co
 import http from '@src/http';
 import { getVideoContentListApi, getUploadVideoContentListApi } from '@src/http/api';
 import { useVideoCategoryOptions } from '@src/views/publishContent/weGZH/hooks/useVideoCategoryOptions';
-import { WeComPlanType, WeVideoItem, VideoSearchPlanType } from '@src/views/publishContent/weCom/type'
+import { WeComPlanType, VideoSearchPlanType } from '@src/views/publishContent/weCom/type'
 import { enumToOptions } from '@src/utils/helper';
 import { isNil } from 'lodash';
 import { GzhPlanType } from '@src/views/publishContent/weGZH/hooks/useGzhPlanList';
@@ -36,9 +36,9 @@ interface VideoSelectModalProps {
 	planType: WeComPlanType | GzhPlanType;
 	visible: boolean;
 	onClose: () => void;
-	onOk: (selectedVideos: (VideoItem | WeVideoItem)[]) => void;
+	onOk: (selectedVideos: VideoItem[]) => void;
 	initialSelectedIds?: number[];
-	selectedVideos?: (VideoItem | WeVideoItem)[];
+	selectedVideos?: VideoItem[];
 	defaultVideoLibraryType?: VideoLibraryType;
 }
 
@@ -91,10 +91,10 @@ const VideoSelectModal: React.FC<VideoSelectModalProps> = ({ visible, onClose, o
 	const [pageSize, setPageSize] = useState(10);
 	const [total, setTotal] = useState(0);
 	const [loading, setLoading] = useState(false);
-	const [videoList, setVideoList] = useState<(WeVideoItem | VideoItem)[]>([]);
-	const [videoListAll, setVideoListAll] = useState<(WeVideoItem | VideoItem)[]>([]);
+	const [videoList, setVideoList] = useState<VideoItem[]>([]);
+	const [videoListAll, setVideoListAll] = useState<VideoItem[]>([]);
 	const [selectedVideoIds, setSelectedVideoIds] = useState<Set<number>>(new Set(initialSelectedIds));
-	const [playingVideo, setPlayingVideo] = useState<WeVideoItem | VideoItem | null>(null);
+	const [playingVideo, setPlayingVideo] = useState<VideoItem | null>(null);
 	const [videoLibraryType, setVideoLibraryType] = useState<VideoLibraryType>(defaultVideoLibraryType || VideoLibraryType.平台视频库);
 	const MAX_SELECTION = 3;
 
@@ -199,7 +199,7 @@ const VideoSelectModal: React.FC<VideoSelectModalProps> = ({ visible, onClose, o
 		onOk(uniqueSelectedVideos);
 	};
 
-	const playVideo = (video: WeVideoItem | VideoItem) => {
+const playVideo = (video: VideoItem) => {
 		setPlayingVideo(video);
 	};
 

+ 3 - 16
src/views/publishContent/weCom/type.ts

@@ -28,24 +28,11 @@ export enum VideoSearchPlanType {
 	公众号推送 = 4,
 }
 
-export interface WeVideoItem {
-	videoId: number;
-	video: string;
-	customCover?: string;
-	customCoverType?: number;
-	customTitle?: string;
-	title: string;
-	cover: string;
-	score: number,
-	scene?: 0 | 1;
-	industryFissionRate?: number;
-	channelFissionRate?: number;
-	recommendScore?: number;
-	tags?: string[];
-}
+import type { VideoItem } from '../types';
+export type WeVideoItem = VideoItem;
 
 export interface AddWeComPlanParam {
 	type: string;
 	subChannel: string;
-	videoList: WeVideoItem[];
+    videoList: VideoItem[];
 }

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

@@ -8,7 +8,6 @@ import { VideoItem } from '../types'; // Import from common types
 import { GzhPlanDataType, GzhPlanType } from '../../hooks/useGzhPlanList';
 import { useAccountOptions } from '../../hooks/useAccountOptions';
 import { VideoLibraryType } from '@src/views/publishContent/weCom/components/videoSelectModal';
-import { WeVideoItem } from '@src/views/publishContent/weCom/type';
 
 const { Option } = Select;
 const { Paragraph } = Typography;
@@ -115,7 +114,7 @@ const AddPunlishPlanModal: React.FC<AddPunlishPlanModalProps> = ({ visible, isSu
 		setIsVideoSelectVisible(true);
 	};
 
-	const handleVideoSelectionOk = (newlySelectedVideos: VideoItem[]) => {
+    const handleVideoSelectionOk = (newlySelectedVideos: VideoItem[]) => {
 		// Merge existing custom data with newly selected videos
 		const currentCustomData = new Map<number, Partial<VideoItem>>();
 		selectedVideos.forEach(v => {
@@ -124,7 +123,7 @@ const AddPunlishPlanModal: React.FC<AddPunlishPlanModalProps> = ({ visible, isSu
 			}
 		});
 
-		const mergedVideos = newlySelectedVideos.map(newVideo => {
+        const mergedVideos = newlySelectedVideos.map(newVideo => {
 			const customData = currentCustomData.get(newVideo.videoId);
 			return { ...newVideo, ...customData };
 		});

+ 2 - 18
src/views/publishContent/weGZH/components/types.ts

@@ -1,21 +1,5 @@
-export interface VideoItem {
-	cover: string,
-	shareCover?: string,
-	customCover: string,
-	customCoverType: number,
-	score: number,
-	title: string,
-	customTitle: string,
-	pageUrl: string,
-	video: string,
-	videoId: number,
-	industryFissionRate: number,
-	channelFissionRate: number,
-	videoLibraryType?: number;
-	recommendScore: number,
-	tags?: string[],
-	scene?: 0 | 1,
-} 
+import type { VideoItem } from '../../types';
+export type { VideoItem } from '../../types';
 
 export interface VideoListResponse {
 	objs: VideoItem[],