|
@@ -2,21 +2,22 @@ import React, { useEffect, useState } from 'react';
|
|
import { Space, Table, Button, Input, Select, Tabs, message, Spin, Popconfirm } from 'antd';
|
|
import { Space, Table, Button, Input, Select, Tabs, message, Spin, Popconfirm } from 'antd';
|
|
import type { TableProps } from 'antd';
|
|
import type { TableProps } from 'antd';
|
|
import styles from './index.module.css';
|
|
import styles from './index.module.css';
|
|
-import { WeComPlan, WeComPlanListResponse, WeComPlanType, WeVideoItem } from './type';
|
|
|
|
|
|
+import { AddWeComPlanParam, WeComPlan, WeComPlanListResponse, WeComPlanType } from './type';
|
|
import request from '@src/http/index';
|
|
import request from '@src/http/index';
|
|
import { deleteQwPlanApi, getQwPlanListApi, getShareQrPic, saveQwPlanApi } from "@src/http/api"
|
|
import { deleteQwPlanApi, getQwPlanListApi, getShareQrPic, saveQwPlanApi } from "@src/http/api"
|
|
-import VideoSelectModal from './components/videoSelectModal';
|
|
|
|
import LinkDetailModal from './components/linkDetailModal';
|
|
import LinkDetailModal from './components/linkDetailModal';
|
|
import PlanDetailModal from './components/planDetailModal';
|
|
import PlanDetailModal from './components/planDetailModal';
|
|
import http from '@src/http/index';
|
|
import http from '@src/http/index';
|
|
import copy from 'copy-to-clipboard';
|
|
import copy from 'copy-to-clipboard';
|
|
import VideoPlayModal from './components/videoPlayModal';
|
|
import VideoPlayModal from './components/videoPlayModal';
|
|
import modal from 'antd/es/modal';
|
|
import modal from 'antd/es/modal';
|
|
|
|
+import AddPlanModal from './components/addPlanModal';
|
|
// Define a type for the expected API response (adjust if needed based on actual API)
|
|
// Define a type for the expected API response (adjust if needed based on actual API)
|
|
const TableHeight = window.innerHeight - 380;
|
|
const TableHeight = window.innerHeight - 380;
|
|
const WeGZHContent: React.FC = () => {
|
|
const WeGZHContent: React.FC = () => {
|
|
// 状态管理
|
|
// 状态管理
|
|
const [videoTitle, setVideoTitle] = useState<string>('');
|
|
const [videoTitle, setVideoTitle] = useState<string>('');
|
|
|
|
+ const [subChannel, setSubChannel] = useState<string>('');
|
|
const [selectedPublisher, setSelectedPublisher] = useState<number>();
|
|
const [selectedPublisher, setSelectedPublisher] = useState<number>();
|
|
const [isShowAddPunlishPlan, setIsShowAddPunlishPlan] = useState<boolean>(false);
|
|
const [isShowAddPunlishPlan, setIsShowAddPunlishPlan] = useState<boolean>(false);
|
|
const [editPlanData, setEditPlanData] = useState<WeComPlan>();
|
|
const [editPlanData, setEditPlanData] = useState<WeComPlan>();
|
|
@@ -34,6 +35,7 @@ const WeGZHContent: React.FC = () => {
|
|
const [isPlanDetailModalVisible, setIsPlanDetailModalVisible] = useState<boolean>(false);
|
|
const [isPlanDetailModalVisible, setIsPlanDetailModalVisible] = useState<boolean>(false);
|
|
|
|
|
|
const [isVideoPlayModalVisible, setIsVideoPlayModalVisible] = useState<boolean>(false);
|
|
const [isVideoPlayModalVisible, setIsVideoPlayModalVisible] = useState<boolean>(false);
|
|
|
|
+ const [isAddPlanLoading, setIsAddPlanLoading] = useState<boolean>(false);
|
|
|
|
|
|
const getTableData = (_pageNum?: number) => {
|
|
const getTableData = (_pageNum?: number) => {
|
|
setPageNum(_pageNum || 1);
|
|
setPageNum(_pageNum || 1);
|
|
@@ -42,6 +44,7 @@ const WeGZHContent: React.FC = () => {
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
scene: selectedPublisher,
|
|
scene: selectedPublisher,
|
|
title: videoTitle,
|
|
title: videoTitle,
|
|
|
|
+ subChannel,
|
|
type: +activeKey,
|
|
type: +activeKey,
|
|
}
|
|
}
|
|
).then(res => {
|
|
).then(res => {
|
|
@@ -86,6 +89,12 @@ const WeGZHContent: React.FC = () => {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ {
|
|
|
|
+ title: '发布子渠道',
|
|
|
|
+ dataIndex: 'subChannel',
|
|
|
|
+ key: 'subChannel',
|
|
|
|
+ width: 120,
|
|
|
|
+ },
|
|
{
|
|
{
|
|
title: '操作',
|
|
title: '操作',
|
|
key: 'action',
|
|
key: 'action',
|
|
@@ -175,21 +184,30 @@ const WeGZHContent: React.FC = () => {
|
|
setIsShowAddPunlishPlan(true);
|
|
setIsShowAddPunlishPlan(true);
|
|
}
|
|
}
|
|
|
|
|
|
- const handleOk = (selectedVideos: WeVideoItem[]) => {
|
|
|
|
|
|
+ const handleAddPlan = (param: AddWeComPlanParam) => {
|
|
|
|
+ setIsAddPlanLoading(true);
|
|
|
|
+ const { type, subChannel, videoList } = param;
|
|
http.post<WeComPlan[]>(saveQwPlanApi, {
|
|
http.post<WeComPlan[]>(saveQwPlanApi, {
|
|
- type: +activeKey,
|
|
|
|
- videoList: selectedVideos,
|
|
|
|
- }).then(res => {
|
|
|
|
|
|
+ type,
|
|
|
|
+ subChannel,
|
|
|
|
+ videoList: videoList,
|
|
|
|
+ }).then(res => {
|
|
|
|
+ setIsAddPlanLoading(false);
|
|
if (res.code === 0) {
|
|
if (res.code === 0) {
|
|
message.success('创建成功');
|
|
message.success('创建成功');
|
|
setCreatedVideoLinks(res.data);
|
|
setCreatedVideoLinks(res.data);
|
|
setIsLinkDetailModalVisible(true);
|
|
setIsLinkDetailModalVisible(true);
|
|
setIsShowAddPunlishPlan(false);
|
|
setIsShowAddPunlishPlan(false);
|
|
- getTableData();
|
|
|
|
|
|
+ if (type !== activeKey) {
|
|
|
|
+ setActiveKey(type as WeComPlanType);
|
|
|
|
+ } else {
|
|
|
|
+ getTableData();
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
message.error(res.msg || '创建失败');
|
|
message.error(res.msg || '创建失败');
|
|
}
|
|
}
|
|
}).catch(err => {
|
|
}).catch(err => {
|
|
|
|
+ setIsAddPlanLoading(false);
|
|
message.error(err.msg || '创建失败');
|
|
message.error(err.msg || '创建失败');
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -231,6 +249,16 @@ const WeGZHContent: React.FC = () => {
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
+ <div className="flex items-center gap-2">
|
|
|
|
+ <Input
|
|
|
|
+ placeholder="请输入子渠道"
|
|
|
|
+ style={{ width: 200 }}
|
|
|
|
+ value={subChannel}
|
|
|
|
+ onChange={e => setSubChannel(e.target.value)}
|
|
|
|
+ allowClear
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+
|
|
<Button type="primary" className="ml-2" onClick={() => getTableData(1)}>搜索</Button>
|
|
<Button type="primary" className="ml-2" onClick={() => getTableData(1)}>搜索</Button>
|
|
</div>
|
|
</div>
|
|
<Tabs
|
|
<Tabs
|
|
@@ -261,16 +289,17 @@ const WeGZHContent: React.FC = () => {
|
|
onChange: (page) => getTableData(page),
|
|
onChange: (page) => getTableData(page),
|
|
}}
|
|
}}
|
|
/>
|
|
/>
|
|
- <VideoSelectModal
|
|
|
|
|
|
+ <AddPlanModal
|
|
visible={isShowAddPunlishPlan}
|
|
visible={isShowAddPunlishPlan}
|
|
|
|
+ initType={activeKey}
|
|
onClose={() => {
|
|
onClose={() => {
|
|
setIsShowAddPunlishPlan(false);
|
|
setIsShowAddPunlishPlan(false);
|
|
setEditPlanData(undefined);
|
|
setEditPlanData(undefined);
|
|
}}
|
|
}}
|
|
- onOk={handleOk}
|
|
|
|
- initialSelectedIds={editPlanData ? [editPlanData.id] : []}
|
|
|
|
- planType={activeKey}
|
|
|
|
|
|
+ onOk={handleAddPlan}
|
|
|
|
+ isLoading={isAddPlanLoading}
|
|
/>
|
|
/>
|
|
|
|
+
|
|
<LinkDetailModal
|
|
<LinkDetailModal
|
|
visible={isLinkDetailModalVisible}
|
|
visible={isLinkDetailModalVisible}
|
|
onClose={() => setIsLinkDetailModalVisible(false)}
|
|
onClose={() => setIsLinkDetailModalVisible(false)}
|