Browse Source

fix hash id

lushuncheng 6 years ago
parent
commit
cab4fc1833
1 changed files with 4 additions and 2 deletions
  1. 4 2
      components/topics/editor.vue

+ 4 - 2
components/topics/editor.vue

@@ -62,6 +62,7 @@ export default {
   data() {
     return {
       topicId: "", // 编辑
+      hashID: null,
       title: "",
       subTitle: "",
       content: "",
@@ -105,6 +106,7 @@ export default {
             this.title = topic.title;
             this.subTitle = topic.intro;
             this.content = topic.body;
+            this.hashID = topic.hash_id;
             if (this.cover_url) {
               this.fileList.push({
                 name: "cover_image",
@@ -175,7 +177,7 @@ export default {
               this.$message.success("编辑成功!");
             }
             // TODO go details
-            window.location.href = `/p/${this.topicId}.html`;
+            window.location.href = `/p/${this.hashID}.html`;
           });
       } else {
         this.$axios
@@ -189,7 +191,7 @@ export default {
               this.$message.success("发布成功!");
             }
             // TODO go details
-            window.location.href = `/p/${res.data.id}.html`;
+            window.location.href = `/p/${res.data.hash_id}.html`;
           });
       }
     },