jihuaqiang 1 周之前
父節點
當前提交
7304b6690c
共有 3 個文件被更改,包括 27 次插入6 次删除
  1. 1 0
      src/http/api.ts
  2. 1 0
      src/views/publishContent/weCom/index.tsx
  3. 25 6
      src/views/publishContent/weGZH/index.tsx

+ 1 - 0
src/http/api.ts

@@ -28,6 +28,7 @@ export const getGzhAccountOptionsApi = `${import.meta.env.VITE_API_URL}/contentP
 export const getGzhContentTypeApi = `${import.meta.env.VITE_API_URL}/contentPlatform/cooperateAccount/gzh/getContentType`
 export const getGzhPlanListApi = `${import.meta.env.VITE_API_URL}/contentPlatform/plan/gzh/list`
 export const saveGzhPlanApi = `${import.meta.env.VITE_API_URL}/contentPlatform/plan/gzh/save`
+export const deleteGzhPlanApi = `${import.meta.env.VITE_API_URL}/contentPlatform/plan/gzh/delete`
 export const getQwPlanListApi = `${import.meta.env.VITE_API_URL}/contentPlatform/plan/qw/list`
 export const saveQwPlanApi = `${import.meta.env.VITE_API_URL}/contentPlatform/plan/qw/save`
 export const getVideoContentCategoryListApi = `${import.meta.env.VITE_API_URL}/contentPlatform/plan/videoContentCategoryList`

+ 1 - 0
src/views/publishContent/weCom/index.tsx

@@ -187,6 +187,7 @@ const WeGZHContent: React.FC = () => {
 							style={{ width: 200 }}
 							value={videoTitle}
 							allowClear
+							onPressEnter={() => getTableData(1)}
 							onChange={e => setVideoTitle(e.target.value)}
 						/>
 					</div>

+ 25 - 6
src/views/publishContent/weGZH/index.tsx

@@ -1,5 +1,5 @@
 import React, { useEffect, useState } from 'react';
-import { Space, Table, Button, Input, Select, DatePicker, Tabs, message } from 'antd';
+import { Space, Table, Button, Input, Select, DatePicker, Tabs, message, Typography } from 'antd';
 import type { TableProps } from 'antd';
 import dayjs, { Dayjs } from 'dayjs';
 import styles from './index.module.css';
@@ -8,7 +8,7 @@ const { RangePicker } = DatePicker;
 import { useAccountOptions } from '@src/views/publishContent/weGZH/hooks/useAccountOptions';
 import { useGzhPlanList, GzhPlanType } from '@src/views/publishContent/weGZH/hooks/useGzhPlanList';
 import http from '@src/http';
-import { saveGzhPlanApi } from '@src/http/api';
+import { deleteGzhPlanApi, saveGzhPlanApi } from '@src/http/api';
 import PunlishPlanDetailModal from './components/PunlishPlanDetailModal';
 
 const TableHeight = window.innerHeight - 380;
@@ -36,7 +36,7 @@ const WeGZHContent: React.FC = () => {
 			title: '公众号名称',
 			dataIndex: 'accountName',
 			key: 'accountName',
-			width: 200,
+			width: 160,
 		},
 		{
 			title: '场景',
@@ -51,7 +51,7 @@ const WeGZHContent: React.FC = () => {
 			title: '视频数量',
 			dataIndex: 'videoCount',
 			key: 'videoCount',
-			width: 120,
+			width: 100,
 		},
 		{
 			title: '视频标题',
@@ -60,7 +60,7 @@ const WeGZHContent: React.FC = () => {
 			ellipsis: true,
 			render: (_, record) => {
 				return record.videoList.map(video => {
-					return <div className="text-gray-600 text-sm truncate" key={video.videoId}>{video.customTitle || video.title}</div>
+					return <Typography.Paragraph  ellipsis={true} key={video.videoId}>{video.customTitle || video.title}</Typography.Paragraph>
 				})
 			}
 		},
@@ -85,16 +85,34 @@ const WeGZHContent: React.FC = () => {
 		{
 			title: '操作',
 			key: 'action',
-			width: 200,
+			fixed: 'right',
 			render: (_, record) => (
 				<Space size="middle">
 					<Button type="link" onClick={() => editPlan(record)}>编辑</Button>
 					<Button type="link" onClick={() => editPlanDetail(record)}>详情</Button>
+					<Button type="link" onClick={() => deletePlan(record)}>删除</Button>
 				</Space>
 			),
 		},
 	];
 
+	const deletePlan = async (record: GzhPlanType) => {
+		const res = await http.post(deleteGzhPlanApi, {
+			id: record.id,
+		}).catch(err => {
+			message.error(err?.msg || '删除失败');
+		})
+		if (res?.code === 0) {
+			message.success('删除成功');
+			getGzhPlanList({
+				pageNum: 1,
+				pageSize: 10,
+			});
+		} else {
+			message.error(res?.msg || '删除失败');
+		}
+	}
+
 	const editPlan = (record: GzhPlanType) => {
 		setEditPlanData(record);
 		setActionType('edit');
@@ -179,6 +197,7 @@ const WeGZHContent: React.FC = () => {
 							style={{ width: 200 }}
 							value={videoTitle}
 							allowClear
+							onPressEnter={handleSearch}
 							onChange={e => setVideoTitle(e.target.value)}
 						/>
 					</div>