liyongli il y a 1 an
Parent
commit
cfd1f88cf8

+ 17 - 15
src/view/allMedia/AIeditor/components/review.vue

@@ -88,7 +88,7 @@
 
 <script setup>
 // 校阅
-import { ref, defineProps, defineExpose } from 'vue';
+import { ref, defineProps, defineExpose, nextTick } from 'vue';
 import { checkContent } from '@/api/aleditor.js';
 import { image_base64 } from './data';
 import jy from '@/assets/img/jy.png';
@@ -147,22 +147,9 @@ const selectList = i => {
   const index = !i && i !== 0 ? select.value : i;
   select.value = index;
   let l = [];
-  props.setisupText(true);
   for (let o = 0; o < li.length; o++) {
-    if (index === 0) l.push(li[o]);
-    else if (li[o].errorType === index) l.push(li[o]);
-
-    let html = props.html();
-    const rex = new RegExp(li[o].sourceText);
-    html.replace(
-      rex,
-      `<span style="border-bottom: 1px solid ${
-        err_text.value[li[o].errorType].color
-      }">${li[o].sourceText}</span>`
-    );
-    props.setHtml(html);
+    if (index === 0 || li[o].errorType === index) l.push(li[o]);
   }
-  props.setisupText(false);
   return l;
 };
 
@@ -182,6 +169,21 @@ const jiaoyue = () => {
       if (r.errCode !== 0) return;
       li = r.alerts || [];
       is_status.value = li.length ? 'show' : 'none';
+      props.setisupText(true);
+      let html = props.html();
+      for (let o = 0; o < li.length; o++) {
+        const rex = new RegExp(li[o].sourceText);
+        html.replace(
+          rex,
+          `<span style="border-bottom: 1px solid ${
+            err_text.value[li[o].errorType].color
+          }">${li[o].sourceText}</span>`
+        );
+      }
+      props.setHtml(html);
+      nextTick(()=>{
+        props.setisupText(false);
+      })
     })
     .catch(() => {
       is_status.value = 'none';

+ 13 - 17
src/view/allMedia/AIeditor/index.vue

@@ -156,11 +156,7 @@
                   editorRef.setHtml(html);
                 }
               "
-              :setisupText="
-                bool => {
-                  isupText = bool;
-                }
-              "
+              :setisupText="bool => (isupText = bool)"
               :html="() => editorRef.getHtml()"
               :text="() => editorRef.getText()"
               :is="component_list[select_right_btn_type]"
@@ -231,7 +227,7 @@ import '@wangeditor/editor/dist/css/style.css'; // 引入 css
 import { onBeforeUnmount, ref, shallowRef, onMounted } from 'vue';
 import { Editor, Toolbar } from '@wangeditor/editor-for-vue';
 import { advertisement, generate_pc_get, getSID } from '@/api/aleditor.js';
-import { Boot } from '@wangeditor/editor'
+import { Boot } from '@wangeditor/editor';
 // 右侧一级组件
 import pen_ink from './components/pen_ink.vue';
 import review from './components/review.vue';
@@ -256,14 +252,14 @@ import poetry from './components/poetry.vue';
 import novel from './components/novel.vue';
 import composition from './components/composition.vue';
 import continuation from './components/continuation.vue';
-import ClearMenu from "./components/clearMenu";
+import ClearMenu from './components/clearMenu';
 
 const menu = {
-    key:'clear',
-    factory(){
-        return new ClearMenu();
-    }
-}
+  key: 'clear',
+  factory() {
+    return new ClearMenu();
+  },
+};
 Boot.registerMenu(menu);
 // 右侧头部数据
 const right_head = ref({});
@@ -360,7 +356,7 @@ const select_right_btn_list = ref([
 
 onMounted(() => {});
 
-let isupText = false;
+let isupText = ref(false);
 const statusPage = ref([false, true]); // 0 --> 目录  1 --> operate
 const load = ref(false);
 const toolShow = ref(true);
@@ -402,7 +398,7 @@ const toolbarConfig = {
     'headerSelect',
     'bulletedList',
     'numberedList',
-    'clear'
+    'clear',
   ],
 };
 const editorConfig = {
@@ -420,7 +416,7 @@ const editorConfig = {
 };
 
 const contentChange = () => {
-  if (isupText) return;
+  if (isupText.value) return;
   try {
     if (!window.getSelection()) return;
     const s = window.getSelection().getRangeAt(0);
@@ -503,7 +499,7 @@ const setHtml = html => {
   let list = html.split('');
   if (isEm) ot = '';
   let h = '';
-  isupText = true;
+  isupText.value = true;
   let t = setInterval(() => {
     if (list[0] === '<' && list[1] === '/') {
       let isNext = true;
@@ -523,7 +519,7 @@ const setHtml = html => {
 
     editorRef.value.setHtml(ot + '<p>' + h + '</p>');
     if (!list.length) {
-      isupText = false;
+      isupText.value = false;
       load.value = false;
       clearInterval(t);
     }