From 802f9516b59f342d7aa8a734d35061a1ab910520 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期日, 03 十一月 2024 23:12:45 +0800
Subject: [PATCH] 教学资源附件查看/下载

---
 src/views/folder/index.vue |   43 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/src/views/folder/index.vue b/src/views/folder/index.vue
index 0de9890..3b6c849 100644
--- a/src/views/folder/index.vue
+++ b/src/views/folder/index.vue
@@ -111,6 +111,14 @@
                         >
                           涓嬭浇
                         </el-button>
+                        <el-button
+                            link
+                            type="primary"
+                            @click.prevent="showAttachment(scope.row.attachment)"
+                            v-if="scope.row.attachment && scope.row.attachment.length > 0"
+                        >
+                          鏌ョ湅闄勪欢
+                        </el-button>
                       </template>
                     </el-table-column>
                   </el-table>
@@ -178,6 +186,27 @@
     >
       <DocumentViewer :fileUrl="fileUrl"></DocumentViewer>
     </el-drawer> -->
+
+
+    <el-dialog
+        v-model="attachmentShow"
+        title="闄勪欢"
+        width="500"
+        :close-on-click-modal="false"
+        :before-close="handleClose"
+    >
+      <div v-for="(attachment, index) in attachmentList" :key="index">
+        <el-link type="primary" :href="'/api/upload/download?url=' + attachment.url +'&fileName=' + attachment.name">
+          {{ attachment.name }}
+        </el-link>
+      </div>
+      <div></div>
+      <template #footer>
+        <div class="dialog-footer">
+          <el-button @click="handleClose">鍙栨秷</el-button>
+        </div>
+      </template>
+    </el-dialog>
   </div>
 </template>
 
@@ -206,6 +235,7 @@
   });
 
 const time = ref(null);
+const attachmentShow = ref(false)
 
 const fileType = {
   img: {
@@ -270,6 +300,7 @@
 const searchText = ref("");
 const searchSubject = ref("");
 const searchContentType = ref("");
+const attachmentList = ref([]);
 
 const loading = ref(false);
 
@@ -297,6 +328,18 @@
 const total = ref(0);
 // const fileUrl = ref("");
 const fileViewer = ref(false);
+
+const handleClose = () => {
+  attachmentShow.value = false
+}
+
+const showAttachment = (attachmentListParam) => {
+
+  attachmentList.value = attachmentListParam
+  console.log(attachmentList.value, "ww")
+  attachmentShow.value = true
+}
+
 const checkRow = (item) => {
   // fileUrl.value = item.contentUrl.url;
   fileType[item.contentType] && fileType[item.contentType].handle(item);

--
Gitblit v1.8.0