修改了评论的删除恢复

This commit is contained in:
wucongxing8150 2025-08-13 19:41:16 +08:00
parent 6bd464d01d
commit 8c90152eac
8 changed files with 216 additions and 95 deletions

View File

@ -64,4 +64,11 @@ export const userCommentClinicalArticleApi = {
return postRequest('/userCommentClinicalArticle/batchDelete', idList); return postRequest('/userCommentClinicalArticle/batchDelete', idList);
}, },
/**
* 更新删除状态 @author xing
*/
updateDeleteStatus: (commentId, deleteStatus) => {
return postRequest('/userCommentClinicalArticle/updateDeleteStatus', { commentId, deleteStatus });
},
}; };

View File

@ -64,4 +64,11 @@ export const userCommentClinicalVideoApi = {
return postRequest('/userCommentClinicalVideo/batchDelete', idList); return postRequest('/userCommentClinicalVideo/batchDelete', idList);
}, },
/**
* 更新删除状态 @author xing
*/
updateDeleteStatus: (commentId, deleteStatus) => {
return postRequest('/userCommentClinicalVideo/updateDeleteStatus', { commentId, deleteStatus });
},
}; };

View File

@ -64,4 +64,11 @@ export const userCommentExchangeApi = {
return postRequest('/userCommentExchange/batchDelete', idList); return postRequest('/userCommentExchange/batchDelete', idList);
}, },
/**
* 更新删除状态 @author xing
*/
updateDeleteStatus: (commentId, deleteStatus) => {
return postRequest('/userCommentExchange/updateDeleteStatus', { commentId, deleteStatus });
},
}; };

View File

@ -18,8 +18,8 @@
<a-select-option :value="1"></a-select-option> <a-select-option :value="1"></a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
<a-form-item label="是否敏感词" class="smart-query-form-item"> <a-form-item label="删除状态" class="smart-query-form-item">
<a-select style="width: 120px" v-model:value="queryForm.isSensitive" placeholder="请选择" allowClear> <a-select style="width: 120px" v-model:value="queryForm.deleteStatus" placeholder="请选择" allowClear>
<a-select-option :value="0"></a-select-option> <a-select-option :value="0"></a-select-option>
<a-select-option :value="1"></a-select-option> <a-select-option :value="1"></a-select-option>
</a-select> </a-select>
@ -81,7 +81,21 @@
<a-button @click="updateTopStatus(record.commentId, record.isTop === 1 ? 0 : 1)" type="link"> <a-button @click="updateTopStatus(record.commentId, record.isTop === 1 ? 0 : 1)" type="link">
{{ record.isTop === 1 ? '取消置顶' : '置顶' }} {{ record.isTop === 1 ? '取消置顶' : '置顶' }}
</a-button> </a-button>
<a-button @click="onDelete(record)" danger type="link">删除</a-button> <a-button
v-if="record.deleteStatus === 0"
@click="onDelete(record)"
danger
type="link"
>
删除
</a-button>
<a-button
v-else
@click="onRestore(record)"
type="link"
>
恢复
</a-button>
</div> </div>
</template> </template>
</template> </template>
@ -176,7 +190,7 @@
const queryFormState = { const queryFormState = {
keywords: undefined, // keywords: undefined, //
isTop: undefined, // isTop: undefined, //
isSensitive: undefined, // deleteStatus: undefined, //
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
}; };
@ -281,49 +295,60 @@
} }
// ---------------------------- ---------------------------- // ---------------------------- ----------------------------
// //
function batchDelete() { function onDelete(data){
if (selectedRowKeyList.value.length === 0) {
message.warning('请选择要删除的评论');
return;
}
Modal.confirm({ Modal.confirm({
title: '批量删除', title: '提示',
content: `确定要删除选中的 ${selectedRowKeyList.value.length} 条评论吗?`, content: '确定要删除选吗?',
okText: '确定', okText: '删除',
cancelText: '取消', okType: 'danger',
onOk() { onOk() {
// API requestDelete(data);
message.success('批量删除功能待实现'); },
selectedRowKeyList.value = []; cancelText: '取消',
} onCancel() {},
}); });
} }
// //
function onDelete(record) { async function requestDelete(data){
Modal.confirm({
title: '删除评论',
content: `确定要删除这条评论吗?`,
okText: '确定',
cancelText: '取消',
onOk() {
requestDelete(record.commentId);
}
});
}
//
async function requestDelete(commentId) {
try {
SmartLoading.show(); SmartLoading.show();
await userCommentClinicalArticleApi.delete(commentId); try {
await userCommentClinicalArticleApi.updateDeleteStatus(data.commentId, 1); //
message.success('删除成功'); message.success('删除成功');
queryData(); queryData();
} catch (e) { } catch (e) {
smartSentry.captureError(e); smartSentry.captureError(e);
message.error('删除失败'); } finally {
SmartLoading.hide();
}
}
// ---------------------------- ----------------------------
//
function onRestore(data){
Modal.confirm({
title: '提示',
content: '确定要恢复该评论吗?',
okText: '恢复',
okType: 'primary',
onOk() {
requestRestore(data);
},
cancelText: '取消',
onCancel() {},
});
}
//
async function requestRestore(data){
SmartLoading.show();
try {
await userCommentClinicalArticleApi.updateDeleteStatus(data.commentId, 0); //
message.success('恢复成功');
queryData();
} catch (e) {
smartSentry.captureError(e);
} finally { } finally {
SmartLoading.hide(); SmartLoading.hide();
} }
@ -374,3 +399,4 @@
imageModalVisible.value = true; imageModalVisible.value = true;
} }
</script> </script>

View File

@ -18,8 +18,8 @@
<a-select-option :value="1"></a-select-option> <a-select-option :value="1"></a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
<a-form-item label="是否敏感词" class="smart-query-form-item"> <a-form-item label="删除状态" class="smart-query-form-item">
<a-select style="width: 120px" v-model:value="queryForm.isSensitive" placeholder="请选择" allowClear> <a-select style="width: 120px" v-model:value="queryForm.deleteStatus" placeholder="请选择" allowClear>
<a-select-option :value="0"></a-select-option> <a-select-option :value="0"></a-select-option>
<a-select-option :value="1"></a-select-option> <a-select-option :value="1"></a-select-option>
</a-select> </a-select>
@ -81,7 +81,21 @@
<a-button @click="updateTopStatus(record.commentId, record.isTop === 1 ? 0 : 1)" type="link"> <a-button @click="updateTopStatus(record.commentId, record.isTop === 1 ? 0 : 1)" type="link">
{{ record.isTop === 1 ? '取消置顶' : '置顶' }} {{ record.isTop === 1 ? '取消置顶' : '置顶' }}
</a-button> </a-button>
<a-button @click="onDelete(record)" danger type="link">删除</a-button> <a-button
v-if="record.deleteStatus === 0"
@click="onDelete(record)"
danger
type="link"
>
删除
</a-button>
<a-button
v-else
@click="onRestore(record)"
type="link"
>
恢复
</a-button>
</div> </div>
</template> </template>
</template> </template>
@ -176,7 +190,7 @@
const queryFormState = { const queryFormState = {
keywords: undefined, // keywords: undefined, //
isTop: undefined, // isTop: undefined, //
isSensitive: undefined, // deleteStatus: undefined, //
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
}; };
@ -336,29 +350,61 @@
}); });
} }
// // ---------------------------- ----------------------------
function onDelete(record) { //
function onDelete(data){
Modal.confirm({ Modal.confirm({
title: '删除评论', title: '提示',
content: `确定要删除这条评论吗?`, content: '确定要删除选吗?',
okText: '确定', okText: '删除',
cancelText: '取消', okType: 'danger',
onOk() { onOk() {
requestDelete(record.commentId); requestDelete(data);
} },
cancelText: '取消',
onCancel() {},
}); });
} }
// //
async function requestDelete(commentId) { async function requestDelete(data){
try {
SmartLoading.show(); SmartLoading.show();
await userCommentClinicalVideoApi.delete(commentId); try {
await userCommentClinicalVideoApi.updateDeleteStatus(data.commentId, 1); //
message.success('删除成功'); message.success('删除成功');
queryData(); queryData();
} catch (e) { } catch (e) {
smartSentry.captureError(e); smartSentry.captureError(e);
message.error('删除失败'); } finally {
SmartLoading.hide();
}
}
// ---------------------------- ----------------------------
//
function onRestore(data){
Modal.confirm({
title: '提示',
content: '确定要恢复该评论吗?',
okText: '恢复',
okType: 'primary',
onOk() {
requestRestore(data);
},
cancelText: '取消',
onCancel() {},
});
}
//
async function requestRestore(data){
SmartLoading.show();
try {
await userCommentClinicalVideoApi.updateDeleteStatus(data.commentId, 0); //
message.success('恢复成功');
queryData();
} catch (e) {
smartSentry.captureError(e);
} finally { } finally {
SmartLoading.hide(); SmartLoading.hide();
} }

View File

@ -18,8 +18,8 @@
<a-select-option :value="1"></a-select-option> <a-select-option :value="1"></a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
<a-form-item label="是否敏感词" class="smart-query-form-item"> <a-form-item label="删除状态" class="smart-query-form-item">
<a-select style="width: 120px" v-model:value="queryForm.isSensitive" placeholder="请选择" allowClear> <a-select style="width: 120px" v-model:value="queryForm.deleteStatus" placeholder="请选择" allowClear>
<a-select-option :value="0"></a-select-option> <a-select-option :value="0"></a-select-option>
<a-select-option :value="1"></a-select-option> <a-select-option :value="1"></a-select-option>
</a-select> </a-select>
@ -81,7 +81,21 @@
<a-button @click="updateTopStatus(record.commentId, record.isTop === 1 ? 0 : 1)" type="link"> <a-button @click="updateTopStatus(record.commentId, record.isTop === 1 ? 0 : 1)" type="link">
{{ record.isTop === 1 ? '取消置顶' : '置顶' }} {{ record.isTop === 1 ? '取消置顶' : '置顶' }}
</a-button> </a-button>
<a-button @click="onDelete(record)" danger type="link">删除</a-button> <a-button
v-if="record.deleteStatus === 0"
@click="onDelete(record)"
danger
type="link"
>
删除
</a-button>
<a-button
v-else
@click="onRestore(record)"
type="link"
>
恢复
</a-button>
</div> </div>
</template> </template>
</template> </template>
@ -176,7 +190,7 @@
const queryFormState = { const queryFormState = {
keywords: undefined, // keywords: undefined, //
isTop: undefined, // isTop: undefined, //
isSensitive: undefined, // deleteStatus: undefined, //
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
}; };
@ -194,6 +208,7 @@
// //
function resetQuery() { function resetQuery() {
let pageSize = queryForm.pageSize; let pageSize = queryForm.pageSize;
Object.assign(queryForm, queryFormState);
queryForm.pageSize = pageSize; queryForm.pageSize = pageSize;
queryData(); queryData();
} }
@ -280,49 +295,60 @@
} }
// ---------------------------- ---------------------------- // ---------------------------- ----------------------------
// //
function batchDelete() { function onDelete(data){
if (selectedRowKeyList.value.length === 0) {
message.warning('请选择要删除的评论');
return;
}
Modal.confirm({ Modal.confirm({
title: '批量删除', title: '提示',
content: `确定要删除选中的 ${selectedRowKeyList.value.length} 条评论吗?`, content: '确定要删除选吗?',
okText: '确定', okText: '删除',
cancelText: '取消', okType: 'danger',
onOk() { onOk() {
// API requestDelete(data);
message.success('批量删除功能待实现'); },
selectedRowKeyList.value = []; cancelText: '取消',
} onCancel() {},
}); });
} }
// //
function onDelete(record) { async function requestDelete(data){
Modal.confirm({
title: '删除评论',
content: `确定要删除这条评论吗?`,
okText: '确定',
cancelText: '取消',
onOk() {
requestDelete(record.commentId);
}
});
}
//
async function requestDelete(commentId) {
try {
SmartLoading.show(); SmartLoading.show();
await userCommentExchangeApi.delete(commentId); try {
await userCommentExchangeApi.updateDeleteStatus(data.commentId, 1); //
message.success('删除成功'); message.success('删除成功');
queryData(); queryData();
} catch (e) { } catch (e) {
smartSentry.captureError(e); smartSentry.captureError(e);
message.error('删除失败'); } finally {
SmartLoading.hide();
}
}
// ---------------------------- ----------------------------
//
function onRestore(data){
Modal.confirm({
title: '提示',
content: '确定要恢复该评论吗?',
okText: '恢复',
okType: 'primary',
onOk() {
requestRestore(data);
},
cancelText: '取消',
onCancel() {},
});
}
//
async function requestRestore(data){
SmartLoading.show();
try {
await userCommentExchangeApi.updateDeleteStatus(data.commentId, 0); //
message.success('恢复成功');
queryData();
} catch (e) {
smartSentry.captureError(e);
} finally { } finally {
SmartLoading.hide(); SmartLoading.hide();
} }
@ -373,3 +399,4 @@
imageModalVisible.value = true; imageModalVisible.value = true;
} }
</script> </script>

View File

@ -81,6 +81,7 @@
</a-form-item> </a-form-item>
<a-form-item> <a-form-item>
<a-checkbox v-model:checked="rememberPwd">记住密码</a-checkbox> <a-checkbox v-model:checked="rememberPwd">记住密码</a-checkbox>
<span> ( 账号admin, 密码123456)</span>
</a-form-item> </a-form-item>
<a-form-item> <a-form-item>
<div class="btn" @click="onLogin">登录</div> <div class="btn" @click="onLogin">登录</div>