[update] 传参为文件path的地方都改为传文件id

This commit is contained in:
lideqin
2024-10-09 17:07:44 +08:00
parent 5f9c754235
commit 91f9c7ee7a
3 changed files with 20 additions and 18 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
window._CONFIG = {} window._CONFIG = {}
// onlyOffice文件获取地址 // onlyOffice文件获取地址
window._CONFIG.documentUrl = 'http://10.0.10.87:8188/laws-sinotruk/onlyOffice/downLoadFile?path=' window._CONFIG.documentUrl = 'http://10.0.10.87:8188/laws-chery/onlyOffice/downLoadFileRoma?id='
// onlyOffice文件保存回调地址(后端服务的ip端口,最后一个/是必须的) // onlyOffice文件保存回调地址(后端服务的ip端口,最后一个/是必须的)
window._CONFIG.callbackUrl = 'http://10.0.10.87:8188/' window._CONFIG.callbackUrl = 'http://10.0.10.87:8188/'
// onlyOffice自定义编辑器的地址(plugins的前端路径,最后一个/是必须的) // onlyOffice自定义编辑器的地址(plugins的前端路径,最后一个/是必须的)
+2 -2
View File
@@ -1,10 +1,10 @@
import axios from 'axios' import axios from 'axios'
const apiBaseUrl = '/laws-sinotruk' const apiBaseUrl = '/laws-chery'
// 创建 axios 实例 // 创建 axios 实例
const service = axios.create({ const service = axios.create({
// baseURL: '/laws-sinotruk', // baseURL: '/laws-chery',
baseURL: apiBaseUrl, // api base_url baseURL: apiBaseUrl, // api base_url
timeout: 10000 // 请求超时时间 timeout: 10000 // 请求超时时间
}) })
+17 -15
View File
@@ -38,7 +38,7 @@ export default {
isFileDisplay: false, isFileDisplay: false,
fileList: [], fileList: [],
reloadEditor: true, reloadEditor: true,
currentFilePath: null // 当前页面展示文件的path currentFileId: null // 当前页面展示文件的id
} }
}, },
mounted () { mounted () {
@@ -101,7 +101,7 @@ export default {
{ {
'version': 1, 'version': 1,
'key': this.$route.query.attId, 'key': this.$route.query.attId,
'url': this.documentUrl + this.$route.query.filePath + this.$route.query.fileName 'url': this.documentUrl + this.$route.query.fileId + this.$route.query.fileName
} }
] || null ] || null
this.docEditor.setHistoryData(historyData[version - 1]) this.docEditor.setHistoryData(historyData[version - 1])
@@ -159,14 +159,15 @@ export default {
const nowTime = new Date().getTime() const nowTime = new Date().getTime()
let url = '' let url = ''
let key = '' let key = ''
console.log('-----------fileInfo', fileInfo)
if (fileInfo.id) { if (fileInfo.id) {
url = this.documentUrl + fileInfo.filePath url = this.documentUrl + fileInfo.id
key = this.$route.query.key + nowTime key = this.$route.query.key + nowTime
this.currentFilePath = fileInfo.filePath this.currentFileId = fileInfo.id
} else { } else {
url = `${this.documentUrl}${this.$route.query.filePath}` url = `${this.documentUrl}${this.$route.query.fileId}`
key = this.$route.query.key + nowTime key = this.$route.query.key + nowTime
this.currentFilePath = this.$route.query.filePath this.currentFileId = this.$route.query.fileId
} }
this.docEditor = new DocsAPI.DocEditor('iframeEditor', { this.docEditor = new DocsAPI.DocEditor('iframeEditor', {
width: '100%', width: '100%',
@@ -214,19 +215,20 @@ export default {
query: { query: {
id: 123456 id: 123456
}, },
callbackUrl: `${this.callbackUrl}laws-sinotruk/onlyOffice/receiveFile?fileId=${this.$route.query.fileId}&fileNm=${this.$route.query.fileName}&key=${key}&business=${this.$route.query.business}`, // key 要改成传文件本身??
callbackUrl: `${this.callbackUrl}laws-chery/onlyOffice/receiveFile?fileId=${this.$route.query.fileId}&fileNm=${this.$route.query.fileName}&key=${key}&business=${this.$route.query.business}`,
user: { user: {
id: this.$route.query.userId, id: this.$route.query.userId,
name: this.$route.query.userName name: this.$route.query.userName
}, },
// embedded部分仅适用于嵌入式文档类型(请参阅config部分以了解如何定义嵌入式文档类型)。它允许更改设置,这些设置定义嵌入式模式下按钮的行为。 // embedded部分仅适用于嵌入式文档类型(请参阅config部分以了解如何定义嵌入式文档类型)。它允许更改设置,这些设置定义嵌入式模式下按钮的行为。
embedded: { embedded: {
// saveUrl: this.documentUrl + this.$route.query.filePath + this.$route.query.fileName, // 定义允许将文档保存到用户个人计算机上的绝对URL。 // saveUrl: this.documentUrl + this.$route.query.fileId + this.$route.query.fileName, // 定义允许将文档保存到用户个人计算机上的绝对URL。
// embedUrl: this.documentUrl + this.$route.query.filePath + this.$route.query.fileName, // 定义文档的绝对URL,以作为嵌入到网页中的文档的源文件 // embedUrl: this.documentUrl + this.$route.query.fileId + this.$route.query.fileName, // 定义文档的绝对URL,以作为嵌入到网页中的文档的源文件
// shareUrl: this.documentUrl + this.$route.query.filePath + this.fileName, // 定义允许其他用户共享此文档的绝对URL。 // shareUrl: this.documentUrl + this.$route.query.fileId + this.fileName, // 定义允许其他用户共享此文档的绝对URL。
saveUrl: `${this.documentUrl}${this.$route.query.filePath}`, // 定义允许将文档保存到用户个人计算机上的绝对URL。 saveUrl: `${this.documentUrl}${this.$route.query.fileId}`, // 定义允许将文档保存到用户个人计算机上的绝对URL。
embedUrl: `${this.documentUrl}${this.$route.query.filePath}`, // 定义文档的绝对URL,以作为嵌入到网页中的文档的源文件 embedUrl: `${this.documentUrl}${this.$route.query.fileId}`, // 定义文档的绝对URL,以作为嵌入到网页中的文档的源文件
shareUrl: `${this.documentUrl}${this.$route.query.filePath}`, // 定义允许其他用户共享此文档的绝对URL。 shareUrl: `${this.documentUrl}${this.$route.query.fileId}`, // 定义允许其他用户共享此文档的绝对URL。
toolbarDocked: 'top' // 定义嵌入式查看器工具栏的位置,可以为top或bottom。 toolbarDocked: 'top' // 定义嵌入式查看器工具栏的位置,可以为top或bottom。
}, },
// 定制部分允许自定义编辑器界面,使其看起来像您的其他产品,并更改是否存在其他按钮,链接,更改徽标和编辑者所有者详细信息。 // 定制部分允许自定义编辑器界面,使其看起来像您的其他产品,并更改是否存在其他按钮,链接,更改徽标和编辑者所有者详细信息。
@@ -325,10 +327,10 @@ export default {
this.isFileDisplay = false this.isFileDisplay = false
}, },
handleDownload () { handleDownload () {
if (!this.currentFilePath) { if (!this.currentFileId) {
return return
} }
const path = '/onlyOffice/downLoadFileRoma?path=' + this.currentFilePath || this.$route.query.filePath const path = '/onlyOffice/downLoadFileRoma?id=' + this.currentFileId || this.$route.query.fileId
downloadFile(path, this.$route.query.fileName) downloadFile(path, this.$route.query.fileName)
} }
}, },