xiongzhu il y a 2 ans
Parent
commit
0ce6f8d3c4
2 fichiers modifiés avec 2 ajouts et 26 suppressions
  1. 2 4
      src/components/common/OutlineEditor.vue
  2. 0 22
      src/views/page/PaperGen.vue

+ 2 - 4
src/components/common/OutlineEditor.vue

@@ -103,10 +103,8 @@ const arrange = useDebounceFn(() => {
         })
         if (node) node.title = e.textContent
     }
-    setTimeout(() => {
-        emit('update:modelValue', chapters)
-    }, 1000)
-}, 100)
+    emit('update:modelValue', chapters)
+}, 10)
 
 function update(chaptersData: any) {
     console.log('update', chaptersData)

+ 0 - 22
src/views/page/PaperGen.vue

@@ -639,32 +639,10 @@ async function genChapters() {
         //         ]
         //     }
         // ]
-        formatChapters(chapters)
-        console.log(chapters)
         model.value.chapters = chapters as any
     } catch (error: any) {
         message.error(error.message)
     }
     genChaptering.value = false
 }
-function formatChapters(chapters: any) {
-    chapters.forEach((item: any) => {
-        if (item.chapterName) {
-            item.title = item.chapterName
-        } else {
-            item.title = item.sectionName
-        }
-        if (item.sections) {
-            item.children = item.sections
-        }
-        delete item.sections
-        delete item.chapterName
-        delete item.chapterDesc
-        delete item.sectionName
-        delete item.sectionDesc
-        if (item.children) {
-            formatChapters(item.children)
-        }
-    })
-}
 </script>