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 |   48 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 47 insertions(+), 1 deletions(-)

diff --git a/src/views/folder/index.vue b/src/views/folder/index.vue
index ebe262e..3b6c849 100644
--- a/src/views/folder/index.vue
+++ b/src/views/folder/index.vue
@@ -20,11 +20,13 @@
                     placeholder="璇疯緭鍏ユ悳绱㈠唴瀹�"
                     class="long-input"
                     :prefix-icon="Search"
+                    @input="searchFile"
                   />
                   <el-select
                     v-model="searchSubject"
                     placeholder="璇烽�夋嫨绉戠洰"
                     class="ml-4 long-select"
+                    @change="searchFile"
                     clearable
                   >
                     <el-option
@@ -38,6 +40,7 @@
                     v-model="searchContentType"
                     placeholder="璇烽�夋嫨鏂囦欢绫诲瀷"
                     class="ml-4 long-select"
+                    @change="searchFile"
                     clearable
                   >
                     <el-option
@@ -108,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>
@@ -175,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>
 
@@ -198,11 +230,12 @@
 const { userInfo } = storeToRefs(userStore);
 const { status, message, error, connect, disconnect, sendMessage } =
   useWebScoket({
-    url: "ws://42.193.1.25:8000/websocket/" + userInfo.value.id,
+    url: "wss://www.kgmeet.com:18443/websocket/" + userInfo.value.id,
     heartBeatData: "ping",
   });
 
 const time = ref(null);
+const attachmentShow = ref(false)
 
 const fileType = {
   img: {
@@ -267,6 +300,7 @@
 const searchText = ref("");
 const searchSubject = ref("");
 const searchContentType = ref("");
+const attachmentList = ref([]);
 
 const loading = ref(false);
 
@@ -294,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