fix:修复提示词工坊相关功能 6
This commit is contained in:
@@ -241,7 +241,7 @@ export default function PromptWorkshop() {
|
||||
}
|
||||
};
|
||||
|
||||
// 撤回提交
|
||||
// 撤回提交(pending状态)
|
||||
const handleWithdraw = async (submissionId: string) => {
|
||||
try {
|
||||
await promptWorkshopApi.withdrawSubmission(submissionId);
|
||||
@@ -253,6 +253,27 @@ export default function PromptWorkshop() {
|
||||
}
|
||||
};
|
||||
|
||||
// 删除提交记录(已审核状态)
|
||||
const handleDeleteSubmission = async (submission: PromptSubmission) => {
|
||||
Modal.confirm({
|
||||
title: '删除提交记录',
|
||||
content: `确定要删除「${submission.name}」的提交记录吗?此操作不可恢复。`,
|
||||
okText: '删除',
|
||||
okType: 'danger',
|
||||
cancelText: '取消',
|
||||
onOk: async () => {
|
||||
try {
|
||||
await promptWorkshopApi.deleteSubmission(submission.id);
|
||||
message.success('删除成功');
|
||||
loadMySubmissions();
|
||||
} catch (error) {
|
||||
console.error('Failed to delete submission:', error);
|
||||
message.error('删除失败');
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
// 查看详情
|
||||
const handleViewDetail = async (item: PromptWorkshopItem) => {
|
||||
try {
|
||||
@@ -569,17 +590,30 @@ export default function PromptWorkshop() {
|
||||
提交时间: {sub.created_at ? new Date(sub.created_at).toLocaleDateString() : '-'}
|
||||
</div>
|
||||
|
||||
{sub.status === 'pending' && (
|
||||
<Button
|
||||
type="link"
|
||||
danger
|
||||
size="small"
|
||||
icon={<DeleteOutlined />}
|
||||
onClick={() => handleWithdraw(sub.id)}
|
||||
>
|
||||
撤回
|
||||
</Button>
|
||||
)}
|
||||
<Space>
|
||||
{sub.status === 'pending' && (
|
||||
<Button
|
||||
type="link"
|
||||
danger
|
||||
size="small"
|
||||
icon={<DeleteOutlined />}
|
||||
onClick={() => handleWithdraw(sub.id)}
|
||||
>
|
||||
撤回
|
||||
</Button>
|
||||
)}
|
||||
{sub.status !== 'pending' && (
|
||||
<Button
|
||||
type="link"
|
||||
danger
|
||||
size="small"
|
||||
icon={<DeleteOutlined />}
|
||||
onClick={() => handleDeleteSubmission(sub)}
|
||||
>
|
||||
删除记录
|
||||
</Button>
|
||||
)}
|
||||
</Space>
|
||||
</Space>
|
||||
</Card>
|
||||
</Col>
|
||||
|
||||
@@ -695,10 +695,16 @@ export const promptWorkshopApi = {
|
||||
{ params: { status } }
|
||||
),
|
||||
|
||||
// 撤回提交
|
||||
// 撤回提交(pending状态)
|
||||
withdrawSubmission: (submissionId: string) =>
|
||||
api.delete<unknown, { success: boolean; message: string }>(`/prompt-workshop/submissions/${submissionId}`),
|
||||
|
||||
// 删除提交记录(所有状态,需要 force=true)
|
||||
deleteSubmission: (submissionId: string) =>
|
||||
api.delete<unknown, { success: boolean; message: string }>(`/prompt-workshop/submissions/${submissionId}`, {
|
||||
params: { force: true }
|
||||
}),
|
||||
|
||||
// ========== 管理员 API(仅服务端模式可用) ==========
|
||||
|
||||
// 获取待审核列表
|
||||
|
||||
Reference in New Issue
Block a user