Browse Source

Merge branch 'dev'

Soul 10 months ago
parent
commit
7fc7d11451
2 changed files with 32 additions and 13 deletions
  1. 29 10
      src/views/kms/knowledge/article/edit.vue
  2. 3 3
      src/views/kms/knowledge/article/write.vue

+ 29 - 10
src/views/kms/knowledge/article/edit.vue

@@ -27,7 +27,7 @@
                 placeholder="请选择标签分类"
               ></JSelectMultiple>
             </a-col>
-            <a-col :span="4" :offset="2">
+            <a-col :span="5" :offset="1">
               <a-button @click="addArticle">新增</a-button>
               <a-button @click="saveArticle" style="margin-left: 5px">保存</a-button>
               <a-popconfirm
@@ -73,13 +73,15 @@
                       showCount
                       :auto-size="{ minRows: 5, maxRows: 5 }"
                       style="width: 100%;margin-left: 10px"
+                      @change="change"
                     />
                   </div>
                 </a-row>
               </div>
               <div class="article-edit-title" style="margin-top:5px;margin-bottom:5px">
                 <a-row>
-                  <a-input v-model:value="title" placeholder="请输入标题"></a-input>
+                  <a-input v-model:value="title" placeholder="请输入标题" @change="change"
+                  ></a-input>
                 </a-row>
               </div>
               <div class="article-edit-content">
@@ -87,6 +89,8 @@
                   path="kms/video"
                   height="500px"
                   v-model:value="content"
+                  @change="change"
+
                 >
                 </JEditor>
               </div>
@@ -117,6 +121,7 @@ let title = ref<string>("");
 let content = ref<string>("");
 let cover = ref<string[]>([]);
 let categoryId = ref<string>("");
+let status = ref<string>("0")
 const route = useRoute();
 const articleId = ref(route.params?.articleId)
 let tags = ref<string>();
@@ -131,6 +136,10 @@ onMounted(() => {
   loadArticleData(articleId.value);
 });
 
+function change() {
+  status.value = "-1"
+}
+
 async function loadArticleData(articleId) {
   let param = {id: articleId};
   await loadArticleById(param).then(res => {
@@ -140,7 +149,7 @@ async function loadArticleData(articleId) {
     categoryId.value = res.categoryId;
     guide.value = res.guide;
     tags.value = res.tags.join(",")
-    // console.log("tags  "+tags.value+"typeof   "+typeof tags.value)
+    console.log("tags  " + tags.value + "typeof   " + typeof tags.value)
   });
 }
 
@@ -149,10 +158,14 @@ function showDraftBox() {
 }
 
 function addArticle() {
-  setTimeout(() => {
-    go("/kms/knowledge/article/write")
-    // message.success("文章发布成功!请等待管理员审核~");
-  }, 500);
+  if (status.value == "-1") {
+    message.warning("请先保存/发布填写的内容后再新增")
+  } else {
+    setTimeout(() => {
+      go("/kms/knowledge/article/write")
+      // message.success("文章发布成功!请等待管理员审核~");
+    }, 500);
+  }
 }
 
 function saveArticle() {
@@ -165,12 +178,14 @@ function saveArticle() {
     param.value.cover = cover.value;
     param.value.categoryId = categoryId.value;
     param.value.status = 0;
+    param.value.tags = tags.value?.split(",")
     saveOrUpdate(param.value, true).then(res => {
       message.success("文章保存成功!");
       articleId.value = res.id;
-      // setTimeout(() => {
-      //   go("/kms/knowledge/article/draftbox");
-      // }, 500);
+      status.value = "0";
+      setTimeout(() => {
+        go("/kms/knowledge/article/draftbox");
+      }, 500);
     });
   }
 }
@@ -185,7 +200,9 @@ function release() {
     param.value.cover = cover.value;
     param.value.categoryId = categoryId.value;
     param.value.status = 1;
+    param.value.tags = tags.value?.split(",")
     saveOrUpdate(param.value, true).then(res => {
+      status.value = "0";
       handleSave()
     });
   }
@@ -233,7 +250,9 @@ function cancel() {
     param.value.cover = cover.value;
     param.value.categoryId = categoryId.value;
     param.value.status = 1;
+    param.value.tags = tags.value?.split(",")
     saveOrUpdate(param.value, true).then(res => {
+      status.value = "0";
       setTimeout(() => {
         go("/kms/index")
         message.success("文章发布成功!请等待管理员审核~");

+ 3 - 3
src/views/kms/knowledge/article/write.vue

@@ -42,7 +42,7 @@
                 placeholder="请选择标签分类"
               ></JSelectMultiple>
             </a-col>
-            <a-col :span="4" :offset="2">
+            <a-col :span="5" :offset="1">
               <a-button @click="addArticle">新增</a-button>
               <a-button @click="saveArticle" style="margin-left: 5px">保存</a-button>
               <a-popconfirm
@@ -153,7 +153,7 @@ function change() {
 
 function addArticle() {
   if (status.value == "-1") {
-    message.warning("请先保存/提交填写的内容后再新增")
+    message.warning("请先保存/发布填写的内容后再新增")
   } else {
     reload()
   }
@@ -262,7 +262,7 @@ function validate() {
   //   message.error("请选择文章封面!");
   //   return false;
 
-  if(!tags.value){
+  if (!tags.value) {
     message.error("请选择标签分类!");
     return false;
   }