|
@@ -1,10 +1,10 @@
|
|
|
import React, { useEffect, useState } from 'react';
|
|
|
-import { Space, Table, Button, Input, Select, Tabs, message } from 'antd';
|
|
|
+import { Space, Table, Button, Input, Select, Tabs, message, Spin } from 'antd';
|
|
|
import type { TableProps } from 'antd';
|
|
|
import styles from './index.module.css';
|
|
|
import { WeComPlan, WeComPlanListResponse, WeComPlanType, WeVideoItem } from './type';
|
|
|
import request from '@src/http/index';
|
|
|
-import { 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 PlanDetailModal from './components/planDetailModal';
|
|
@@ -25,7 +25,7 @@ const WeGZHContent: React.FC = () => {
|
|
|
const [tableData, setTableData] = useState<WeComPlan[]>([]);
|
|
|
const [totalSize, setTotalSize] = useState<number>(0);
|
|
|
const [pageNum, setPageNum] = useState<number>(1);
|
|
|
-
|
|
|
+ const [isLoading, setIsLoading] = useState<boolean>(false);
|
|
|
// State for the new modal
|
|
|
const [isLinkDetailModalVisible, setIsLinkDetailModalVisible] = useState<boolean>(false);
|
|
|
const [createdVideoLinks, setCreatedVideoLinks] = useState<WeComPlan[]>([]);
|
|
@@ -89,7 +89,8 @@ const WeGZHContent: React.FC = () => {
|
|
|
{
|
|
|
title: '操作',
|
|
|
key: 'action',
|
|
|
- width: 500,
|
|
|
+ width: 550,
|
|
|
+ fixed: 'right',
|
|
|
render: (_, record) => (
|
|
|
<Space size="middle" wrap>
|
|
|
<Button type="link" onClick={() => playVideo(record)}>播放</Button>
|
|
@@ -97,11 +98,30 @@ const WeGZHContent: React.FC = () => {
|
|
|
<Button type="link" onClick={() => showQrCodeModal(record.pageUrl)}>二维码</Button>
|
|
|
<Button type="link" onClick={() => copyToClipboard(record.pageUrl)}>复制链接</Button>
|
|
|
<Button type="link" onClick={() => showDetailModal(record)}>详情</Button>
|
|
|
+ <Button type="link" onClick={() => deletePlan(record)}>删除</Button>
|
|
|
</Space>
|
|
|
),
|
|
|
},
|
|
|
];
|
|
|
|
|
|
+ const deletePlan = (record: WeComPlan) => {
|
|
|
+ setIsLoading(true);
|
|
|
+ http.post(deleteQwPlanApi, {
|
|
|
+ id: record.id,
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ message.success('删除成功');
|
|
|
+ getTableData();
|
|
|
+ } else {
|
|
|
+ message.error(res.msg || '删除失败');
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ message.error(err.msg || '删除失败');
|
|
|
+ }).finally(() => {
|
|
|
+ setIsLoading(false);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
const playVideo = (record: WeComPlan) => {
|
|
|
setEditPlanData(record);
|
|
|
setIsVideoPlayModalVisible(true);
|
|
@@ -173,7 +193,7 @@ const WeGZHContent: React.FC = () => {
|
|
|
}
|
|
|
|
|
|
return (
|
|
|
- <div>
|
|
|
+ <Spin spinning={isLoading}>
|
|
|
<div className="rounded-lg">
|
|
|
<div className="text-lg font-medium mb-3">企业微信内容库</div>
|
|
|
|
|
@@ -269,7 +289,7 @@ const WeGZHContent: React.FC = () => {
|
|
|
title={editPlanData?.title || ''}
|
|
|
/>
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ </Spin>
|
|
|
);
|
|
|
};
|
|
|
|