From b60049c4fd341d6a0d109408aa998e02528fc6d6 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期五, 17 五月 2024 14:49:48 +0800
Subject: [PATCH] pdf

---
 src/views/onlineStudy/file.vue |   15 ++-------------
 src/components/PDF.vue         |   30 ++++++++++++++++++++++++++++++
 src/router.js                  |    6 ++++++
 3 files changed, 38 insertions(+), 13 deletions(-)

diff --git a/src/components/PDF.vue b/src/components/PDF.vue
new file mode 100644
index 0000000..48635fb
--- /dev/null
+++ b/src/components/PDF.vue
@@ -0,0 +1,30 @@
+<template>
+  <div>
+    <vue-office-pdf :src="pdfUrl" @rendered="rendered" />
+  </div>
+</template>
+
+<script>
+import VueOfficePdf from '@vue-office/pdf';
+export default {
+  name: "PDF",
+  components: { VueOfficePdf },
+  data() {
+    return {
+      pdfUrl: ''
+    }
+  },
+  methods: {
+    rendered() {
+
+    },
+  },
+  mounted() {
+    this.pdfUrl = this.$route.query.pdfUrl
+  }
+}
+</script>
+
+<style scoped>
+
+</style>
diff --git a/src/router.js b/src/router.js
index 23690a2..dafb79e 100644
--- a/src/router.js
+++ b/src/router.js
@@ -113,6 +113,12 @@
         component: () => import('@/views/onlineStudy/file'),
         name: 'File',
         meta: { title: '瀛︿範鏂囦欢', noCache: true }
+      },
+      {
+        path: 'pdf/view',
+        component: () => import('@/components/PDF'),
+        name: 'PDFView',
+        meta: { title: 'PDF鏌ョ湅', noCache: true }
       }
     ]
   },
diff --git a/src/views/onlineStudy/file.vue b/src/views/onlineStudy/file.vue
index f40a3eb..609f826 100644
--- a/src/views/onlineStudy/file.vue
+++ b/src/views/onlineStudy/file.vue
@@ -94,11 +94,6 @@
         <el-button type="primary" @click="handlerSubmit">淇� 瀛�</el-button>
       </span>
     </el-dialog>
-
-    <el-dialog title="PDF鏌ョ湅" :visible.sync="pdfDialog" width="80%" :before-close="closePdfDialog">
-      <vue-office-pdf :src="pdf" @rendered="rendered" />
-    </el-dialog>
-
   </div>
 </template>
 
@@ -108,10 +103,9 @@
 import StudyTypeAPI from '@/api/study-type';
 import Upload from '@/components/UploadC';
 
-import VueOfficePdf from '@vue-office/pdf';
 export default {
   name: 'type',
-  components: { Upload, Pagination, VueOfficePdf },
+  components: { Upload, Pagination },
   computed: {
     fileContentUrl: () => {
       return this.form ? this.form.contentUrl ? [this.form.contentUrl] : [] : [];
@@ -119,7 +113,6 @@
   },
   data() {
     return {
-      pdf: '',
       dialogTitle: '娣诲姞瀛︿範鍐呭',
       ids: [],
       typeList: [],
@@ -158,14 +151,10 @@
   },
   methods: {
     checkPdf(url) {
-      this.pdf = url;
-      this.pdfDialog = true;
+      window.open('/#/online/study/pdf/view?pdfUrl=' + url, '_blank')
     },
     closePdfDialog() {
       this.pdfDialog = false;
-    },
-    rendered() {
-
     },
     fileChange() {
       this.form.contentUrl = [];

--
Gitblit v1.8.0