Pārlūkot izejas kodu

refactor(文件下载): 优化文件下载路径逻辑并使用新的配置

移除旧的下载路径拼接方式,改用configEdu.FILE_URL配置
恢复PDF文件的窗口打开功能
tanshanming 6 mēneši atpakaļ
vecāks
revīzija
0709a58047
1 mainītis faili ar 3 papildinājumiem un 9 dzēšanām
  1. 3 9
      src/libs/globalFunction/file.js

+ 3 - 9
src/libs/globalFunction/file.js

@@ -1,6 +1,7 @@
 import * as Vue from 'vue'
 import router from '@/router'
 import config from '@/config/reSource'
+import configEdu from '@/config'
 import { message } from 'ant-design-vue'
 import { fileImgMap, unknownImg, fileSuffixCodeModeMap, markdownFileType } from '@/libs/map.js'
 import { officeFileType } from '@/libs/map.js'
@@ -84,14 +85,7 @@ const fileFunction = {
 		}&extractionCode=${row.extractionCode == null ? '' : row.extractionCode}&admin=true`
 	},
 	getDownloadFilePath3(row) {
-
-		// console.log("下载地址",`${config.baseContext}/resourceFile/downloadfile?userFileId=${row.fileId}&shareBatchNum=${
-		// 	row.shareBatchNum == null ? '' : row.shareBatchNum
-		// }&extractionCode=${row.extractionCode == null ? '' : row.extractionCode}&admin=true`)
-
-		return `${config.baseContext}/resourceFile/downloadfile?userFileId=${row.fileId}&shareBatchNum=${
-			row.shareBatchNum == null ? '' : row.shareBatchNum
-		}&extractionCode=${row.extractionCode == null ? '' : row.extractionCode}&admin=true`
+		return `${configEdu.FILE_URL}${row.fileUrl}`
 	},
 	/**
 	 * 获取 Onlyoffice 文件创建路径
@@ -363,7 +357,7 @@ const fileFunction = {
 			}
 			//  若当前点击项是pdf
 			if (row.extendName.toLowerCase() === 'pdf') {
-				// window.open(this.getViewFilePath(row), '_blank')
+				window.open(this.getViewFilePath(row), '_blank')
 			}
 			//  若当前点击项是代码或文本文件
 			let codeFileSuffix = row.extendName.toLowerCase()