缺少的文件
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import http from './http.js'
|
||||
let URL_CONFIG = '/jero-boot/'
|
||||
const MeetingApi = {
|
||||
// 会议活动分页
|
||||
meetingList: (params) => http.get(`${URL_CONFIG}meeting/payMeeting/pageContract`, params),
|
||||
// 会议活动详情
|
||||
meetingDetail: (params) => http.get(`${URL_CONFIG}meeting/payMeeting/queryById`, params),
|
||||
// 文件id获取文件信息
|
||||
queryFileInfoById:(params) => http.get(`${URL_CONFIG}sys/oss/file/queryById`, params),
|
||||
// 参会人信息
|
||||
queryPersongInfoById:(params) => http.get(`${URL_CONFIG}/meeting/payMeetingSituation/queryById`, params)
|
||||
}
|
||||
|
||||
export default MeetingApi
|
||||
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* 预览文件的方法
|
||||
* @param fileId 文件id
|
||||
* @param fileName 文件名称
|
||||
*/
|
||||
|
||||
// 文件下载的地址 后期上线需要修改地址
|
||||
|
||||
const downFileUrl = `http://localhost:3000/jero-boot/sys/common/download/`
|
||||
// 预览
|
||||
export function previewFile(fileId,fileName) {
|
||||
|
||||
// 目前没有在真机调试上试过 不知道要不要改前缀
|
||||
// console.log(that.data.pdfFilePath.replace("wxfile", 'http'));
|
||||
// 文件下载的地址
|
||||
const url = downFileUrl + fileId
|
||||
// 文件类型 目前是通过文件名称去截取
|
||||
const fileType = sliceFileTypeByFileName(fileName)
|
||||
// const fileType =
|
||||
wx.downloadFile({
|
||||
url: url,
|
||||
success: function (res) {
|
||||
wx.showToast({
|
||||
title: '正在打开',
|
||||
icon: 'loading',
|
||||
mask: true,
|
||||
duration: 1000
|
||||
})
|
||||
const filePath = res.tempFilePath
|
||||
wx.openDocument({
|
||||
filePath: filePath,
|
||||
fileType: fileType,
|
||||
success: function (res) {
|
||||
console.log('打开文档成功')
|
||||
wx.hideToast()
|
||||
}
|
||||
})
|
||||
},
|
||||
fail(err) {
|
||||
console.log(err, '文件打开失败');
|
||||
wx.hideToast()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 截取文件类型的方法
|
||||
function sliceFileTypeByFileName(fileName){
|
||||
// 获取 . 的索引
|
||||
let index = fileName.lastIndexOf('.')
|
||||
// 截取文件类型
|
||||
return fileName.slice(index+1)
|
||||
}
|
||||
Reference in New Issue
Block a user