diff --git a/public/dev_api_config.js b/public/dev_api_config.js index 5b7627a..bf1401f 100644 --- a/public/dev_api_config.js +++ b/public/dev_api_config.js @@ -1,4 +1,7 @@ window._CONFIG = {} +// onlyOffice文件获取地址 window._CONFIG.documentUrl = 'http://10.0.1.19:8184/laws-sinotruk/onlyOffice/downLoadFile?path=' +// onlyOffice文件保存回调地址(后端服务的ip端口,最后一个/是必须的) window._CONFIG.callbackUrl = 'http://10.0.1.19:8184/' +// onlyOffice自定义编辑器的地址(plugins的前端路径,最后一个/是必须的) window._CONFIG.configUrl = 'http://10.0.1.19:8082/' diff --git a/public/prod_api_config.js b/public/prod_api_config.js index fd6b7a6..cf55744 100644 --- a/public/prod_api_config.js +++ b/public/prod_api_config.js @@ -1,4 +1,7 @@ window._CONFIG = {} +// onlyOffice文件获取地址 window._CONFIG.documentUrl = 'http://laws-sinotruk-server-kmc2c.yf-grp:8080/laws-sinotruk/onlyoffice/downLoadFile?path=' +// onlyOffice文件保存回调地址(后端服务的ip端口,最后一个/是必须的) window._CONFIG.callbackUrl = 'http://laws-sinotruk-server-kmc2c.yf-grp:8080/' +// onlyOffice自定义编辑器的地址(plugins的前端路径,最后一个/是必须的) window._CONFIG.configUrl = 'http://onlyofficeplugins.sinotruk.com/' diff --git a/src/App.vue b/src/App.vue index db446d2..2842b41 100644 --- a/src/App.vue +++ b/src/App.vue @@ -17,6 +17,9 @@ export default { return { zh_CN } + }, + created () { + document.title = '在线编辑' } } diff --git a/src/components/HelloWorld.vue b/src/components/HelloWorld.vue deleted file mode 100644 index aa9bfc4..0000000 --- a/src/components/HelloWorld.vue +++ /dev/null @@ -1,66 +0,0 @@ - - - {{ msg }} - - For a guide and recipes on how to configure / customize this project, - check out the - vue-cli documentation. - - Installed CLI Plugins - - babel - router - eslint - - Essential Links - - Core Docs - Forum - Community Chat - Twitter - News - - Ecosystem - - vue-router - vuex - vue-devtools - vue-loader - awesome-vue - - - - - - - - diff --git a/src/router/index.js b/src/router/index.js index bf7a765..85b7f80 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -18,20 +18,20 @@ const routes = [ component: () => import('../views/List.vue') }, { - path: '/onlyoffice', - name: 'Onlyoffice', + path: '/previewPage', + name: 'PreviewPage', // route level code-splitting // this generates a separate chunk (about.[hash].js) for this route // which is lazy-loaded when the route is visited. - component: () => import('../views/Onlyoffice.vue') + component: () => import('../views/PreviewPage.vue') }, { - path: '/editor', - name: 'editor', + path: '/editorPage', + name: 'EditorPage', // route level code-splitting // this generates a separate chunk (about.[hash].js) for this route // which is lazy-loaded when the route is visited. - component: () => import('../views/editor.vue') + component: () => import('../views/EditorPage.vue') } ] diff --git a/src/views/editor.vue b/src/views/EditorPage.vue similarity index 78% rename from src/views/editor.vue rename to src/views/EditorPage.vue index be20a48..68a172f 100644 --- a/src/views/editor.vue +++ b/src/views/EditorPage.vue @@ -1,5 +1,20 @@ + 还原 + + + 还原版本 + × + + + + {{ item.createTime }} + 预览 + 还原 + + + 暂无历史版本 + @@ -15,10 +30,13 @@ export default { return { docEditor: {}, documentUrl: window._CONFIG.documentUrl, - callbackUrl: window._CONFIG.callbackUrl + callbackUrl: window._CONFIG.callbackUrl, + isFileDisplay: false, + fileList: [] } }, mounted () { + document.title = '在线编辑' this.connectEditor() // 从主系统跳过来需要调这个方法,目前系统内跳不触发 if (window.addEventListener) { @@ -131,12 +149,17 @@ export default { onDocumentSaved () { console.log(12) }, - connectEditor () { - console.log(this.$route.query) - console.log(`${this.documentUrl}${this.$route.query.filePath}`) - console.log(window._CONFIG.configUrl + 'page1/config.json') - console.log(`${this.callbackUrl}laws-sinotruk/onlyOffice/receiveFile?fileId=${this.$route.query.fileId}&fileNm=${this.$route.query.fileName}&key=${this.$route.query.key}`) + connectEditor (fileInfo = {}) { const nowTime = new Date().getTime() + let url = '' + let key = '' + if (fileInfo.id) { + url = this.documentUrl + fileInfo.id + key = fileInfo.id + nowTime + } else { + url = `${this.documentUrl}${this.$route.query.filePath}` + key = this.$route.query.key + nowTime + } this.docEditor = new DocsAPI.DocEditor('iframeEditor', { width: '100%', height: '100%', @@ -149,9 +172,9 @@ export default { token: 'secret', document: { title: this.$route.query.fileName, - url: `${this.documentUrl}${this.$route.query.filePath}`, + url: url, fileType: this.$route.query.fileType, - key: this.$route.query.key + new Date().getTime(), + key: key, info: { author: this.$route.query.userName, created: 'Wed Oct 12 2022' @@ -183,7 +206,7 @@ export default { query: { id: 123456 }, - callbackUrl: `${this.callbackUrl}laws-sinotruk/onlyOffice/receiveFile?fileId=${this.$route.query.fileId}&fileNm=${this.$route.query.fileName}&key=${this.$route.query.key}`, + callbackUrl: `${this.callbackUrl}laws-sinotruk/onlyOffice/receiveFile?fileId=${this.$route.query.fileId}&fileNm=${this.$route.query.fileName}&key=${this.$route.query.key}&business=${this.$route.query.business}`, user: { id: this.$route.query.userId, name: this.$route.query.userName @@ -242,6 +265,38 @@ export default { } }) this.fixSize() + }, + /** + * 还原,打开历史记录弹框 + */ + handleRestore () { + this.isFileDisplay = true + }, + /** + * 关闭历史记录列表 + */ + closeFileClick () { + this.isFileDisplay = false + }, + /** + * 预览文件 + * @param file + */ + viewFileClick (file) { + const { fileName, userId, userName } = this.$route.query + const { href } = this.$router.resolve({ + path: '/previewPage', + query: { + fileName, userId, userName + } + }) + window.open(href, '_blank') + }, + /** + * 确定回滚到某个版本 + */ + fileContentClick () { + } }, beforeDestroy () { @@ -257,4 +312,88 @@ export default { diff --git a/src/views/Onlyoffice.vue b/src/views/PreviewPage.vue similarity index 81% rename from src/views/Onlyoffice.vue rename to src/views/PreviewPage.vue index 2692ca8..86bed85 100644 --- a/src/views/Onlyoffice.vue +++ b/src/views/PreviewPage.vue @@ -6,17 +6,19 @@
- For a guide and recipes on how to configure / customize this project, - check out the - vue-cli documentation. -