Browse Source

Merge branch 'main' of https://codehub.devcloud.cn-southwest-2.huaweicloud.com/zhcqdn00001/front

Kevin Jiang 2 years ago
parent
commit
13c63c7d23
1 changed files with 24 additions and 16 deletions
  1. 24 16
      src/views/report/components/ChapterEditor.vue

+ 24 - 16
src/views/report/components/ChapterEditor.vue

@@ -25,7 +25,7 @@ const titleEditor = ref<HTMLInputElement | null>(null);
 
 const titleEditing = ref(false);
 
-const keywordsInChapter = ref<string[]>([])
+const keywordsInChapter = ref('')
 
 const keywordsEditor = ref<HTMLInputElement | null>(null);
 
@@ -76,7 +76,7 @@ function onTitleChangeCancel() {
 }
 
 function onKeywordsChangeCancel(){ 
-  keywordsInChapter.value = props.data.keywords;
+  keywordsInChapter.value = props.data.keywords.join(",");
   keywordsEditing.value = false;
 }
 
@@ -108,7 +108,6 @@ function searchReference() {
     <a-row type="flex" justify="space-between">
       <a-col>
         <a-space>
-          <label>关键词:</label>
           <a-input
             v-if="titleEditing"
             v-model:value="fullTitle"
@@ -123,19 +122,25 @@ function searchReference() {
             <span>{{ data.fullTitle }}</span>
           </h1>
           <a-button type="text" @click="onEditTitle" class="edit-btn"><edit-outlined /></a-button>
-          <a-input
-          v-if="keywordsEditing"
-          v-model:value="keywordsInChapter"
-          @blur="onKeywordsChange"
-          @pressEnter="onKeywordsChange"
-          @keyup.esc="onKeywordsChangeCancel"
-          ref="keywordsEditor"
-          class="keywords-editor"
-          />
-          <h2 v-else-if="data.chapterType=='USER_DEFINED'">
-            关键词:<span>{{data.keywords}}</span>
-          </h2>
-          <a-button v-if="data.chapterType=='USER_DEFINED'" type="text" @click="onEditKeywords" class="edit-btn"><edit-outlined /></a-button>
+          <a-space if="data.chapterType=='USER_DEFINED'">
+            <h1>
+              <span>关键词:</span><span v-if="!keywordsEditing">{{data.keywords}}</span>
+            </h1>
+            <a-input
+              v-if="keywordsEditing"
+              v-model:value="keywordsInChapter"
+              @blur="onKeywordsChange"
+              @pressEnter="onKeywordsChange"
+              @keyup.esc="onKeywordsChangeCancel"
+              ref="keywordsEditor"
+              class="keywords-editor"
+            />    
+            <a-button 
+              type="text" 
+              @click="onEditKeywords" 
+              class="edit-btn"
+            ><edit-outlined /></a-button>
+          </a-space>
         </a-space>
       </a-col>
       <a-col>
@@ -174,6 +179,9 @@ function searchReference() {
   .title-editor {
     width: 400px;
   }
+  .keywords-editor {
+    width: 400px;
+  }
 
   .edit-btn {
     margin-left: 1em;