update onlyoffice方法
This commit is contained in:
Vendored
+4
@@ -10,3 +10,7 @@ window._CONFIG.pdfDomainURL = window._CONFIG.domianURL + '/sys/common/pdf/pdfPre
|
|||||||
window._CONFIG.casPrefixUrl = 'http://cas.example.org:8443/cas'
|
window._CONFIG.casPrefixUrl = 'http://cas.example.org:8443/cas'
|
||||||
// 预览文件地址
|
// 预览文件地址
|
||||||
window._CONFIG.onlinePreviewDomainURL = 'http://127.0.0.1:8012/onlinePreview'
|
window._CONFIG.onlinePreviewDomainURL = 'http://127.0.0.1:8012/onlinePreview'
|
||||||
|
// onlyOffice前端服务地址
|
||||||
|
window._CONFIG.onlyOfficeUrl = 'http://127.0.0.1:8080'
|
||||||
|
// onlyOffice下载文件地址
|
||||||
|
window._CONFIG.onlyOfficeDownloadFileUrl = 'http://localhost:8184/sys/common/download'
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import store from '@/store'
|
||||||
|
import { getFileInfo } from '@api/api'
|
||||||
|
|
||||||
|
export default (fileId, showFileName) => {
|
||||||
|
getFileInfo({ id: fileId }).then(res => {
|
||||||
|
if (res.success) {
|
||||||
|
const userId = store.getters.userInfo.id
|
||||||
|
const userName = store.getters.userInfo.username
|
||||||
|
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}`
|
||||||
|
const url = `${window._CONFIG.onlyOfficeUrl}/editor?attId=${fileId}&userId=${userId}&userName=${userName}&filePath=${filePath}&fileName=${fileName}&oldFileName=${showFileName}&fileType=${fileSuffix}&key=${fileId}&fileUrl=${fileDownloadUrl}`
|
||||||
|
window.open(url, '_blank')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
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')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user