|
@@ -6,6 +6,7 @@ import EditTitleCoverModal from '../editTitleCoverModal';
|
|
|
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';
|
|
|
|
|
|
const { Option } = Select;
|
|
|
const { Paragraph } = Typography;
|
|
@@ -18,17 +19,10 @@ interface AddPunlishPlanModalProps {
|
|
|
planType: GzhPlanType;
|
|
|
editPlanData?: GzhPlanDataType;
|
|
|
isSubmiting?: boolean;
|
|
|
+ videoId?: string;
|
|
|
}
|
|
|
|
|
|
-const AddPunlishPlanModal: React.FC<AddPunlishPlanModalProps> = ({
|
|
|
- visible,
|
|
|
- isSubmiting,
|
|
|
- onCancel,
|
|
|
- onOk,
|
|
|
- actionType,
|
|
|
- planType,
|
|
|
- editPlanData
|
|
|
-}) => {
|
|
|
+const AddPunlishPlanModal: React.FC<AddPunlishPlanModalProps> = ({ visible, isSubmiting, onCancel, onOk, actionType, planType, editPlanData, videoId }) => {
|
|
|
const [form] = Form.useForm();
|
|
|
const type = Form.useWatch('type', form);
|
|
|
const selectVideoType = Form.useWatch('selectVideoType', form);
|
|
@@ -36,6 +30,7 @@ const AddPunlishPlanModal: React.FC<AddPunlishPlanModalProps> = ({
|
|
|
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 { accountOptions, getAccountList } = useAccountOptions();
|
|
|
|
|
|
useEffect(() => {
|
|
@@ -60,6 +55,21 @@ const AddPunlishPlanModal: React.FC<AddPunlishPlanModalProps> = ({
|
|
|
getAccountList({accountType: planType});
|
|
|
}, [planType]);
|
|
|
|
|
|
+ // 处理videoId参数
|
|
|
+ useEffect(() => {
|
|
|
+ if (visible && videoId) {
|
|
|
+ setInitialSelectedVideoId(videoId);
|
|
|
+ setIsVideoSelectVisible(true);
|
|
|
+ }
|
|
|
+ }, [visible, videoId]);
|
|
|
+
|
|
|
+ // 重置状态
|
|
|
+ useEffect(() => {
|
|
|
+ if (!visible) {
|
|
|
+ setInitialSelectedVideoId(null);
|
|
|
+ }
|
|
|
+ }, [visible]);
|
|
|
+
|
|
|
const onTypeChange = (value: string) => {
|
|
|
form.setFieldsValue({ accountId: undefined });
|
|
|
getAccountList({ accountType: value });
|
|
@@ -308,12 +318,13 @@ const AddPunlishPlanModal: React.FC<AddPunlishPlanModalProps> = ({
|
|
|
|
|
|
{/* Video Selection Drawer */}
|
|
|
<VideoSelectModal
|
|
|
- planType={type}
|
|
|
+ planType={planType}
|
|
|
visible={isVideoSelectVisible}
|
|
|
onClose={handleVideoSelectionCancel}
|
|
|
onOk={handleVideoSelectionOk}
|
|
|
selectedVideos={selectedVideos}
|
|
|
- initialSelectedIds={selectedVideos.map(v => v.videoId)} // Pass current selection IDs
|
|
|
+ initialSelectedIds={initialSelectedVideoId ? [Number(initialSelectedVideoId)] : selectedVideos.map(v => v.videoId)}
|
|
|
+ defaultVideoLibraryType={VideoLibraryType.我的上传}
|
|
|
/>
|
|
|
|
|
|
{/* Video Player Modal */}
|