Browse Source

根据id重新获取文件url

秦鹏 3 years ago
parent
commit
c9edb4b7e2
1 changed files with 10 additions and 7 deletions
  1. 10 7
      src/views/textbook-detail/TextbookDetailPdf.vue

+ 10 - 7
src/views/textbook-detail/TextbookDetailPdf.vue

@@ -54,7 +54,7 @@ import { updateWordPack } from "@/utils/i18n";
 import { getToken, getConfig } from "@/utils/auth";
 import { Base64 } from "js-base64";
 
-import { TextbookAPI, LearnWebSI } from "@/api/ajax";
+import { TextbookAPI, LearnWebSI, getContentFile } from "@/api/ajax";
 export default {
   name: "TextbookDetailPdf",
   components: {
@@ -133,15 +133,18 @@ export default {
       })
         .then((res) => {
           this.data = res;
-          this.loading = false;
-          this.attachment =
-            `${this.file_preview_url}/onlinePreview?url=` +
-            this.$route.query.url;
+          let Mname = "file_store_manager-GetFileStoreInfo";
+          getContentFile(Mname, {
+            file_id: Base64.decode(this.$route.query.fileId),
+          }).then((res) => {
+            this.attachment =
+              `${this.file_preview_url}/onlinePreview?url=` +
+              Base64.encode(res.file_url);
+            this.loading = false;
+          });
           // this.attachment =
           //   process.env.VUE_APP_PDF_API +
           //   Base64.decode(this.$route.query.relativePath);
-          // this.getNumPages();
-          // console.log(this.attachment);
         })
         .catch((res) => {
           this.loading = false;