修改了评论的删除恢复

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);
},
/**
* 更新删除状态 @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);
},
/**
* 更新删除状态 @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);
},
/**
* 更新删除状态 @author xing
*/
updateDeleteStatus: (commentId, deleteStatus) => {
return postRequest('/userCommentExchange/updateDeleteStatus', { commentId, deleteStatus });
},
};

View File

@ -15,9 +15,9 @@
/>
</div>
</template>
<script setup>
import { VueUeditorWrap } from 'vue-ueditor-wrap'
import { computed, reactive, onMounted, ref } from 'vue'
import { useUserStore } from '/@/store/modules/system/user.js'
@ -73,7 +73,7 @@
type: String,
default: ''
},
// id
id: {
type: String,
@ -87,7 +87,7 @@
get() {
return props.modelValue || ''
},
set(value) {
emits('update:modelValue', value)
return value

View File

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

View File

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

View File

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

View File

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