From f7ab917bed7dd916f412d23025fa3febd7ac4bd0 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期五, 17 五月 2024 11:17:47 +0800
Subject: [PATCH] 优化

---
 src/views/onlineStudy/file.vue |   30 ++++++++++++++++++++++++------
 1 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/src/views/onlineStudy/file.vue b/src/views/onlineStudy/file.vue
index 9acc54a..f40a3eb 100644
--- a/src/views/onlineStudy/file.vue
+++ b/src/views/onlineStudy/file.vue
@@ -37,8 +37,8 @@
             class="showContent" />
           <img v-if="scope.row.contentType === 'img'" :src="'/api/files/' + scope.row.contentUrl.url"
             class="showContent" />
-          <el-link type="primary" v-if="scope.row.contentType === 'pdf'" :src="'/api/files/' + scope.row.contentUrl.url"
-            class="showContent">鐐瑰嚮鏌ョ湅</el-link>
+          <el-link type="primary" v-if="scope.row.contentType === 'pdf'"
+            class="showContent" @click="checkPdf('/api/files/' + scope.row.contentUrl.url)">鐐瑰嚮鏌ョ湅</el-link>
         </template>
       </el-table-column>
       <el-table-column prop="attachment" label="闄勪欢">
@@ -94,6 +94,11 @@
         <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>
 
@@ -102,9 +107,11 @@
 import OnlineStudyAPI from '@/api/online-study';
 import StudyTypeAPI from '@/api/study-type';
 import Upload from '@/components/UploadC';
+
+import VueOfficePdf from '@vue-office/pdf';
 export default {
   name: 'type',
-  components: { Upload, Pagination },
+  components: { Upload, Pagination, VueOfficePdf },
   computed: {
     fileContentUrl: () => {
       return this.form ? this.form.contentUrl ? [this.form.contentUrl] : [] : [];
@@ -112,17 +119,19 @@
   },
   data() {
     return {
+      pdf: '',
       dialogTitle: '娣诲姞瀛︿範鍐呭',
       ids: [],
       typeList: [],
       searchForm: {
         pageNum: 1,
-        pageSize: 10,
+        pageSize: 5,
         typeName: ''
       },
       total: 0,
       tableData: [],
       open: false,
+      pdfDialog: false,
       form: {
         contentType: 'video',
         subject: '',
@@ -148,8 +157,17 @@
     };
   },
   methods: {
+    checkPdf(url) {
+      this.pdf = url;
+      this.pdfDialog = true;
+    },
+    closePdfDialog() {
+      this.pdfDialog = false;
+    },
+    rendered() {
+
+    },
     fileChange() {
-      console.log(1111111)
       this.form.contentUrl = [];
     },
     handleSelectionChange(val) {
@@ -237,7 +255,7 @@
         contentUrl: [],
         attachment: [],
         temp: []
-      }
+      };
     },
     handleClose() {
       this.open = false;

--
Gitblit v1.8.0