Explorar o código

[web_demo] 优化部分代码

yanxin hai 1 ano
pai
achega
9b51e6607d

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 1
src/dist/assets/index-f5a8b6ab.css


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 3 - 3
src/dist/assets/index-65d1538b.js


+ 2 - 2
src/dist/index.html

@@ -4,8 +4,8 @@
     <meta charset="UTF-8" />
     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
     <title>DocumentAI Web Demo</title>
-    <script type="module" crossorigin src="./assets/index-65d1538b.js"></script>
-    <link rel="stylesheet" href="./assets/index-f5a8b6ab.css">
+    <script type="module" crossorigin src="./assets/index-5cfe9584.js"></script>
+    <link rel="stylesheet" href="./assets/index-03ba8bbf.css">
   </head>
   <body>
     <div id="app"></div>

+ 2 - 1
src/pages/main/views/Detection/LayoutAnalysis.vue

@@ -11,7 +11,7 @@
         <h4>支持jpg, png, bmp, pdf等文件格式</h4>
       </el-row>
       <div class="common-layout">
-        <el-upload class="upload-demo" drag :before-upload="beforeUpload" multiple>
+        <el-upload class="upload-demo" drag action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15" :before-upload="beforeUpload" multiple>
           <el-icon class="el-icon--upload"><upload-filled /></el-icon>
           <div class="el-upload__text">
             Drop file here or <em>click to upload</em>
@@ -330,6 +330,7 @@ const predict = async () => {
 
   if (is_pdf.value) {
     const file: any = convertCanvasToFile(img_canvas.value, "pdf.png").then(result => {
+      console.log(result)
       data.append('image', result);
       Detection(api, data).then(res => {
         console.log(res.code)

+ 2 - 1
src/pages/main/views/ImageProcess/magicColor.vue

@@ -11,7 +11,7 @@
         <h4>支持jpg, png, bmp, pdf等文件格式</h4>
       </el-row>
       <div class="common-layout">
-        <el-upload class="upload-demo" drag :before-upload="beforeUpload" multiple>
+        <el-upload class="upload-demo" drag action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15" :before-upload="beforeUpload" multiple>
           <el-icon class="el-icon--upload"><upload-filled /></el-icon>
           <div class="el-upload__text">
             Drop file here or <em>click to upload</em>
@@ -242,6 +242,7 @@ const predict = () => {
 
   if (is_pdf.value) {
     const file: any = convertCanvasToFile(canvas.value, "pdf.png").then(result => {
+      console.log(result)
       data.append('image', result);
       IMMagicColor(api, data).then(res => {
         res_image.value.src = res.data.image

+ 2 - 1
src/pages/main/views/Recognize/ocr.vue

@@ -12,7 +12,7 @@
         <h4>支持jpg, png, bmp, pdf等文件格式</h4>
       </el-row>
       <div class="common-layout">
-        <el-upload class="upload-demo" drag :before-upload="beforeUpload" multiple>
+        <el-upload class="upload-demo" drag action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15" :before-upload="beforeUpload" multiple>
           <el-icon class="el-icon--upload"><upload-filled /></el-icon>
           <div class="el-upload__text">
             Drop file here or <em>click to upload</em>
@@ -368,6 +368,7 @@ const predict = async () => {
 
   if (is_pdf.value) {
     const file: any = convertCanvasToFile(img_canvas.value, "pdf.png").then(result => {
+      console.log(result)
       data.append('image', result);
       OcrRec(api, data).then(res => {
         console.log(res.code)

+ 5 - 2
src/pages/main/views/Recognize/tableRec.vue

@@ -12,7 +12,7 @@
         <h4>支持jpg, png, bmp, pdf等文件格式</h4>
       </el-row>
       <div class="common-layout">
-        <el-upload class="upload-demo" drag :before-upload="beforeUpload" multiple>
+        <el-upload class="upload-demo" drag action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15" :before-upload="beforeUpload" multiple>
           <el-icon class="el-icon--upload"><upload-filled /></el-icon>
           <div class="el-upload__text">
             Drop file here or <em>click to upload</em>
@@ -184,7 +184,7 @@ const predict = async () => {
   // console.log('is_pdf' + is_pdf.value)
   if (is_pdf.value) {
     const file: any = convertCanvasToFile(canvas.value, "pdf.png").then(result => {
-      // console.log(result)
+      console.log(result)
       data.append('image', result);
       TableRec(api, data).then(res => {
         console.log(api)
@@ -318,6 +318,9 @@ function getPdfImage(index: number) {
         pdf_img.value = dataURLtoBlob(canvas.value.toDataURL('images/png', 1.0))
         const showImg = document.getElementById("show-img") as HTMLImageElement;
         showImg.src = canvas.value.toDataURL('images/png', 1.0);
+        showImg.onload = () => {
+          console.log(canvas.value.toDataURL('images/png', 1.0))
+        }
       });
     })
   });

+ 15 - 14
src/pages/main/views/homePage.vue

@@ -55,20 +55,21 @@ onMounted(async () => {
         })
       }
     })
-  }
-  const model = JSON.parse(model_info.value)
-  model_num.value = model['model_num']
-  console.log(model['model_num'])
-  console.log(model['model_keys'])
-  const model_array = model['model_keys']
-  for (let i = 0; i < model_array.length; i++) {
-    model_data.value.push({
-      key: model_array[i]['model_key'],
-      type: model_array[i]['model_type'],
-      subtype: model_array[i]['model_sub_type'],
-      format: model_array[i]['model_format'],
-      version: model_array[i]['model_version'],
-    })
+  } else {
+    const model = JSON.parse(model_info.value)
+    model_num.value = model['model_num']
+    console.log(model['model_num'])
+    console.log(model['model_keys'])
+    const model_array = model['model_keys']
+    for (let i = 0; i < model_array.length; i++) {
+      model_data.value.push({
+        key: model_array[i]['model_key'],
+        type: model_array[i]['model_type'],
+        subtype: model_array[i]['model_sub_type'],
+        format: model_array[i]['model_format'],
+        version: model_array[i]['model_version'],
+      })
+    }
   }
 })
 </script>