From b1923c31336401c972eb4837a9d9f81a34a5642a Mon Sep 17 00:00:00 2001 From: marco Date: Wed, 17 Jun 2026 21:43:35 +0800 Subject: [PATCH] =?UTF-8?q?feat(cps):=20=E7=BE=A4/=E6=B4=BB=E5=8A=A8?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=8A=A0=E5=88=A0=E9=99=A4=E6=8C=89=E9=92=AE?= =?UTF-8?q?(Popconfirm=20=E4=BA=8C=E6=AC=A1=E7=A1=AE=E8=AE=A4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 群操作列 + 删除;活动列表新增操作列含删除 - 确认弹窗说明影响(已发链接仍可用 / 淘宝活动删后落地页用默认图) Co-Authored-By: Claude Opus 4.8 --- src/app/(main)/cps/page.tsx | 59 +++++++++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 3 deletions(-) diff --git a/src/app/(main)/cps/page.tsx b/src/app/(main)/cps/page.tsx index 87e18e0..b82f8b4 100644 --- a/src/app/(main)/cps/page.tsx +++ b/src/app/(main)/cps/page.tsx @@ -12,6 +12,7 @@ import { Input, InputNumber, Modal, + Popconfirm, Select, Space, Statistic, @@ -246,6 +247,16 @@ function GroupsTab() { const [createOpen, setCreateOpen] = useState(false); const [linkGroup, setLinkGroup] = useState(null); + const delGroup = async (g: CpsGroup) => { + try { + await api.delete(`/admin/api/cps/groups/${g.id}`); + message.success('已删除群'); + reload(); + } catch (e) { + message.error(errMsg(e)); + } + }; + const columns: ColumnsType = [ { title: 'ID', dataIndex: 'id', width: 60 }, { title: '群名', dataIndex: 'name', width: 160, ellipsis: true }, @@ -268,11 +279,22 @@ function GroupsTab() { title: '操作', key: 'op', fixed: 'right', - width: 150, + width: 200, render: (_, g) => ( e.stopPropagation()}> {canManage && setLinkGroup(g)}>生成链接} {canManage && setEditing(g)}>编辑} + {canManage && ( + delGroup(g)} + > + 删除 + + )} ), }, @@ -308,7 +330,7 @@ function GroupsTab() { showTotal: (t) => `共 ${t} 个群`, onChange, }} - scroll={{ x: 1040 }} + scroll={{ x: 1090 }} /> setCreateOpen(false)} onDone={reload} /> @@ -535,6 +557,16 @@ function ActivitiesTab() { const canManage = canDo(['operator']); const [createOpen, setCreateOpen] = useState(false); + const delActivity = async (a: CpsActivity) => { + try { + await api.delete(`/admin/api/cps/activities/${a.id}`); + message.success('已删除活动'); + reload(); + } catch (e) { + message.error(errMsg(e)); + } + }; + const columns: ColumnsType = [ { title: 'ID', dataIndex: 'id', width: 60 }, { @@ -575,6 +607,27 @@ function ActivitiesTab() { render: (s: string) => {s}, }, { title: '创建时间', dataIndex: 'created_at', width: 150, render: (v: string) => formatUtcTime(v) }, + ...(canManage + ? ([ + { + title: '操作', + key: 'op', + fixed: 'right' as const, + width: 80, + render: (_: unknown, a: CpsActivity) => ( + delActivity(a)} + > + 删除 + + ), + }, + ] as ColumnsType) + : []), ]; return ( @@ -599,7 +652,7 @@ function ActivitiesTab() { showTotal: (t) => `共 ${t} 个活动`, onChange, }} - scroll={{ x: 1080 }} + scroll={{ x: 1160 }} /> setCreateOpen(false)} onDone={reload} />