Browse Source

kkFileView 在线预览功能 谷歌可以 火狐和edge不行

秦鹏 3 years ago
parent
commit
2b07636515
1 changed files with 18 additions and 12 deletions
  1. 18 12
      src/views/teacher-dev/Preview.vue

+ 18 - 12
src/views/teacher-dev/Preview.vue

@@ -52,13 +52,19 @@
       </div>
       <div :class="data.isPurchased || Ispreview ? 'buy' : 'NObuy'">
         <!--fileUrl需要改成安全地址 file_url_https -->
-        <!-- <iframe
+        <iframe
           :src="attachment[0].newpath"
           width="100%"
           height="1000px"
           id="ifm"
-        ></iframe> -->
-        <iframe
+        ></iframe>
+        <!-- <object
+          type="text/html"
+          height="1000px"
+          width="100%"
+          :data="attachment[0].newpath"
+        ></object> -->
+        <!-- <iframe
           v-if="
             attachment[0].fileType != 'pdf' && attachment[0].fileType != 'PDF'
           "
@@ -76,8 +82,8 @@
           v-else
           :src="'./pdf/web/viewer.html?file=' + attachment[0].fileRelativePath"
           style="width: 100%; height: 1000px"
-        ></iframe>
-        <pdf
+        ></iframe> -->
+        <!-- <pdf
           v-else
           ref="pdf"
           :src="attachment[0].fileRelativePath"
@@ -86,7 +92,7 @@
           :page="i"
         >
           {{ i / numPages }}
-        </pdf>
+        </pdf> -->
       </div>
       <div v-if="!data.isPurchased && !Ispreview" @click="buy" class="buyBtn">
         <!-- 点击购买 -->{{ $t("Key574") }}
@@ -358,12 +364,12 @@ export default {
             // var originUrl = `${this.attachment[0].fileUrlHttps}?fileId=${this.attachment[0].fileId}`; //要预览文件的访问地址
             // var previewUrl =
             //   originUrl + `&fullfilename=${this.attachment[0].name}`;
-            // GC 找的免费的 需要后台部署
-            // let path =
-            //   `http://127.0.0.1:8012/onlinePreview?url=` +
-            //   encodeURIComponent(this.attachment[0].fileUrlHttps);
-            // console.log(path);
-            // this.attachment[0].newpath = path;
+            // GC 找的免费的 需要后台部署  谷歌可以 火狐和edge不行
+            let path =
+              `http://docpreview.utschool.cn/onlinePreview?url=` +
+              Base64.encode(this.attachment[0].fileUrlHttps);
+            this.attachment[0].newpath = path;
+            // window.open(this.attachment[0].newpath);
           }
         })
         .catch((res) => {