liyongli 1 éve
szülő
commit
86722b6610

+ 172 - 28
src/view/allMedia/AIeditor/components/review.vue

@@ -18,22 +18,24 @@
   <template v-if="is_status === 'show'">
     <div class="show">
       <div class="left">
-        <el-card>
+        <el-card v-for="(item, i) in list" :key="i">
           <p
             class="list"
             style="font-size: 12px; font-weight: 400; color: #888"
           >
-            字词错误
+            {{ err_text[item.errorType].text }}
+            {{ err_text[item.errorType].sub_text }}
           </p>
           <p class="list">
-            
+            <span  v-text="item.sourceText"></span>
             <span
               class="alert-go-right"
+              v-if="item.replaceText"
               :style="{ backgroundImage: 'url(' + image_base64.right + ')' }"
             ></span>
-            <span class="replaceText"></span>
+            <span v-if="item.replaceText" class="replaceText" v-text="item.replaceText"></span>
           </p>
-          <p class="list">建议用“<b>要</b>”替换“<b>饭</b>”。</p>
+          <div class="list" v-html="item.alertMessage"></div>
         </el-card>
       </div>
       <div class="right">2</div>
@@ -43,34 +45,176 @@
 
 <script setup>
 // 校阅
-import { ref, defineProps } from 'vue';
-import { checkContent } from '@/api/aleditor.js';
+import { ref } from 'vue';
+// import { checkContent } from '@/api/aleditor.js';
 import { image_base64 } from './data';
 import jy from '@/assets/img/jy.png';
 const is_status = ref('show');
-const props = defineProps({
-    headTitle: String,
-    body: String,
-    bodyText: String
-})
-const jiaoyue = () => {
-  //   is_status.value = 'load';
-  checkContent({
-    data: {
-      content: props.body,
-      contentText: props.bodyText,
-      // cursorPosition: 42,
-      // docId: '8344800447857377280',
-      // generationInfo: null,
-      // shouldGenerate: false,
+// const props = defineProps({
+//   headTitle: String,
+//   html: Function,
+//   text: Function,
+// });
+const list = ref([]);
+const err_text = ref([
+    {
+        text: '所有提示',
+        sub_text: '',
+        color: '#ff7a7a'
+    },
+    {
+        text: '字词错误',
+        sub_text: '',
+        color: '#ff7a7a'
+    },
+    {
+        text: '标点错误',
+        sub_text: '',
+        color: '#aaaaaa'
+    },
+    {
+        text: '语序问题',
+        sub_text: '·建议交换为',
+        color: '#977aff'
     },
-  })
-    .then(r => {
+    {
+        text: '语法问题',
+        sub_text: '',
+        color: '#ee6bbb'
+    },
+    {
+        text: '敏感词',
+        sub_text: '',
+        color: '#636363'
+    },
+])
+
+const jiaoyue = () => {
+  is_status.value = 'load';
+//   checkContent({
+//     data: {
+//       content: props.html(),
+//       contentText: props.text(),
+//       docId: localStorage.getItem('fileId') || undefined,
+//       generationInfo: null,
+//       shouldGenerate: false,
+//     },
+//     noload: true,
+//   })
+//     .then(r => {
+      let r = {
+        errCode: 0,
+        errMsg: '',
+        data: {
+          sid: null,
+          domain: null,
+          result: null,
+        },
+        docId: '8347703226129424384',
+        paragraphUnitEntity: {
+          paragraphUnitId: '8347703226146201600',
+          updateTime: '2023-05-19T00:55:55.206+00:00',
+          paragraphMd5: null,
+          formatting: null,
+          segmentIndex: 1,
+          docId: '8347703226129424384',
+          source: '',
+          target: '<p>饭吃了没;有</p><p> </p>',
+          targetFromMemory: null,
+          memoryLibraryItemId: null,
+          ensure: null,
+          marked: null,
+          sharedStringId: null,
+          hide: 0,
+          confirmUsers: null,
+          savedCounter: 1,
+          operateUserId: null,
+          sortIndex: 1,
+          words: '["饭","吃","了","没",";","有"]',
+          tags: '["n","v","y","v","wf","vyou"]',
+          lastCheckTextContent: '饭吃了没;有\n ',
+          newestTextContent: '饭吃了没;有\n ',
+          entityId: '8347703226146201600',
+        },
+        saveStatus: null,
+        alerts: [
+          {
+            id: '8347725246119264256',
+            updateTime: '2023-05-19T02:23:25.176+00:00',
+            docId: '8347703226129424384',
+            alertType: 4,
+            alertMessage:
+              '<div class="des_div"><p class="des_p">建议用“<b>没有;</b>”替换“<b>没;有</b>”。</p></div>',
+            sourceText: '没;有',
+            replaceText: '没有;',
+            start: 3,
+            end: 5,
+            errorType: 3,
+            explanation: null,
+            sourceInZdic: false,
+            checkType: 0,
+            errorSourceType: 0,
+            permissionTags: '["0","1"]',
+            subTitle: null,
+            advancedTip: false,
+            paid: false,
+          },
+        ],
+        checkFinished: true,
+        docWordCountLimitExceed: false,
+        dayCheckLimitExceed: false,
+        todayCheckWordCount: 29,
+        readability: 0.23,
+        totalWord: 6,
+        teamActive: false,
+        checkEachLimit: '30000',
+        checkDailyLimit: '8000',
+        dayTeamCheckLimitExceed: false,
+        teamTotalCheckLimitExceed: false,
+        product: {
+          id: 1,
+          productType: 0,
+          recommend: 0,
+          productDesc: '立即体验智能纠错',
+          originPriceYear: 0,
+          priceYear: 0,
+          status: 0,
+          duration: null,
+          originPriceMonth: null,
+          originPriceHalfYear: null,
+          originPriceSeason: null,
+          priceMonth: null,
+          productId: null,
+          productName: '免费版',
+          monthProductId: null,
+          singleMonthProductId: null,
+          seasonProductId: null,
+          halfYearProductId: null,
+          checkEachLimit: 30000,
+          checkDailyLimit: 8000,
+          translationEachLimit: 2000,
+          translationDailyLimit: 2000,
+          rewriteEachLimit: 4000,
+          rewriteDailyLimit: 8000,
+          textToSpeechEachLimit: 1000,
+          textToSpeechDailyLimit: 1000,
+          advancedRewriteLimit: null,
+          generateWordCountMonthLimit: null,
+          generateWordCountTotalLimit: null,
+          generateWordTimesDailyLimit: null,
+          dialogDailyLimit: null,
+        },
+        superUser: false,
+        tooFarFromUpdateTime: true,
+      };
+      if (r.errCode !== 0) return;
       console.log(r);
-    })
-    .catch(() => {
-      // is_status.value = 'none'
-    });
+      list.value = r.alerts || [];
+      is_status.value = list.value.length ? 'show' : 'none';
+    // })
+    // .catch(() => {
+    //   is_status.value = 'none';
+    // });
 };
 jiaoyue();
 </script>

+ 5 - 2
src/view/allMedia/AIeditor/index.vue

@@ -134,7 +134,10 @@
             <component
               @saveData="saveData"
               @closeType="closeType"
-              :is="componment_list[select_right_btn_type]"
+              :headTitle="titleh1"
+              :html="() => editorRef.getHtml()"
+              :text="() => editorRef.getText()"
+              :is="component_list[select_right_btn_type]"
             ></component>
           </div>
         </Transition>
@@ -232,7 +235,7 @@ const right_head = ref({});
 
 const titleh1 = ref('');
 
-const componment_list = [pen_ink, review, image, dictionary, comment];
+const component_list = [pen_ink, review, image, dictionary, comment];
 // index对应ai里的功能
 const component_2_list = [
   full_text,