delete 删除代码

This commit is contained in:
赵霄
2024-01-23 16:56:33 +08:00
parent f2bcb2ad89
commit 800548e04e
2 changed files with 0 additions and 58 deletions
-39
View File
@@ -1,39 +0,0 @@
// import store from '@/store'
import { getFileInfo } from '@api/api'
export default async (fileId, showFileName) => {
let fileInfo = {}
// 如果有fileId就从接口获取文件信息,否则打开默认模板
if (fileId) {
fileInfo = await getFileInfoData(fileId) || {}
} else {
// 这个是福田现在的模板
fileInfo = {
fileName: 'task_9ad64b01_top_9ad64b01_node.docx',
url: 'model/task_9ad64b01/task_9ad64b01_top_9ad64b01_node.docx'
}
}
// const userId = store.getters.userInfo.id
// const userName = store.getters.userInfo.username
const fullFilePathArr = fileInfo.url.split('/')
const fileName = fileInfo.fileName
const fileSuffix = fileName ? fileName.split('.')[fileName.split('.').length - 1] : ''
const filePath = `${fullFilePathArr[0]}/${fullFilePathArr[1]}/`
// 这会儿不用登录,先把关于用户信息的东西去掉
// &userId=${userId}&userName=${userName}
const url = `${window._CONFIG.onlyOfficeUrl}/editor?attId=${fileInfo.id}&filePath=${filePath}&fileName=${fileName}&oldFileName=${showFileName}&fileType=${fileSuffix}&key=${fileId}&isEdit=123`
window.open(url, '_blank')
}
const getFileInfoData = (id) => {
return new Promise(resolve => {
let fileInfo
getFileInfo({ id }).then(res => {
if (res.success) {
fileInfo = res.result
}
}).finally(() => {
resolve(fileInfo)
})
})
}
@@ -1,19 +0,0 @@
import { getFileInfo } from '@api/api'
export default (fileId, showFileName) => {
console.log(fileId)
getFileInfo({ id: fileId }).then(res => {
if (res.success) {
const fileInfo = res.result || {}
const fullFilePathArr = fileInfo.url.split('/')
const fileName = fileInfo.fileName
const fileSuffix = fileName ? fileName.split('.')[fileName.split('.').length - 1] : ''
const filePath = `${fullFilePathArr[0]}/`
const fileDownloadUrl = `${window._CONFIG.onlyOfficeDownloadFileUrl}/${fileInfo.url}`
console.log(fileDownloadUrl)
const nowTime = new Date().getTime()
const url = `${window._CONFIG.onlyOfficeUrl}/onlyOffice?oldFileName=${showFileName}&fileType=${fileSuffix}&attId=${fileId}&fileUrl=${fileDownloadUrl}&key=${fileId}${nowTime}&filePath=${filePath}&fileName=${fileName}`
window.open(url, '_blank')
}
})
}