资料网员

This commit is contained in:
fengachen
2021-10-13 09:55:05 +08:00
parent 491caf06a3
commit 700767c578
5 changed files with 53 additions and 7 deletions
+31 -1
View File
@@ -1,3 +1,4 @@
import MeetingApi from '../js/http/meetingApi'
/**
* 预览文件的方法
* @param fileId 文件id
@@ -5,8 +6,8 @@
*/
// 文件下载的地址 后期上线需要修改地址
const downFileUrl = `http://localhost:3000/jero-boot/sys/common/download/`
// 预览
export function previewFile(fileId,fileName) {
@@ -50,3 +51,32 @@ export function previewFile(fileId,fileName) {
// 截取文件类型
return fileName.slice(index+1)
}
// 通过文件id获取文件的相关信息
export function getFileInfo(id) {
return new Promise(resolve => {
let result = {}
MeetingApi.queryFileInfoById({ id: id }).then(res => {
if (res.success) {
result = res.result
}
}).finally(() => {
resolve(result)
})
})
}
// 获取一个或多个文件信息
export async function initFileList(fileIds) {
if (fileIds) {
const fileList = []
let arr = fileIds.split(',')
for (let i = 0; i < arr.length; i++) {
let fileObj = {}
fileObj = await getFileInfo(arr[i])
fileList.push({ id: fileObj.id, name: fileObj.fileName })
}
return fileList
} else{
return []
}
}