Prechádzať zdrojové kódy

文件预览pdfurl优化

duy 4 týždňov pred
rodič
commit
f9a7f93f25
1 zmenil súbory, kde vykonal 6 pridanie a 11 odobranie
  1. 6 11
      src/views/data-fill/components/HcUpload.vue

+ 6 - 11
src/views/data-fill/components/HcUpload.vue

@@ -223,13 +223,6 @@ const handleFileChange = async (file, fileList) => {
       return (file.size !== undefined && isFileSize(file?.size, 60)) || file.size === undefined
     })
   
-    const pdfUrLArray = await getPdfUrl(fileListData.value)
-    fileListData.value.forEach((item, index) => {
-        if (item.raw && pdfUrLArray[index]) {
-          const pdfUrl = pdfUrLArray[index]['url']
-          fileListData.value[index].url = pdfUrl // 更新文件列表中的 url 字段
-        }
-      })
 
       
 }
@@ -310,11 +303,13 @@ const uploadPreview = ({ url }) => {
         window.open(url, '_blank')
     }*/
 }
-const previewUrl = (item)=>{
+const previewUrl = async (item)=>{
+    const pdfUrLArray = await getPdfUrl([item])
 
-    const { url } = item
-
-        toPdfPage(url)
+    item.url = pdfUrLArray[0]?.url || ''
+    if (item.url) {
+        toPdfPage(item.url)
+    }
 }
 const uploadRef = ref(null)