资料网员
This commit is contained in:
+31
-1
@@ -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 []
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user