Просмотр исходного кода

张丁 PDF文件前台直接预览

zhangding 3 лет назад
Родитель
Сommit
9f28761864
1 измененных файлов с 10 добавлено и 3 удалено
  1. 10 3
      ui/src/views/components/PlantProgList/index.vue

+ 10 - 3
ui/src/views/components/PlantProgList/index.vue

@@ -983,7 +983,6 @@ export default {
       this.ppt=false
       const formatDate =new FormData();
       formatDate.append("filepath",row.fileUrl)
-
       //调用文件预览api
       let res= this.officeConvert.pptConvertCommon(formatDate)
 
@@ -1017,8 +1016,13 @@ export default {
 
       this.pptView=false
       this.ppt=true
-
-      const formatDate =new FormData();
+      //如果是PDF等直接可以打开的就不调接口,否则调用接口
+      if(row.fileName.endsWith('pdf')){
+             this.pdf.pdfUrl = process.env.VUE_APP_BASE_API + '/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl
+              this.loadingFlash=false
+      }
+      else{
+         const formatDate =new FormData();
       formatDate.append("filepath",row.fileUrl)
 
       //调用文件预览api
@@ -1071,6 +1075,9 @@ export default {
         this.loadingFlash = false;
 
       })
+      }
+
+