Bladeren bron

文件预览动态前缀地址

秦鹏 3 jaren geleden
bovenliggende
commit
1a8bfb70fe
1 gewijzigde bestanden met toevoegingen van 7 en 3 verwijderingen
  1. 7 3
      src/views/teacher-dev/Preview.vue

+ 7 - 3
src/views/teacher-dev/Preview.vue

@@ -137,7 +137,7 @@ import pdf from "vue-pdf";
 import Confirmorder from "@/components/payment/Confirmorder";
 import Payment from "@/components/payment/Payment";
 import { updateWordPack } from "@/utils/i18n";
-import { getToken } from "@/utils/auth";
+import { getToken, getConfig } from "@/utils/auth";
 
 const Base64 = require("js-base64").Base64;
 
@@ -146,6 +146,7 @@ import {
   materialvisit,
   LearnWebSI,
   Personamaterialdetail,
+  getContentFile,
 } from "@/api/api";
 export default {
   name: "tarcer-dev-Preview",
@@ -172,6 +173,7 @@ export default {
       allList: null,
       isData: false,
       goods_detail_type: null,
+      file_preview_url: "",
     };
   },
   computed: {},
@@ -366,7 +368,7 @@ export default {
             //   originUrl + `&fullfilename=${this.attachment[0].name}`;
             // GC 找的免费的 需要后台部署  谷歌可以 火狐和edge不行
             let path =
-              `http://docpreview.utschool.cn/onlinePreview?url=` +
+              `${this.file_preview_url}/onlinePreview?url=` +
               Base64.encode(this.attachment[0].fileUrlHttps);
             this.attachment[0].newpath = path;
           }
@@ -399,7 +401,7 @@ export default {
             this.data.fileType = this.data.tag[this.data.tag.length - 1];
             this.attachment = JSON.parse(res.data.result.attachment);
             let path =
-              `http://docpreview.utschool.cn/onlinePreview?url=` +
+              `${this.file_preview_url}/onlinePreview?url=` +
               Base64.encode(this.attachment[0].fileUrlHttps);
             this.attachment[0].newpath = path;
             this.loading = false;
@@ -434,6 +436,8 @@ export default {
     },
   },
   async created() {
+    let data = JSON.parse(getConfig());
+    this.file_preview_url = data.doc_preview_service_address;
     await updateWordPack({
       word_key_list: [
         "Key5",