diff --git a/src/api/business/user-comment-clinical-article/user-comment-clinical-article-api.js b/src/api/business/user-comment-clinical-article/user-comment-clinical-article-api.js index a40c491..b1c86b4 100644 --- a/src/api/business/user-comment-clinical-article/user-comment-clinical-article-api.js +++ b/src/api/business/user-comment-clinical-article/user-comment-clinical-article-api.js @@ -64,4 +64,11 @@ export const userCommentClinicalArticleApi = { return postRequest('/userCommentClinicalArticle/batchDelete', idList); }, + /** + * 更新删除状态 @author xing + */ + updateDeleteStatus: (commentId, deleteStatus) => { + return postRequest('/userCommentClinicalArticle/updateDeleteStatus', { commentId, deleteStatus }); + }, + }; diff --git a/src/api/business/user-comment-clinical-video/user-comment-clinical-video-api.js b/src/api/business/user-comment-clinical-video/user-comment-clinical-video-api.js index b98e340..003b549 100644 --- a/src/api/business/user-comment-clinical-video/user-comment-clinical-video-api.js +++ b/src/api/business/user-comment-clinical-video/user-comment-clinical-video-api.js @@ -64,4 +64,11 @@ export const userCommentClinicalVideoApi = { return postRequest('/userCommentClinicalVideo/batchDelete', idList); }, + /** + * 更新删除状态 @author xing + */ + updateDeleteStatus: (commentId, deleteStatus) => { + return postRequest('/userCommentClinicalVideo/updateDeleteStatus', { commentId, deleteStatus }); + }, + }; diff --git a/src/api/business/user-comment-exchange/user-comment-exchange-api.js b/src/api/business/user-comment-exchange/user-comment-exchange-api.js index f2c44a4..045d93b 100644 --- a/src/api/business/user-comment-exchange/user-comment-exchange-api.js +++ b/src/api/business/user-comment-exchange/user-comment-exchange-api.js @@ -64,4 +64,11 @@ export const userCommentExchangeApi = { return postRequest('/userCommentExchange/batchDelete', idList); }, + /** + * 更新删除状态 @author xing + */ + updateDeleteStatus: (commentId, deleteStatus) => { + return postRequest('/userCommentExchange/updateDeleteStatus', { commentId, deleteStatus }); + }, + }; diff --git a/src/components/business/ueditor.vue b/src/components/business/ueditor.vue index 0758788..5dc913c 100644 --- a/src/components/business/ueditor.vue +++ b/src/components/business/ueditor.vue @@ -15,9 +15,9 @@ /> - + + diff --git a/src/views/business/user-comment-clinical-video/user-comment-clinical-video-list.vue b/src/views/business/user-comment-clinical-video/user-comment-clinical-video-list.vue index abfcbd8..c54d73a 100644 --- a/src/views/business/user-comment-clinical-video/user-comment-clinical-video-list.vue +++ b/src/views/business/user-comment-clinical-video/user-comment-clinical-video-list.vue @@ -18,8 +18,8 @@ - - + + @@ -81,7 +81,21 @@ {{ record.isTop === 1 ? '取消置顶' : '置顶' }} - 删除 + + 删除 + + + 恢复 + @@ -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(); } diff --git a/src/views/business/user-comment-exchange/user-comment-exchange-list.vue b/src/views/business/user-comment-exchange/user-comment-exchange-list.vue index 1f2b23b..1ff692a 100644 --- a/src/views/business/user-comment-exchange/user-comment-exchange-list.vue +++ b/src/views/business/user-comment-exchange/user-comment-exchange-list.vue @@ -18,8 +18,8 @@ - - + + @@ -81,7 +81,21 @@ {{ record.isTop === 1 ? '取消置顶' : '置顶' }} - 删除 + + 删除 + + + 恢复 + @@ -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; } + diff --git a/src/views/system/login/login.vue b/src/views/system/login/login.vue index 4fb3913..0cb360d 100644 --- a/src/views/system/login/login.vue +++ b/src/views/system/login/login.vue @@ -81,6 +81,7 @@ 记住密码 + ( 账号:admin, 密码:123456)
登录