diff --git a/public/dev_api_config.js b/public/dev_api_config.js index 784fe9f..99b1e60 100644 --- a/public/dev_api_config.js +++ b/public/dev_api_config.js @@ -1,6 +1,6 @@ window._CONFIG = {} // 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端口,最后一个/是必须的) window._CONFIG.callbackUrl = 'http://10.0.10.87:8188/' // onlyOffice自定义编辑器的地址(plugins的前端路径,最后一个/是必须的) diff --git a/src/utils/request.js b/src/utils/request.js index a59d321..9d7de7b 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -1,10 +1,10 @@ import axios from 'axios' -const apiBaseUrl = '/laws-sinotruk' +const apiBaseUrl = '/laws-chery' // 创建 axios 实例 const service = axios.create({ - // baseURL: '/laws-sinotruk', + // baseURL: '/laws-chery', baseURL: apiBaseUrl, // api base_url timeout: 10000 // 请求超时时间 }) diff --git a/src/views/EditorPage.vue b/src/views/EditorPage.vue index 09ab426..5a10fc9 100644 --- a/src/views/EditorPage.vue +++ b/src/views/EditorPage.vue @@ -38,7 +38,7 @@ export default { isFileDisplay: false, fileList: [], reloadEditor: true, - currentFilePath: null // 当前页面展示文件的path + currentFileId: null // 当前页面展示文件的id } }, mounted () { @@ -101,7 +101,7 @@ export default { { 'version': 1, '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 this.docEditor.setHistoryData(historyData[version - 1]) @@ -159,14 +159,15 @@ export default { const nowTime = new Date().getTime() let url = '' let key = '' + console.log('-----------fileInfo', fileInfo) if (fileInfo.id) { - url = this.documentUrl + fileInfo.filePath + url = this.documentUrl + fileInfo.id key = this.$route.query.key + nowTime - this.currentFilePath = fileInfo.filePath + this.currentFileId = fileInfo.id } else { - url = `${this.documentUrl}${this.$route.query.filePath}` + url = `${this.documentUrl}${this.$route.query.fileId}` key = this.$route.query.key + nowTime - this.currentFilePath = this.$route.query.filePath + this.currentFileId = this.$route.query.fileId } this.docEditor = new DocsAPI.DocEditor('iframeEditor', { width: '100%', @@ -214,19 +215,20 @@ export default { query: { 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: { id: this.$route.query.userId, name: this.$route.query.userName }, // embedded部分仅适用于嵌入式文档类型(请参阅config部分以了解如何定义嵌入式文档类型)。它允许更改设置,这些设置定义嵌入式模式下按钮的行为。 embedded: { - // saveUrl: this.documentUrl + this.$route.query.filePath + this.$route.query.fileName, // 定义允许将文档保存到用户个人计算机上的绝对URL。 - // embedUrl: this.documentUrl + this.$route.query.filePath + this.$route.query.fileName, // 定义文档的绝对URL,以作为嵌入到网页中的文档的源文件 - // shareUrl: this.documentUrl + this.$route.query.filePath + this.fileName, // 定义允许其他用户共享此文档的绝对URL。 - saveUrl: `${this.documentUrl}${this.$route.query.filePath}`, // 定义允许将文档保存到用户个人计算机上的绝对URL。 - embedUrl: `${this.documentUrl}${this.$route.query.filePath}`, // 定义文档的绝对URL,以作为嵌入到网页中的文档的源文件 - shareUrl: `${this.documentUrl}${this.$route.query.filePath}`, // 定义允许其他用户共享此文档的绝对URL。 + // saveUrl: this.documentUrl + this.$route.query.fileId + this.$route.query.fileName, // 定义允许将文档保存到用户个人计算机上的绝对URL。 + // embedUrl: this.documentUrl + this.$route.query.fileId + this.$route.query.fileName, // 定义文档的绝对URL,以作为嵌入到网页中的文档的源文件 + // shareUrl: this.documentUrl + this.$route.query.fileId + this.fileName, // 定义允许其他用户共享此文档的绝对URL。 + saveUrl: `${this.documentUrl}${this.$route.query.fileId}`, // 定义允许将文档保存到用户个人计算机上的绝对URL。 + embedUrl: `${this.documentUrl}${this.$route.query.fileId}`, // 定义文档的绝对URL,以作为嵌入到网页中的文档的源文件 + shareUrl: `${this.documentUrl}${this.$route.query.fileId}`, // 定义允许其他用户共享此文档的绝对URL。 toolbarDocked: 'top' // 定义嵌入式查看器工具栏的位置,可以为top或bottom。 }, // 定制部分允许自定义编辑器界面,使其看起来像您的其他产品,并更改是否存在其他按钮,链接,更改徽标和编辑者所有者详细信息。 @@ -325,10 +327,10 @@ export default { this.isFileDisplay = false }, handleDownload () { - if (!this.currentFilePath) { + if (!this.currentFileId) { 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) } },