From aec00ecc093be803860c8675cbe1c4c776a7cb4e Mon Sep 17 00:00:00 2001
From: GuLiMmo <2820890765@qq.com>
Date: Tue, 19 Mar 2024 17:49:21 +0800
Subject: [PATCH] update: 新建航线、事件编辑、kmz文件问题修改

---
 src/components/MediaPanel.vue |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/components/MediaPanel.vue b/src/components/MediaPanel.vue
index 911fb2e..e8a7c56 100644
--- a/src/components/MediaPanel.vue
+++ b/src/components/MediaPanel.vue
@@ -34,7 +34,7 @@
         <a-button type="primary" @click="compress">压缩打包</a-button>
     </div>
 
-    <a-spin :spinning="loading" :delay="1000" tip="downloading" size="large">
+    <a-spin :spinning="loading" :delay="1000" tip="加载中" size="large">
         <div class="media-panel-wrapper">
             <a-table class="media-table" :columns="columns" :data-source="mediaData.data" row-key="fingerprint"
                      rowKey="file_id" :row-selection="rowSelection"
@@ -118,12 +118,15 @@
 
 type Key = ColumnProps['key'];
 
+const { baseUrl: { mediaPanelPrefix } } = window.globalApiConfig
+
 const workspaceId = localStorage.getItem(ELocalStorageKey.WorkspaceId)!
 const loading = ref(false)
 const showVideo = ref(false)
 const videoPlayerId = ref('videoPlayerId')
 // 文件前缀
-const prefix = 'https://dev.jxpskj.com:8026/cloud-bucket'
+// const prefix = 'https://dev.jxpskj.com:8026/cloud-bucket'
+const prefix = mediaPanelPrefix || import.meta.env.VITE_MEDIAPANEL_API_URL
 // 搜索栏配置项
 const searchPanelOptions = reactive({
   size: 'large',
@@ -245,6 +248,7 @@
 }
 
 function viewFile (objectKey: string) {
+  console.log(objectKey)
   const ext = objectKey.split('.')[1]
   const fileType = getFileType(ext)
   let url = ''
@@ -365,7 +369,6 @@
     const promiseList = [] as any
     selectedRow.list.forEach(e => {
       const url = prefix + e.object_key
-
       const promise = getFile(url, e.file_name)
       promiseList.push(promise)
     })
@@ -443,9 +446,10 @@
 function downloadMedia (media: MediaFile) {
   loading.value = true
   const url = prefix + '/' + media.object_key
-  const data = new Blob([url])
-  downloadFile(data, media.file_name)
-  loading.value = false
+  getFile(url, media.file_name).then(res => {
+    downloadFile(res.data, res.name)
+    loading.value = false
+  })
 
   // downloadMediaFile(workspaceId, media.file_id).then(res => {
   //     if (!res) {

--
Gitblit v1.9.3