发布修改

This commit is contained in:
2026-01-12 14:46:53 +08:00
parent a2d0da5a5f
commit bba5859343
5 changed files with 114 additions and 0 deletions

View File

@@ -118,6 +118,16 @@ export const resourceApi = {
return response.data;
},
/**
* 强制发布资源(跳过敏感词校验)
* @param resourceID 资源ID
* @returns Promise<ResultDomain<Resource>>
*/
async forcePublishResource(resourceID: string): Promise<ResultDomain<Resource>> {
const response = await api.post<Resource>(`/news/resources/resource/${resourceID}/force-publish`);
return response.data;
},
/**
* 下架资源
* @param resourceID 资源ID

View File

@@ -52,6 +52,14 @@
>
{{ getActionButtonText(row.status) }}
</el-button>
<el-button
v-if="row.status === ResourceStatus.SENSITIVE_FAILED"
size="small"
type="warning"
@click="forcePublishArticle(row)"
>
强制发布
</el-button>
<el-button size="small" @click="editArticle(row)">编辑</el-button>
<el-button
size="small"
@@ -225,6 +233,32 @@ async function changeArticleStatus(row: Resource) {
}
}
async function forcePublishArticle(row: Resource) {
try {
await ElMessageBox.confirm(
`确定要强制发布文章「${row.title}」吗?此操作将跳过敏感词校验。`,
'强制发布确认',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}
);
const res = await resourceApi.forcePublishResource(row.resourceID!);
if (res.success) {
ElMessage.success('强制发布成功');
loadArticles();
} else {
ElMessage.error(res.message || '强制发布失败');
}
} catch (error) {
if (error !== 'cancel') {
console.error('强制发布失败:', error);
ElMessage.error('强制发布失败');
}
}
}
function handleEditFromView() {
if (currentArticle.value?.resourceID) {
showViewDialog.value = false;