|
|
@@ -525,7 +525,7 @@ import {
|
|
|
unlikeComment
|
|
|
} from "@/api/modules/dynamicManagement";
|
|
|
|
|
|
-import { saveComment, commentList, getMutualAttention, addTransferCount } from "@/api/modules/newLoginApi";
|
|
|
+import { saveComment, commentList, getMutualAttention, addTransferCount, deleteDynamicsById } from "@/api/modules/newLoginApi";
|
|
|
import { uploadImg } from "@/api/modules/upload";
|
|
|
import { useUserStore } from "@/stores/modules/user";
|
|
|
|
|
|
@@ -1261,21 +1261,20 @@ const handleDeleteDynamic = async () => {
|
|
|
await ElMessageBox.confirm("确定要删除这条动态吗?删除后将无法恢复。", "删除确认", {
|
|
|
confirmButtonText: "确定删除",
|
|
|
cancelButtonText: "取消",
|
|
|
- type: "warning"
|
|
|
+ type: "warning",
|
|
|
+ confirmButtonClass: "el-button--danger"
|
|
|
+ }).then(async () => {
|
|
|
+ if (!currentDetail.value) return;
|
|
|
+ const res: any = await deleteDynamicsById({ id: currentDetail.value.id });
|
|
|
+ if (res.code === 200) {
|
|
|
+ ElMessage.success("删除成功");
|
|
|
+ detailDrawerVisible.value = false;
|
|
|
+ const index = dynamicList.value.findIndex(item => item.id === currentDetail.value?.id);
|
|
|
+ if (index > -1) {
|
|
|
+ dynamicList.value.splice(index, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
});
|
|
|
-
|
|
|
- // TODO: 集成真实接口
|
|
|
- // await deleteDynamic({ id: currentDetail.value.id });
|
|
|
-
|
|
|
- ElMessage.success("删除成功");
|
|
|
- detailDrawerVisible.value = false;
|
|
|
-
|
|
|
- // 从列表中移除
|
|
|
- const index = dynamicList.value.findIndex(item => item.id === currentDetail.value?.id);
|
|
|
- if (index > -1) {
|
|
|
- dynamicList.value.splice(index, 1);
|
|
|
- pagination.total--;
|
|
|
- }
|
|
|
} catch {
|
|
|
// 用户取消删除
|
|
|
}
|