浏览代码

在线问答

1018653686@qq.com 1 年之前
父节点
当前提交
255478f211
共有 2 个文件被更改,包括 39 次插入31 次删除
  1. 2 3
      src/views/XMHJC/topic/content/index.vue
  2. 37 28
      src/views/XMHJC/topic/content/replyList.vue

+ 2 - 3
src/views/XMHJC/topic/content/index.vue

@@ -153,12 +153,12 @@ const openReplyModal = (row) => {
 
 //删除
 const prefixDel = (row) => {
-  ElMessageBox.confirm("你是否确认此主题?", "提示", {
+  ElMessageBox.confirm("你是否删除此主题?", "提示", {
     confirmButtonText: "确定",
     cancelButtonText: "取消",
     type: "warning",
   }).then(() => {
-    proxy.post("/topicContent/hasReply", { id: row.id }).then((res) => {
+    proxy.post("/topicReplies/hasReply", { topicId: row.id }).then((res) => {
       if(res){
         ElMessageBox.confirm("此主题下有回复,删除后所有回复也将一并删除,是否确认删除?", "提示", {
           confirmButtonText: "确定",
@@ -182,7 +182,6 @@ const del = (id) => {
     });
     getList();
   });
-
 }
 
 

+ 37 - 28
src/views/XMHJC/topic/content/replyList.vue

@@ -57,25 +57,25 @@ const config = computed(() => {
     {
       attrs: {
         label: "回复人",
-        prop: "dictKey",
+        prop: "authorName",
       },
     },
     {
       attrs: {
-        label: "内容",
+        label: "回复内容",
         prop: "content",
       },
     },
     {
       attrs: {
-        label: "时间",
+        label: "回复时间",
         prop: "createTime",
       },
     },
     {
       attrs: {
         label: "操作",
-        align: "right",
+        align: "center",
       },
       // 渲染 el-button,一般用在最后一列。
       renderHTML(row) {
@@ -88,25 +88,7 @@ const config = computed(() => {
               },
               el: "button",
               click() {
-                // 弹窗提示是否删除
-                ElMessageBox.confirm("此操作将删除该数据, 是否继续?", "提示", {
-                  confirmButtonText: "确定",
-                  cancelButtonText: "取消",
-                  type: "warning",
-                }).then(() => {
-                  // 删除
-                  proxy
-                    .post("/dictTenantData/delete", {
-                      id: row.id,
-                    })
-                    .then((res) => {
-                      ElMessage({
-                        message: "删除成功",
-                        type: "success",
-                      });
-                      getList();
-                    });
-                });
+                prefixDel(row);
               },
             },
           ];
@@ -144,13 +126,40 @@ const getList = async (req) => {
       }, 200);
     });
 };
+
+const prefixDel = (row) => {
+  ElMessageBox.confirm("你是否删除此回复?", "提示", {
+    confirmButtonText: "确定",
+    cancelButtonText: "取消",
+    type: "warning",
+  }).then(() => {
+    proxy.post("/topicReplies/hasFloorReply", { floorId: row.id }).then((res) => {
+      if(res){
+        ElMessageBox.confirm("此回复下有其他用户的回复,删除后所有回复也将一并删除,是否确认删除?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+        }).then(() => {
+          del(row.id)
+        });
+      }else{
+        del(row.id)
+      }
+    });
+  });
+};
+
+const del = (id) => {
+  proxy.post("/topicReplies/deleteAndChild", { id: id }).then((res) => {
+    ElMessage({
+      message: "操作成功",
+      type: "success",
+    });
+    getList();
+  });
+}
 getList();
 </script>
 
 <style lang="scss" scoped>
-.dictTenantDtl {
-}
-.tenant {
-  padding: 20px;
-}
 </style>