diff --git a/babel.config.js b/babel.config.js index 757ff9b..0fb0307 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,5 +1,13 @@ module.exports = { presets: [ - '@vue/cli-plugin-babel/preset', + '@vue/cli-plugin-babel/preset' ], -}; + plugins: [ + [ + 'import', + { + libraryName: 'ant-design-vue', libraryDirectory: 'es', style: true + } + ] + ] +} diff --git a/package.json b/package.json index a26b357..16bd4ed 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,12 @@ "lint": "vue-cli-service lint" }, "dependencies": { + "ant-design-vue": "1.7.2", + "axios": "^1.5.0", + "babel-plugin-import": "^1.13.8", "core-js": "^3.6.5", + "less": "3.9.0", + "less-loader": "4.1.0", "vue": "^2.6.11", "vue-router": "^3.2.0" }, @@ -17,8 +22,6 @@ "@vue/cli-plugin-router": "~4.5.0", "@vue/cli-service": "~4.5.0", "eslint-plugin-import": "^2.20.2", - "less": "^3.0.4", - "less-loader": "^5.0.0", "vue-template-compiler": "^2.6.11" }, "browserslist": [ diff --git a/public/index.html b/public/index.html index ebcb255..85402d1 100644 --- a/public/index.html +++ b/public/index.html @@ -7,15 +7,25 @@ <%= htmlWebpackPlugin.options.title %> - + <% if (process.env.NODE_ENV === 'development' ) { %> + + <% } %> + <% if (process.env.NODE_ENV === 'production' ) { %> + + + <% } %> <% if (process.env.NODE_ENV === 'development' ) { %> <% } %> @@ -23,8 +33,10 @@ <% } %> diff --git a/src/App.vue b/src/App.vue index a28e91a..db446d2 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,13 +1,27 @@ + + + diff --git a/src/views/editor.vue b/src/views/editor.vue index f9630d6..34605f1 100644 --- a/src/views/editor.vue +++ b/src/views/editor.vue @@ -19,6 +19,8 @@ export default { } }, mounted () { + this.connectEditor() + // 从主系统跳过来需要调这个方法,目前系统内跳不触发 if (window.addEventListener) { window.addEventListener('load', this.connectEditor) window.addEventListener('resize', this.fixSize) @@ -32,12 +34,20 @@ export default { if (console && console.log) console.log(message) }, onAppReady () { - console.log(123); + console.log(123) this.innerAlert('Document editor ready') }, onDocumentStateChange (event) { const title = document.title.replace(/\*$/g, '') document.title = title + (event.data ? '*' : '') + // console.log('尝试获取dom') + // console.log(document.getElementsByTagName('iframe')) + // console.log(document.getElementsByTagName('iframe')[0]) + // console.log(document.getElementsByTagName('iframe')[0].contentDocument) + // console.log(document.getElementsByTagName('iframe')[0].contentWindow) + // console.log(document.getElementsByTagName('iframe')[0].contentWindow.document) + // console.log(document.getElementsByTagName('iframe')[0].contentWindow.document.getElementById('id_main_view')) + // console.log(document.getElementsByTagName('iframe')[0].contentDocument.getElementById('id_main_view')) }, onRequestEditRights () { location.href = location.href.replace(RegExp('mode=view', 'i'), '') @@ -60,7 +70,7 @@ export default { }) }, onRequestHistoryData (data) { - console.log(data); + console.log(data) const version = data.data const historyData = [ @@ -76,7 +86,7 @@ export default { document.location.reload() }, onError (event) { - console.log(event); + console.log(event) if (event) this.innerAlert(event.data) }, onOutdatedVersion (event) { @@ -122,7 +132,8 @@ export default { console.log(12) }, connectEditor () { - console.log(this.documentUrl) + console.log(`${this.documentUrl}${this.$route.query.filePath}`) + console.log(window._CONFIG.configUrl + 'page1/config.json') const nowTime = new Date().getTime() this.docEditor = new DocsAPI.DocEditor('iframeEditor', { width: '100%', @@ -135,10 +146,8 @@ export default { documentType: 'word', token: 'secret', document: { - // title: this.$route.query.oldFileName + '.' + this.$route.query.fileType, - title: '文档.docx', - // url: this.documentUrl + this.$route.query.filePath + this.$route.query.fileName, - url: this.documentUrl, + title: this.$route.query.fileName, + url: `${this.documentUrl}${this.$route.query.filePath}`, fileType: this.$route.query.fileType, key: this.$route.query.key, info: { @@ -153,16 +162,16 @@ export default { modifyFilter: true, // 定义过滤器是否可以全局应用(true)影响所有其他用户,或局部应用(false),即仅适用于当前用户。如果将mode参数设置为edit,则过滤器修改仅对电子表格编辑器可用。默认值为true。 modifyContentControl: true, // 定义是否可以更改内容控件设置。仅当mode参数设置为edit时,内容控件修改才可用于文档编辑器。默认值为true。 review: true, // 第一是否显示审阅文档菜单 - "commentGroups": { - "edit": ["Group2", ""], - "remove": [""], - "view": "" + 'commentGroups': { + 'edit': ['Group2', ''], + 'remove': [''], + 'view': '' }, - "copy": true, - "deleteCommentAuthorOnly": false, - "editCommentAuthorOnly": false, - "print": true, - "reviewGroups": ["Group1", "Group2", ""] + 'copy': true, + 'deleteCommentAuthorOnly': false, + 'editCommentAuthorOnly': false, + 'print': true, + 'reviewGroups': ['Group1', 'Group2', ''] } }, editorConfig: { @@ -172,7 +181,7 @@ export default { query: { id: 123456 }, - callbackUrl: `${this.callbackUrl}/bat-wkflow/busProcessModel/recieveFile?fileNm=${this.$route.query.fileName}&key=${this.$route.query.key}&standNo=${this.$route.query.filePath}&fileId=${this.$route.query.attId}&standName=${this.$route.query.standName}&standEnName=${this.$route.query.standEnName}&standCode=${this.$route.query.standCode}&putTime=${this.$route.query.putTime}&issueTime=${this.$route.query.issueTime}&dtqbbhbuss=${this.$route.query.dtqbbhbuss}`, + callbackUrl: `${this.callbackUrl}laws-sinotruk/onlyoffice/recieveFile?fileId=${this.$route.query.key}&fileNm=${this.$route.query.fileName}&key=${this.$route.query.key}`, user: { id: this.$route.query.userId, name: this.$route.query.userName @@ -181,7 +190,7 @@ export default { 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.$route.query.fileName, // 定义允许其他用户共享此文档的绝对URL。 + // shareUrl: this.documentUrl + this.$route.query.filePath + this.fileName, // 定义允许其他用户共享此文档的绝对URL。 saveUrl: this.documentUrl, // 定义允许将文档保存到用户个人计算机上的绝对URL。 embedUrl: this.documentUrl, // 定义文档的绝对URL,以作为嵌入到网页中的文档的源文件 shareUrl: this.documentUrl, // 定义允许其他用户共享此文档的绝对URL。 diff --git a/src/views/modules/AddFileModal.vue b/src/views/modules/AddFileModal.vue new file mode 100644 index 0000000..8852e15 --- /dev/null +++ b/src/views/modules/AddFileModal.vue @@ -0,0 +1,86 @@ + + + + + diff --git a/vue.config.js b/vue.config.js new file mode 100644 index 0000000..379fcd0 --- /dev/null +++ b/vue.config.js @@ -0,0 +1,37 @@ +module.exports = { + css: { + loaderOptions: { + less: { + // 自定义主题样式 + // modifyVars: { + // 'primary-color': '#41B883', + // 'link-color': '#41B883', + // 'border-radius-base': '2px' + // } + // 解决问题主要需要打开这个 + javascriptEnabled: true + } + } + }, + devServer: { + port: 8080, + proxy: { + /* '/api': { + target: 'https://mock.ihx.me/mock/5baf3052f7da7e07e04a5116/antd-pro', //mock API接口系统 + ws: false, + changeOrigin: true, + pathRewrite: { + '/laws-sinotruk': '' //默认所有请求都加了jero-boot前缀,需要去掉 + } + }, */ + '/laws-sinotruk': { + target: 'http://localhost:8184', + ws: false, + changeOrigin: true, + pathRewrite: { + // '/laws-sinotruk': '' // 默认所有请求都加了jero-boot前缀,需要去掉 + } + } + } + }, +}