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

Merge branch 'master' of http://221.216.211.14:3000/GCLS/GCLS_Page_Book

gcj 3 лет назад
Родитель
Сommit
8732577b92
5 измененных файлов с 51 добавлено и 32 удалено
  1. BIN
      public/favicon.ico
  2. BIN
      public/favicon1.ico
  3. 8 9
      public/index.html
  4. 18 13
      src/settings.js
  5. 25 10
      src/views/textbook-detail/TextbookDetailPdf.vue

BIN
public/favicon.ico


BIN
public/favicon1.ico


+ 8 - 9
public/index.html

@@ -2,21 +2,20 @@
 <html>
 
 <head>
-  <meta charset="utf-8">
-  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
-  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
-  <link rel="icon" href="<%= BASE_URL %>favicon.ico">
-  <title>
-    <%= webpackConfig.name %>
-  </title>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
+    <title>
+        <%= webpackConfig.name %>
+    </title>
 </head>
 
 <body>
-  <noscript>
+    <noscript>
     <strong>We're sorry but <%= webpackConfig.name %> doesn't work properly without JavaScript enabled. Please enable it
         to continue.</strong>
   </noscript>
-  <div id="app"></div>
+    <div id="app"></div>
 </body>
 
 </html>

+ 18 - 13
src/settings.js

@@ -3,22 +3,27 @@ console.log(Cookies);
 let title = ''
 let config = Cookies.get('GCLS_Config')
 if (config) {
-  let configObj = JSON.parse(config);
-  title = configObj.title
+    let configObj = JSON.parse(config);
+    title = configObj.title
+    var link = document.querySelector("link[rel*='icon']") || document.createElement('link');
+    link.type = 'image/x-icon';
+    link.rel = 'shortcut icon';
+    link.href = configObj.title_icon_url;
+    document.getElementsByTagName('head')[0].appendChild(link);
 }
 console.log(title);
 module.exports = {
-  title: title,
+    title: title,
 
-  /**
-   * @type {boolean} true | false
-   * @description Whether fix the header
-   */
-  fixedHeader: false,
+    /**
+     * @type {boolean} true | false
+     * @description Whether fix the header
+     */
+    fixedHeader: false,
 
-  /**
-   * @type {boolean} true | false
-   * @description Whether show the logo in sidebar
-   */
-  sidebarLogo: false
+    /**
+     * @type {boolean} true | false
+     * @description Whether show the logo in sidebar
+     */
+    sidebarLogo: false
 }

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

@@ -26,7 +26,13 @@
         </div>
       </div>
       <div v-if="attachment" class="pdf-box">
-        <pdf
+        <iframe
+          :src="attachment"
+          width="100%"
+          height="1000px"
+          id="ifm"
+        ></iframe>
+        <!-- <pdf
           ref="pdf"
           :src="attachment"
           v-for="i in numPages"
@@ -34,7 +40,7 @@
           :page="i"
         >
           {{ i / numPages }}
-        </pdf>
+        </pdf> -->
       </div>
     </div>
   </div>
@@ -45,10 +51,10 @@ import Header from "@/components/inputModules/common/Header";
 import HeaderOne from "@/components/inputModules/common/HeaderOne";
 import pdf from "vue-pdf";
 import { updateWordPack } from "@/utils/i18n";
-import { getToken } from "@/utils/auth";
+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: {
@@ -71,6 +77,7 @@ export default {
       IsDownload: false, //是否可以下载
       allList: null,
       isData: false,
+      file_preview_url: "",
     };
   },
   computed: {},
@@ -126,12 +133,18 @@ export default {
       })
         .then((res) => {
           this.data = res;
-          this.loading = false;
-          this.attachment =
-            process.env.VUE_APP_PDF_API +
-            Base64.decode(this.$route.query.relativePath);
-          this.getNumPages();
-          console.log(this.attachment);
+          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);
         })
         .catch((res) => {
           this.loading = false;
@@ -139,6 +152,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",