|
@@ -1,4 +1,5 @@
|
|
|
import React, { useEffect, useState } from 'react';
|
|
|
+import { useParams } from 'react-router-dom';
|
|
|
import { Modal, Form, Select, Button, Card, Typography, message } from 'antd';
|
|
|
import { CloseOutlined, PlusOutlined, EditOutlined, CaretRightFilled } from '@ant-design/icons';
|
|
|
import VideoSelectModal from '../videoSelectModal';
|
|
@@ -25,14 +26,23 @@ interface AddPunlishPlanModalProps {
|
|
|
const AddPunlishPlanModal: React.FC<AddPunlishPlanModalProps> = ({ visible, isSubmiting, onCancel, onOk, actionType, planType, editPlanData, videoId }) => {
|
|
|
const [form] = Form.useForm();
|
|
|
const type = Form.useWatch('type', form);
|
|
|
+ const { code } = useParams<{ code?: string }>();
|
|
|
const selectVideoType = Form.useWatch('selectVideoType', form);
|
|
|
const [selectedVideos, setSelectedVideos] = useState<VideoItem[]>([]);
|
|
|
const [isVideoSelectVisible, setIsVideoSelectVisible] = useState(false);
|
|
|
const [playingVideo, setPlayingVideo] = useState<VideoItem | null>(null); // State for video player modal
|
|
|
const [editingVideo, setEditingVideo] = useState<VideoItem | null>(null); // State for editing modal
|
|
|
const [initialSelectedVideoId, setInitialSelectedVideoId] = useState<string | null>(null); // State for initial video selection
|
|
|
+ const [videoLibraryType, setVideoLibraryType] = useState<VideoLibraryType>(VideoLibraryType.平台视频库);
|
|
|
const { accountOptions, getAccountList } = useAccountOptions();
|
|
|
|
|
|
+ // 处理code参数
|
|
|
+ useEffect(() => {
|
|
|
+ if (code) {
|
|
|
+ setVideoLibraryType(VideoLibraryType.我的上传);
|
|
|
+ }
|
|
|
+ }, [code]);
|
|
|
+
|
|
|
useEffect(() => {
|
|
|
if (actionType === 'edit') {
|
|
|
form.setFieldsValue({...editPlanData, type: editPlanData?.type.toString()});
|
|
@@ -324,7 +334,7 @@ const AddPunlishPlanModal: React.FC<AddPunlishPlanModalProps> = ({ visible, isSu
|
|
|
onOk={handleVideoSelectionOk}
|
|
|
selectedVideos={selectedVideos}
|
|
|
initialSelectedIds={initialSelectedVideoId ? [Number(initialSelectedVideoId)] : selectedVideos.map(v => v.videoId)}
|
|
|
- defaultVideoLibraryType={VideoLibraryType.我的上传}
|
|
|
+ defaultVideoLibraryType={videoLibraryType}
|
|
|
/>
|
|
|
|
|
|
{/* Video Player Modal */}
|