- 活动列表加"删除"(ConfirmButton→DELETE /activities/:id) - activity-form 格子数选项 [8,9],新建默认 8(原来写死只有 9) - service: deleteLotteryActivity;i18n 删除文案 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -265,5 +265,9 @@
|
||||
"tableTitle": "Draw records",
|
||||
"user": "User",
|
||||
"winOnly": "Won"
|
||||
}
|
||||
},
|
||||
"delete": "Delete",
|
||||
"deleteSuccess": "Deleted",
|
||||
"confirmDeleteActivity": "Delete this activity?",
|
||||
"confirmDeleteActivityDesc": "This permanently deletes the activity and its prizes. A running activity must be paused first. This cannot be undone."
|
||||
}
|
||||
|
||||
@@ -265,5 +265,9 @@
|
||||
"tableTitle": "抽奖记录",
|
||||
"user": "用户",
|
||||
"winOnly": "已中奖"
|
||||
}
|
||||
},
|
||||
"delete": "删除",
|
||||
"deleteSuccess": "删除成功",
|
||||
"confirmDeleteActivity": "确定删除该活动吗?",
|
||||
"confirmDeleteActivityDesc": "将永久删除该活动及其奖品。运行中的活动请先暂停。此操作不可撤销。"
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ import { useForm } from "react-hook-form";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { z } from "zod";
|
||||
|
||||
const GRID_SIZE_OPTIONS = [9] as const;
|
||||
const GRID_SIZE_OPTIONS = [8, 9] as const;
|
||||
|
||||
const getFormSchema = (t: (key: string, defaultValue: string) => string) =>
|
||||
z
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
} from "@workspace/ui/composed/pro-table/pro-table";
|
||||
import {
|
||||
createLotteryActivity,
|
||||
deleteLotteryActivity,
|
||||
getLotteryActivityList,
|
||||
pauseLotteryActivity,
|
||||
publishLotteryActivity,
|
||||
@@ -166,7 +167,31 @@ export default function Lottery() {
|
||||
variant="outline"
|
||||
>
|
||||
{t("grantChances", "Grant Chances")}
|
||||
</Button>
|
||||
</Button>,
|
||||
<ConfirmButton
|
||||
cancelText={t("cancel", "Cancel")}
|
||||
confirmText={t("delete", "Delete")}
|
||||
description={t(
|
||||
"confirmDeleteActivityDesc",
|
||||
"This permanently deletes the activity and its prizes. A running activity must be paused first. This cannot be undone."
|
||||
)}
|
||||
key="delete"
|
||||
onConfirm={async () => {
|
||||
try {
|
||||
await deleteLotteryActivity({ id: row.id });
|
||||
toast.success(t("deleteSuccess", "Deleted"));
|
||||
ref.current?.refresh();
|
||||
} catch {
|
||||
// Request layer already surfaces the error toast
|
||||
}
|
||||
}}
|
||||
title={t("confirmDeleteActivity", "Delete this activity?")}
|
||||
trigger={
|
||||
<Button size="sm" variant="destructive">
|
||||
{t("delete", "Delete")}
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
);
|
||||
return rowActions;
|
||||
},
|
||||
|
||||
@@ -391,3 +391,20 @@ export async function getLotteryDrawList(
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除抽奖活动(软删;运行中需先暂停)
|
||||
* DELETE /v1/admin/lottery/activities/:id
|
||||
*/
|
||||
export async function deleteLotteryActivity(
|
||||
body: { id: number },
|
||||
options?: { [key: string]: any }
|
||||
) {
|
||||
return request<API.Response & { data?: any }>(
|
||||
`${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/lottery/activities/${body.id}`,
|
||||
{
|
||||
method: "DELETE",
|
||||
...(options || {}),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user