gjy пре 2 година
родитељ
комит
b501088410
1 измењених фајлова са 31 додато и 17 уклоњено
  1. 31 17
      src/components/WsUpload/index.vue

+ 31 - 17
src/components/WsUpload/index.vue

@@ -235,6 +235,7 @@ export default {
         companyId: this.compId,
         basePath: '', //config.getUploadPath(this.ossKey, this.compId)
       },
+
       clientFag: localStorage.getItem('ws-pf_clientFag'),
     }
   },
@@ -299,21 +300,33 @@ export default {
     //   this.tempFileList = fileList
     // },
     perview(row){
-      const typeArr = ['doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx']
-      let arr=row.url.split('.')
-      let fileType=arr[arr.length-1]
-      let url = ''
-      if (typeArr.indexOf(fileType) !== -1) {
-        // 使用微软的office online
-        url='http://view.xdocin.com/xdoc?_xdoc='+row.url
-      } else {
-        url = row.url
-      }
-      // window.open()居中打开
-      const width = 1000; const height = 800
-      const top = (window.screen.availHeight - height) / 2
-      const left = (window.screen.availWidth - width) / 2
-      window.open(url, '', 'width=' + width + ',height=' + height + ',top=' + top + ',left=' + left)
+      // const typeArr = ['doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx']
+      // let arr=row.url.split('.')
+      // let fileType=arr[arr.length-1]
+      // let url = ''
+      // if (typeArr.indexOf(fileType) !== -1) {
+      //   // 使用微软的office online
+      //   url='http://view.xdocin.com/xdoc?_xdoc='+row.url
+      // } else {
+      //   url = row.url
+      // }
+      // // window.open()居中打开
+      // const width = 1000; const height = 800
+      // const top = (window.screen.availHeight - height) / 2
+      // const left = (window.screen.availWidth - width) / 2
+      // window.open(url, '', 'width=' + width + ',height=' + height + ',top=' + top + ',left=' + left)
+            renderAsync( Blob | ArrayBuffer | Uint8Array, document.getElementById("container"), null,{
+            className: string = "docx", // 默认和文档样式类的类名/前缀
+            inWrapper: boolean = true, // 启用围绕文档内容渲染包装器
+            ignoreWidth: boolean = false, // 禁止页面渲染宽度
+            ignoreHeight: boolean = false, // 禁止页面渲染高度
+            ignoreFonts: boolean = false, // 禁止字体渲染
+            breakPages: boolean = true, // 在分页符上启用分页
+            ignoreLastRenderedPageBreak: boolean = true,//禁用lastRenderedPageBreak元素的分页
+            experimental: boolean = false, //启用实验性功能(制表符停止计算)
+            trimXmlDeclaration: boolean = true, //如果为真,xml声明将在解析之前从xml文档中删除
+            debug: boolean = false, // 启用额外的日志记录
+        });
     },
     // 获取图片文件
     _getFileImg(file) {
@@ -521,7 +534,7 @@ export default {
           this.pdfFileName = file.appendixName || file.name
           this.isShowPdf = true
           return
-        }else{
+        }else if(this.getExtName(file.name)=='docx'){
           this.perview(file)
           return
         }
@@ -621,6 +634,7 @@ export default {
     isOnlineFile(file) {
       if (file && file.name) {
         const name = this.getExtName(file.name)
+        console.log(name)
         return name === 'pdf' || name === 'tet'|| name === 'docx'
       }
       return false
@@ -668,7 +682,7 @@ export default {
       if (url.indexOf('?') >= 0) {
         url = url.substr(url.indexOf('?'))
       }
-      return url
+      return url.toLowerCase()
     },
     checkUrl(path) {
       if (path.indexOf('http://') > -1 || path.indexOf('https://') > -1) {