From c19bb5ac1b4013aa700c0a658f20375be9703ea3 Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期一, 08 七月 2024 18:45:47 +0800
Subject: [PATCH] feat:选择学生增加全选按钮

---
 src/views/onlineStudy/file.vue |   37 +++++++++++++++++++++++--------------
 1 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/src/views/onlineStudy/file.vue b/src/views/onlineStudy/file.vue
index 3a4e60d..c8bb0b5 100644
--- a/src/views/onlineStudy/file.vue
+++ b/src/views/onlineStudy/file.vue
@@ -31,26 +31,29 @@
       </el-table-column>
       <el-table-column prop="contentType" :formatter="typeFormatter" label="鏂囦欢绫诲瀷">
       </el-table-column>
-      <el-table-column label="鏂囦欢鍐呭">
+      <el-table-column label="鏂囦欢鍐呭" width="240">
         <template slot-scope="scope">
           <video controls v-if="scope.row.contentType === 'video'" :src="'/api/files/' + scope.row.contentUrl.url"
             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" @click="checkPdf">鐐瑰嚮鏌ョ湅</el-link>
+          <el-image v-if="scope.row.contentType === 'img'" :src="'/api/files/' + scope.row.contentUrl.url"
+            class="showContent"></el-image>
+          <!-- <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'" class="showContent"
+            @click="checkPdf('/api/files/' + scope.row.contentUrl.url)">鐐瑰嚮鏌ョ湅</el-link>
         </template>
       </el-table-column>
       <el-table-column prop="attachment" label="闄勪欢">
         <template slot-scope="scope">
-          <el-link type="primary" v-for="item in scope.row.attachment">{{ item.name }}</el-link>
+          <div v-for="item in scope.row.attachment" :key="item.url">
+            <el-link type="primary" :href="'/api/upload/download?url=' + item.url +'&fileName=' + item.name" >{{ item.name }}</el-link>
+          </div>
         </template>
       </el-table-column>
       <el-table-column fixed="right" label="鎿嶄綔" width="140">
         <template slot-scope="scope">
           <el-button @click="handleUpdate(scope.row)" type="primary" size="small"
             style="margin-right: 5px">淇敼</el-button>
-
           <el-popconfirm :title="getTitle(scope.row.typeName)" @confirm="remove(scope.row.id)">
             <el-button slot="reference" type="danger" size="small">鍒犻櫎</el-button>
           </el-popconfirm>
@@ -96,9 +99,8 @@
     </el-dialog>
 
     <el-dialog title="PDF鏌ョ湅" :visible.sync="pdfDialog" width="80%" :before-close="closePdfDialog">
-      <vue-office-pdf :src="pdf" @rendered="rendered" />
+      <vue-office-pdf :src="pdf" @rendered="rendered" style="min-height: 400px; max-height: 800px;"/>
     </el-dialog>
-
   </div>
 </template>
 
@@ -125,7 +127,7 @@
       typeList: [],
       searchForm: {
         pageNum: 1,
-        pageSize: 10,
+        pageSize: 5,
         typeName: ''
       },
       total: 0,
@@ -157,8 +159,8 @@
     };
   },
   methods: {
-    checkPdf() {
-      this.pdf = 'http://static.shanhuxueyuan.com/test.pdf';
+    checkPdf(url) {
+      this.pdf = url;
       this.pdfDialog = true;
     },
     closePdfDialog() {
@@ -204,6 +206,7 @@
       OnlineStudyAPI.remove([id]).then(res => {
         if (res.code === 1) {
           this.$message.success('鍒犻櫎鎴愬姛');
+          this.page()
         }
       });
     },
@@ -298,8 +301,9 @@
 
 <style scoped>
 .showContent {
-  width: 200px;
-  height: 100px;
+  width: 100%;
+  min-height: 80px;
+  object-fit: contain;
 }
 
 .warp {
@@ -309,4 +313,9 @@
 .search {
   margin-top: 10px;
 }
+::v-deep .el-image__error {
+  position: absolute;
+  top: 0;
+  bottom: 0;
+}
 </style>

--
Gitblit v1.8.0