|
@@ -1,20 +1,12 @@
|
|
|
-import React, { useState } from 'react';
|
|
|
+import React, { useEffect, useState } from 'react';
|
|
|
import { Space, Table, Button, Input, Select, DatePicker, Tabs } from 'antd';
|
|
|
import type { TableProps } from 'antd';
|
|
|
-import dayjs, { Dayjs } from 'dayjs';
|
|
|
+import { Dayjs } from 'dayjs';
|
|
|
import styles from './index.module.css';
|
|
|
import PunlishPlanModal from './components/publishPlanModal';
|
|
|
const { RangePicker } = DatePicker;
|
|
|
-
|
|
|
-export interface PlanData {
|
|
|
- // key: string;
|
|
|
- officialAccount: string;
|
|
|
- scene: string;
|
|
|
- videoCount: number;
|
|
|
- videoTitle: string;
|
|
|
- planPublishTime: string;
|
|
|
- publisher: string;
|
|
|
-}
|
|
|
+import { useAccountOptions } from '@src/views/publishContent/weGZH/hooks/useAccountOptions';
|
|
|
+import { useGzhPlanList, GzhPlanType } from '@src/views/publishContent/weGZH/hooks/useGzhPlanList';
|
|
|
|
|
|
const WeGZHContent: React.FC = () => {
|
|
|
// 状态管理
|
|
@@ -24,15 +16,18 @@ const WeGZHContent: React.FC = () => {
|
|
|
const [dateRange, setDateRange] = useState<[Dayjs | null, Dayjs | null]>();
|
|
|
const [isShowAddPunlishPlan, setIsShowAddPunlishPlan] = useState<boolean>(false);
|
|
|
const [actionType, setActionType] = useState<'add' | 'edit'>('add');
|
|
|
- const [editPlanData, setEditPlanData] = useState<PlanData>();
|
|
|
+ const [editPlanData, setEditPlanData] = useState<GzhPlanType>();
|
|
|
const [activeKey, setActiveKey] = useState<string>('1');
|
|
|
|
|
|
+ const { accountOptions } = useAccountOptions();
|
|
|
+ const { gzhPlanList, getGzhPlanList, totalSize } = useGzhPlanList();
|
|
|
+
|
|
|
// 表格列配置
|
|
|
- const columns: TableProps<PlanData>['columns'] = [
|
|
|
+ const columns: TableProps<GzhPlanType>['columns'] = [
|
|
|
{
|
|
|
title: '公众号名称',
|
|
|
- dataIndex: 'officialAccount',
|
|
|
- key: 'officialAccount',
|
|
|
+ dataIndex: 'accountName',
|
|
|
+ key: 'accountName',
|
|
|
width: 200,
|
|
|
},
|
|
|
{
|
|
@@ -49,21 +44,24 @@ const WeGZHContent: React.FC = () => {
|
|
|
},
|
|
|
{
|
|
|
title: '视频标题',
|
|
|
- dataIndex: 'videoTitle',
|
|
|
- key: 'videoTitle',
|
|
|
+ dataIndex: 'title',
|
|
|
+ key: 'title',
|
|
|
ellipsis: true,
|
|
|
},
|
|
|
{
|
|
|
title: '计划创建时间',
|
|
|
- dataIndex: 'planPublishTime',
|
|
|
- key: 'planPublishTime',
|
|
|
+ dataIndex: 'createTimestamp',
|
|
|
+ key: 'createTimestamp',
|
|
|
width: 200,
|
|
|
},
|
|
|
{
|
|
|
title: '发布方',
|
|
|
- dataIndex: 'publisher',
|
|
|
- key: 'publisher',
|
|
|
+ dataIndex: 'publishStage',
|
|
|
+ key: 'publishStage',
|
|
|
width: 120,
|
|
|
+ render: (_, record) => {
|
|
|
+ return record.publishStage === 1 ? '平台发布' : '用户发布';
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
title: '操作',
|
|
@@ -78,37 +76,24 @@ const WeGZHContent: React.FC = () => {
|
|
|
},
|
|
|
];
|
|
|
|
|
|
- const editPlan = (record: PlanData) => {
|
|
|
+ const editPlan = (record: GzhPlanType) => {
|
|
|
setEditPlanData(record);
|
|
|
setActionType('edit');
|
|
|
setIsShowAddPunlishPlan(true);
|
|
|
};
|
|
|
|
|
|
- // 模拟数据
|
|
|
- const data: PlanData[] = [
|
|
|
- {
|
|
|
- officialAccount: '小慧爱厨房',
|
|
|
- scene: '关注回复',
|
|
|
- videoCount: 3,
|
|
|
- videoTitle: '养老金最新规定,快来看看养老金最新规定,快来看看...',
|
|
|
- planPublishTime: '2024-08-13 13:32:07',
|
|
|
- publisher: '平台发布',
|
|
|
- },
|
|
|
- {
|
|
|
- officialAccount: '小阳看天下',
|
|
|
- scene: '关注回复',
|
|
|
- videoCount: 1,
|
|
|
- videoTitle: '养老金最新规定,快来看看...',
|
|
|
- planPublishTime: '2024-08-13 13:32:07',
|
|
|
- publisher: '用户发布',
|
|
|
- },
|
|
|
- ];
|
|
|
-
|
|
|
const addPunlishPlan = () => {
|
|
|
setActionType('add');
|
|
|
setIsShowAddPunlishPlan(true);
|
|
|
}
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
+ getGzhPlanList({
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ });
|
|
|
+ }, []);
|
|
|
+
|
|
|
return (
|
|
|
<div>
|
|
|
<div className="rounded-lg">
|
|
@@ -124,10 +109,7 @@ const WeGZHContent: React.FC = () => {
|
|
|
value={selectedAccount}
|
|
|
onChange={setSelectedAccount}
|
|
|
allowClear
|
|
|
- options={[
|
|
|
- { label: '小慧爱厨房', value: '小慧爱厨房' },
|
|
|
- { label: '小阳看天下', value: '小阳看天下' },
|
|
|
- ]}
|
|
|
+ options={accountOptions.map(item => ({ label: item.name, value: item.id }))}
|
|
|
/>
|
|
|
</div>
|
|
|
|
|
@@ -186,12 +168,12 @@ const WeGZHContent: React.FC = () => {
|
|
|
/>
|
|
|
{/* 表格区域 */}
|
|
|
<Table
|
|
|
- rowKey={(record) => record.officialAccount}
|
|
|
+ rowKey={(record) => record.id}
|
|
|
className={styles.antTable}
|
|
|
columns={columns}
|
|
|
- dataSource={data}
|
|
|
+ dataSource={gzhPlanList}
|
|
|
pagination={{
|
|
|
- total: data.length,
|
|
|
+ total: totalSize,
|
|
|
pageSize: 10,
|
|
|
showTotal: (total) => `共 ${total} 条`,
|
|
|
}}
|