Initial commit
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
[*.{js,jsx,ts,tsx,vue}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
end_of_line = lf
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
max_line_length = 100
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
.DS_Store
|
||||||
|
node_modules
|
||||||
|
/dist
|
||||||
|
|
||||||
|
|
||||||
|
# local env files
|
||||||
|
.env.local
|
||||||
|
.env.*.local
|
||||||
|
|
||||||
|
# Log files
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
|
.idea
|
||||||
|
.vscode
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
# onlyoffice-front
|
||||||
|
|
||||||
|
onlyoffice服务
|
||||||
|
|
||||||
|
## Project setup
|
||||||
|
```
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
### Compiles and hot-reloads for development
|
||||||
|
```
|
||||||
|
npm run serve
|
||||||
|
```
|
||||||
|
|
||||||
|
### Compiles and minifies for production
|
||||||
|
```
|
||||||
|
npm run build
|
||||||
|
```
|
||||||
|
|
||||||
|
### Lints and fixes files
|
||||||
|
```
|
||||||
|
npm run lint
|
||||||
|
```
|
||||||
|
|
||||||
|
### Customize configuration
|
||||||
|
See [Configuration Reference](https://cli.vuejs.org/config/).
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
module.exports = {
|
||||||
|
presets: [
|
||||||
|
'@vue/cli-plugin-babel/preset',
|
||||||
|
],
|
||||||
|
};
|
||||||
Generated
+14460
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"name": "onlyoffice-front",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"serve": "vue-cli-service serve",
|
||||||
|
"build": "vue-cli-service build",
|
||||||
|
"lint": "vue-cli-service lint"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"core-js": "^3.6.5",
|
||||||
|
"vue": "^2.6.11",
|
||||||
|
"vue-router": "^3.2.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@vue/cli-plugin-babel": "~4.5.0",
|
||||||
|
"@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": [
|
||||||
|
"> 1%",
|
||||||
|
"last 2 versions",
|
||||||
|
"not dead"
|
||||||
|
]
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
@@ -0,0 +1,39 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||||
|
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||||
|
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||||
|
<!-- onlyOffice服务器地址-->
|
||||||
|
<script type="text/javascript" src="http://10.10.10.45:8103/web-apps/apps/api/documents/api.js"></script>
|
||||||
|
<!-- 全局配置 -->
|
||||||
|
<% if (process.env.NODE_ENV === 'development' ) { %>
|
||||||
|
<script>
|
||||||
|
window._CONFIG = {
|
||||||
|
'documentUrl': 'http://10.10.10.46:8888/',
|
||||||
|
'callbackUrl': 'http://10.10.10.46:8001',
|
||||||
|
'configUrl': 'http://localhost:8081/',
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<% } %>
|
||||||
|
<% if (process.env.NODE_ENV === 'production' ) { %>
|
||||||
|
<script>
|
||||||
|
window._CONFIG = {
|
||||||
|
'documentUrl': 'https://srms.foton.com.cn/file/',
|
||||||
|
'callbackUrl': 'https://srms.foton.com.cn',
|
||||||
|
'configUrl': 'http://10.100.5.116:8089/',
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<% } %>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>
|
||||||
|
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
|
||||||
|
Please enable it to continue.</strong>
|
||||||
|
</noscript>
|
||||||
|
<div id="app"></div>
|
||||||
|
<!-- built files will be auto injected -->
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
+35
@@ -0,0 +1,35 @@
|
|||||||
|
<template>
|
||||||
|
<div id="app">
|
||||||
|
<!-- <div id="nav">-->
|
||||||
|
<!-- <router-link to="/">Home</router-link> |-->
|
||||||
|
<!-- <router-link to="/about">About</router-link>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<router-view/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="less">
|
||||||
|
#app {
|
||||||
|
font-family: Avenir, Helvetica, Arial, sans-serif;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
text-align: center;
|
||||||
|
color: #2c3e50;
|
||||||
|
}
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
#nav {
|
||||||
|
padding: 30px;
|
||||||
|
|
||||||
|
a {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #2c3e50;
|
||||||
|
|
||||||
|
&.router-link-exact-active {
|
||||||
|
color: #42b983;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 6.7 KiB |
@@ -0,0 +1,66 @@
|
|||||||
|
<template>
|
||||||
|
<div class="hello">
|
||||||
|
<h1>{{ msg }}</h1>
|
||||||
|
<p>
|
||||||
|
For a guide and recipes on how to configure / customize this project,<br>
|
||||||
|
check out the
|
||||||
|
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
|
||||||
|
</p>
|
||||||
|
<h3>Installed CLI Plugins</h3>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
|
||||||
|
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-router" target="_blank" rel="noopener">router</a></li>
|
||||||
|
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
|
||||||
|
</ul>
|
||||||
|
<h3>Essential Links</h3>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
|
||||||
|
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
|
||||||
|
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
|
||||||
|
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
|
||||||
|
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
|
||||||
|
</ul>
|
||||||
|
<h3 @click="cwx">Ecosystem</h3>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
|
||||||
|
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
|
||||||
|
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
|
||||||
|
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
|
||||||
|
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import wxcount from '../views/test';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'HelloWorld',
|
||||||
|
props: {
|
||||||
|
msg: String,
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
cwx() {
|
||||||
|
console.log(wxcount);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||||
|
<style scoped lang="less">
|
||||||
|
h3 {
|
||||||
|
margin: 40px 0 0;
|
||||||
|
}
|
||||||
|
ul {
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
li {
|
||||||
|
display: inline-block;
|
||||||
|
margin: 0 10px;
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
color: #42b983;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
import Vue from 'vue';
|
||||||
|
import App from './App.vue';
|
||||||
|
import router from './router';
|
||||||
|
|
||||||
|
Vue.config.productionTip = false;
|
||||||
|
|
||||||
|
new Vue({
|
||||||
|
router,
|
||||||
|
render: (h) => h(App),
|
||||||
|
}).$mount('#app');
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import Vue from 'vue';
|
||||||
|
import VueRouter from 'vue-router';
|
||||||
|
|
||||||
|
Vue.use(VueRouter);
|
||||||
|
|
||||||
|
const routes = [
|
||||||
|
{
|
||||||
|
path: '/',
|
||||||
|
name: 'Home',
|
||||||
|
redirect: '/onlyoffice',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/onlyoffice',
|
||||||
|
name: 'Onlyoffice',
|
||||||
|
// 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(/* webpackChunkName: "onlyoffice" */ '../views/Onlyoffice.vue'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/editor',
|
||||||
|
name: 'editor',
|
||||||
|
// 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(/* webpackChunkName: "onlyoffice" */ '../views/editor.vue'),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const router = new VueRouter({
|
||||||
|
mode: 'history',
|
||||||
|
base: process.env.BASE_URL,
|
||||||
|
routes,
|
||||||
|
});
|
||||||
|
|
||||||
|
export default router;
|
||||||
@@ -0,0 +1,181 @@
|
|||||||
|
<template>
|
||||||
|
<div id="placeholder" class="nav" style="height: 100vh">
|
||||||
|
<div id="iframeEditor"></div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
let docEditor
|
||||||
|
const {location} = window
|
||||||
|
export default {
|
||||||
|
name: 'Onlyoffice',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
docEditor: {},
|
||||||
|
documentUrl: window._CONFIG.documentUrl,
|
||||||
|
callbackUrl: window._CONFIG.callbackUrl
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
if (window.addEventListener) {
|
||||||
|
this.connectEditor()
|
||||||
|
window.addEventListener('resize', this.fixSize)
|
||||||
|
} else if (window.attachEvent) {
|
||||||
|
window.attachEvent('onload', this.connectEditor)
|
||||||
|
window.attachEvent('onresize', this.fixSize)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
innerAlert(message) {
|
||||||
|
if (console && console.log) console.log(message)
|
||||||
|
},
|
||||||
|
onAppReady() {
|
||||||
|
this.innerAlert('Document editor ready')
|
||||||
|
},
|
||||||
|
onDocumentStateChange(event) {
|
||||||
|
const title = document.title.replace(/\*$/g, '')
|
||||||
|
document.title = title + (event.data ? '*' : '')
|
||||||
|
},
|
||||||
|
onRequestEditRights() {
|
||||||
|
location.href = location.href.replace(RegExp('mode=view', 'i'), '')
|
||||||
|
},
|
||||||
|
onRequestHistory(event) {
|
||||||
|
const historyObj =
|
||||||
|
[
|
||||||
|
{
|
||||||
|
changes: null,
|
||||||
|
key: this.$route.query.attId,
|
||||||
|
version: 1,
|
||||||
|
created: '2022-10-17 14:17:09',
|
||||||
|
user: {id: this.$route.query.userId, name: this.$route.query.userName}
|
||||||
|
}
|
||||||
|
] || null
|
||||||
|
this.docEditor.refreshHistory({
|
||||||
|
currentVersion: '1',
|
||||||
|
history: historyObj
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onRequestHistoryData(data) {
|
||||||
|
const version = data.data
|
||||||
|
const historyData =
|
||||||
|
[
|
||||||
|
{
|
||||||
|
'version': 1,
|
||||||
|
'key': this.$route.query.attId,
|
||||||
|
'url': this.documentUrl + this.$route.query.filePath + this.$route.query.fileName
|
||||||
|
}
|
||||||
|
] || null
|
||||||
|
this.docEditor.setHistoryData(historyData[version - 1])
|
||||||
|
},
|
||||||
|
onRequestHistoryClose(event) {
|
||||||
|
document.location.reload()
|
||||||
|
},
|
||||||
|
onError(event) {
|
||||||
|
if (event) this.innerAlert(event.data)
|
||||||
|
},
|
||||||
|
onOutdatedVersion(event) {
|
||||||
|
location.reload(true)
|
||||||
|
},
|
||||||
|
replaceActionLink(href, linkParam) {
|
||||||
|
let link
|
||||||
|
const actionIndex = href.indexOf('&action=')
|
||||||
|
// eslint-disable-next-line eqeqeq
|
||||||
|
if (actionIndex != -1) {
|
||||||
|
const endIndex = href.indexOf('&', actionIndex + '&action='.length)
|
||||||
|
// eslint-disable-next-line eqeqeq
|
||||||
|
if (endIndex != -1) {
|
||||||
|
link = `${
|
||||||
|
href.substring(0, actionIndex) + href.substring(endIndex)
|
||||||
|
}&action=${encodeURIComponent(linkParam)}`
|
||||||
|
} else {
|
||||||
|
link = `${href.substring(0, actionIndex)}&action=${encodeURIComponent(
|
||||||
|
linkParam
|
||||||
|
)}`
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
link = `${href}&action=${encodeURIComponent(linkParam)}`
|
||||||
|
}
|
||||||
|
return link
|
||||||
|
},
|
||||||
|
onMakeActionLink(event) {
|
||||||
|
const actionData = event.data
|
||||||
|
const linkParam = JSON.stringify(actionData)
|
||||||
|
this.docEditor.setActionLink(this.replaceActionLink(location.href, linkParam))
|
||||||
|
},
|
||||||
|
fixSize() {
|
||||||
|
const wrapEl = document.getElementsByClassName('form')
|
||||||
|
if (wrapEl.length) {
|
||||||
|
// eslint-disable-next-line no-restricted-globals
|
||||||
|
wrapEl[0].style.height = `${screen.availHeight}px`
|
||||||
|
window.scrollTo(0, -1)
|
||||||
|
wrapEl[0].style.height = `${window.innerHeight}px`
|
||||||
|
}
|
||||||
|
},
|
||||||
|
connectEditor() {
|
||||||
|
// console.log('connectEditor', 1233);
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
this.docEditor = new DocsAPI.DocEditor('iframeEditor', {
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
type: 'desktop',
|
||||||
|
documentType: 'text',
|
||||||
|
token: '',
|
||||||
|
document: {
|
||||||
|
title: this.$route.query.oldFileName + '.' + this.$route.query.fileType,
|
||||||
|
url: this.documentUrl + this.$route.query.filePath + this.$route.query.fileName,
|
||||||
|
fileType: this.$route.query.fileType,
|
||||||
|
key: this.$route.query.key,
|
||||||
|
// 文件其他参数(文档作者、存储文档的文件夹、创建日期、共享设置)
|
||||||
|
info: {
|
||||||
|
author: 'Me',
|
||||||
|
created: 'Wed Oct 12 2022'
|
||||||
|
},
|
||||||
|
permissions: {
|
||||||
|
comment: false,
|
||||||
|
download: true,
|
||||||
|
edit: false,
|
||||||
|
fillForms: true,
|
||||||
|
modifyFilter: true,
|
||||||
|
modifyContentControl: true,
|
||||||
|
review: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
editorConfig: {
|
||||||
|
actionLink: null,
|
||||||
|
mode: 'view',
|
||||||
|
lang: 'zh',
|
||||||
|
callbackUrl: '',
|
||||||
|
user: {
|
||||||
|
id: this.$route.query.userId,
|
||||||
|
name: this.$route.query.userName
|
||||||
|
}
|
||||||
|
},
|
||||||
|
events: {
|
||||||
|
'onAppReady': this.onAppReady,
|
||||||
|
'onDocumentStateChange': this.onDocumentStateChange,
|
||||||
|
'onRequestEditRights': this.onRequestEditRights,
|
||||||
|
'onError': this.onError,
|
||||||
|
'onRequestHistory': this.onRequestHistory,
|
||||||
|
'onRequestHistoryData': this.onRequestHistoryData,
|
||||||
|
'onRequestHistoryClose': this.onRequestHistoryClose,
|
||||||
|
'onOutdatedVersion': this.onOutdatedVersion,
|
||||||
|
'onMakeActionLink': this.onMakeActionLink
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.fixSize()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
if (window.removeEventListener) {
|
||||||
|
window.removeEventListener('load', this.connectEditor)
|
||||||
|
window.removeEventListener('resize', this.fixSize)
|
||||||
|
} else if (window.detachEvent) {
|
||||||
|
window.detachEvent('onload', this.connectEditor)
|
||||||
|
window.detachEvent('onresize', this.fixSize)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,230 @@
|
|||||||
|
<template>
|
||||||
|
<div id="placeholder" class="nav" style="height: 100vh">
|
||||||
|
<div id="iframeEditor"></div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
let docEditor
|
||||||
|
const {location} = window
|
||||||
|
export default {
|
||||||
|
name: 'editor',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
docEditor: {},
|
||||||
|
documentUrl: window._CONFIG.documentUrl,
|
||||||
|
callbackUrl: window._CONFIG.callbackUrl
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
if (window.addEventListener) {
|
||||||
|
window.addEventListener('load', this.connectEditor)
|
||||||
|
window.addEventListener('resize', this.fixSize)
|
||||||
|
} else if (window.attachEvent) {
|
||||||
|
window.attachEvent('onload', this.connectEditor)
|
||||||
|
window.attachEvent('onresize', this.fixSize)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
innerAlert(message) {
|
||||||
|
if (console && console.log) console.log(message)
|
||||||
|
},
|
||||||
|
onAppReady() {
|
||||||
|
this.innerAlert('Document editor ready')
|
||||||
|
},
|
||||||
|
onDocumentStateChange(event) {
|
||||||
|
const title = document.title.replace(/\*$/g, '')
|
||||||
|
document.title = title + (event.data ? '*' : '')
|
||||||
|
},
|
||||||
|
onRequestEditRights() {
|
||||||
|
location.href = location.href.replace(RegExp('mode=view', 'i'), '')
|
||||||
|
},
|
||||||
|
onRequestHistory(event) {
|
||||||
|
const historyObj =
|
||||||
|
[
|
||||||
|
{
|
||||||
|
changes: null,
|
||||||
|
key: this.$route.query.attId,
|
||||||
|
version: 1,
|
||||||
|
created: '2022-10-17 14:17:09',
|
||||||
|
user: {id: this.$route.query.userId, name: this.$route.query.userName}
|
||||||
|
}
|
||||||
|
] || null
|
||||||
|
|
||||||
|
this.docEditor.refreshHistory({
|
||||||
|
currentVersion: '1',
|
||||||
|
history: historyObj
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onRequestHistoryData(data) {
|
||||||
|
const version = data.data
|
||||||
|
const historyData =
|
||||||
|
[
|
||||||
|
{
|
||||||
|
'version': 1,
|
||||||
|
'key': this.$route.query.attId,
|
||||||
|
'url': this.documentUrl + this.$route.query.filePath + this.$route.query.fileName
|
||||||
|
}
|
||||||
|
] || null
|
||||||
|
this.docEditor.setHistoryData(historyData[version - 1])
|
||||||
|
},
|
||||||
|
onRequestHistoryClose(event) {
|
||||||
|
document.location.reload()
|
||||||
|
},
|
||||||
|
onError(event) {
|
||||||
|
if (event) this.innerAlert(event.data)
|
||||||
|
},
|
||||||
|
onOutdatedVersion(event) {
|
||||||
|
// console.log(event);
|
||||||
|
location.reload(true)
|
||||||
|
},
|
||||||
|
replaceActionLink(href, linkParam) {
|
||||||
|
let link
|
||||||
|
const actionIndex = href.indexOf('&action=')
|
||||||
|
// eslint-disable-next-line eqeqeq
|
||||||
|
if (actionIndex != -1) {
|
||||||
|
const endIndex = href.indexOf('&', actionIndex + '&action='.length)
|
||||||
|
// eslint-disable-next-line eqeqeq
|
||||||
|
if (endIndex != -1) {
|
||||||
|
link = `${
|
||||||
|
href.substring(0, actionIndex) + href.substring(endIndex)
|
||||||
|
}&action=${encodeURIComponent(linkParam)}`
|
||||||
|
} else {
|
||||||
|
link = `${href.substring(0, actionIndex)}&action=${encodeURIComponent(
|
||||||
|
linkParam
|
||||||
|
)}`
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
link = `${href}&action=${encodeURIComponent(linkParam)}`
|
||||||
|
}
|
||||||
|
return link
|
||||||
|
},
|
||||||
|
onMakeActionLink(event) {
|
||||||
|
const actionData = event.data
|
||||||
|
const linkParam = JSON.stringify(actionData)
|
||||||
|
this.docEditor.setActionLink(this.replaceActionLink(location.href, linkParam))
|
||||||
|
},
|
||||||
|
fixSize() {
|
||||||
|
const wrapEl = document.getElementsByClassName('form')
|
||||||
|
if (wrapEl.length) {
|
||||||
|
// eslint-disable-next-line no-restricted-globals
|
||||||
|
wrapEl[0].style.height = `${screen.availHeight}px`
|
||||||
|
window.scrollTo(0, -1)
|
||||||
|
wrapEl[0].style.height = `${window.innerHeight}px`
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onDocumentSaved() {
|
||||||
|
console.log(12)
|
||||||
|
},
|
||||||
|
connectEditor() {
|
||||||
|
const nowTime = new Date().getTime()
|
||||||
|
console.log(this.documentUrl + this.$route.query.filePath + this.$route.query.fileName)
|
||||||
|
// console.log('connectEditor', 1233);
|
||||||
|
this.docEditor = new DocsAPI.DocEditor('iframeEditor', {
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
type: 'desktop',
|
||||||
|
// 打开文档类型
|
||||||
|
// text对应各种文档类型(.doc, .docm, .docx, .dot, .dotm, .dotx, .epub, .fodt, .htm, .html, .mht, .odt, .ott, .pdf, .rtf, .txt, .djvu, .xps)
|
||||||
|
// spreadsheet对应表格类型(.csv, .fods, .ods, .ots, .xls, .xlsm, .xlsx, .xlt, .xltm, .xltx)
|
||||||
|
// presentation对应PPT类型(.fodp, .odp, .otp, .pot, .potm, .potx, .pps, .ppsm, .ppsx, .ppt, .pptm, .pptx)
|
||||||
|
documentType: 'text',
|
||||||
|
token: '',
|
||||||
|
document: {
|
||||||
|
title: this.$route.query.oldFileName + '.' + this.$route.query.fileType,
|
||||||
|
url: this.documentUrl + this.$route.query.filePath + this.$route.query.fileName,
|
||||||
|
fileType: this.$route.query.fileType,
|
||||||
|
key: this.$route.query.key,
|
||||||
|
info: {
|
||||||
|
author: 'Me',
|
||||||
|
created: 'Wed Oct 12 2022'
|
||||||
|
},
|
||||||
|
permissions: {
|
||||||
|
comment: true, // 定义是否可以注释文档。如果注释权限设置为true,则文档侧栏将包含“注释”菜单选项;只有将mode参数设置为edit时才生效,默认值与edit参数的值一致
|
||||||
|
download: true, // 定义是否可以下载文档或仅在线查看或编辑文档。如果下载权限设置为“false”下载为菜单选项将没有。默认值为true
|
||||||
|
edit: true, // 文件是否可以编辑,false时文件不可编辑
|
||||||
|
fillForms: true, // 定义是否能在文档中填充表单
|
||||||
|
modifyFilter: true, // 定义过滤器是否可以全局应用(true)影响所有其他用户,或局部应用(false),即仅适用于当前用户。如果将mode参数设置为edit,则过滤器修改仅对电子表格编辑器可用。默认值为true。
|
||||||
|
modifyContentControl: true, // 定义是否可以更改内容控件设置。仅当mode参数设置为edit时,内容控件修改才可用于文档编辑器。默认值为true。
|
||||||
|
review: true // 第一是否显示审阅文档菜单
|
||||||
|
}
|
||||||
|
},
|
||||||
|
editorConfig: {
|
||||||
|
actionLink: null,
|
||||||
|
mode: 'edit',
|
||||||
|
lang: 'zh',
|
||||||
|
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}`,
|
||||||
|
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.$route.query.fileName, // 定义允许其他用户共享此文档的绝对URL。
|
||||||
|
toolbarDocked: 'top' // 定义嵌入式查看器工具栏的位置,可以为top或bottom。
|
||||||
|
},
|
||||||
|
// 定制部分允许自定义编辑器界面,使其看起来像您的其他产品,并更改是否存在其他按钮,链接,更改徽标和编辑者所有者详细信息。
|
||||||
|
customization: {
|
||||||
|
about: true,
|
||||||
|
chat: true, // 定义“聊天”菜单按钮是显示还是隐藏;请注意,如果您隐藏“聊天”按钮,则相应的聊天功能也将被禁用。默认值为true。
|
||||||
|
comments: true, // 定义是显示还是隐藏“注释”菜单按钮;请注意,如果您隐藏“评论”按钮,则相应的评论功能将仅可用于查看,评论的添加和编辑将不可用。默认值为true。
|
||||||
|
feedback: true, // 反馈配置信息
|
||||||
|
forcesave: true, // 定义保存按钮是否显示默认false
|
||||||
|
atuosave: false,
|
||||||
|
'features': {
|
||||||
|
'spellcheck': {
|
||||||
|
'mode': false,
|
||||||
|
'change': true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 定义“打开文件位置”菜单按钮和右上角按钮的设置
|
||||||
|
goback: {
|
||||||
|
// url: 'http://localhost/example/', // 单击“打开文件位置”菜单按钮时将打开的网站地址的绝对URL
|
||||||
|
},
|
||||||
|
unit: 'cm', // 定义在标尺和对话框中使用的度量单位。可以采用以下值:cm -厘米,pt-点,inch -英寸。默认值为厘米(cm)。
|
||||||
|
zoom: 100 // 定义以百分比为单位的文档显示缩放值。可以取大于0的值。对于文本文档和演示文稿,可以将此参数设置为-1(使文档适合页面选项)或-2(使文档页面宽度适合编辑器页面)。默认值为100。
|
||||||
|
},
|
||||||
|
fileChoiceUrl: '',
|
||||||
|
// 定义是否将启动插件并可用。默认值为true。
|
||||||
|
plugins: this.$route.query.isEdit && this.$route.query.isEdit == 123 ? {
|
||||||
|
autostart: ['asc.{0616AE85-5DBE-4B6B-A0A9-455C4F1503AD}'],
|
||||||
|
pluginsData: [
|
||||||
|
window._CONFIG.configUrl + 'page1/config.json'
|
||||||
|
]
|
||||||
|
} : {}
|
||||||
|
},
|
||||||
|
events: {
|
||||||
|
'onAppReady': this.onAppReady,
|
||||||
|
'onDocumentStateChange': this.onDocumentStateChange, // 文档改变后的回调
|
||||||
|
'onRequestEditRights': this.onRequestEditRights, // 用户尝试通过单击“编辑文档”按钮尝试将文档从视图切换到编辑模式时调用的函数。调用该函数时,必须在编辑模式下再次初始化编辑器。如果未声明该方法,则不会显示“编辑”按钮。
|
||||||
|
'onError': this.onError,
|
||||||
|
'onRequestHistory': this.onRequestHistory, // 用户尝试通过单击“版本历史记录”按钮显示文档版本历史记录时调用的函数。要显示文档版本历史,您必须调用refreshHistory方法。如果未声明该方法和onRequestHistoryData方法,则不会显示“版本历史记录”按钮。
|
||||||
|
'onRequestHistoryData': this.onRequestHistoryData, // 用户尝试单击文档版本历史记录中的特定文档版本时调用的函数。
|
||||||
|
'onRequestHistoryClose': this.onRequestHistoryClose, // 当用户尝试通过单击“关闭历史记录”按钮来查看文档版本历史记录时,试图调用该文档时调用的函数。调用该函数时,必须在编辑模式下再次初始化编辑器。如果未声明该方法,则不会显示“关闭历史记录”按钮。
|
||||||
|
'onOutdatedVersion': this.onOutdatedVersion, // 使用旧的document.key值打开文档进行编辑时,显示错误后调用的函数,该值用于编辑先前的文档版本并已成功保存。调用此事件时,必须使用新的document.key重新初始化编辑器。
|
||||||
|
'onMakeActionLink': this.onMakeActionLink,
|
||||||
|
'onDocumentSaved': this.onDocumentSaved
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.fixSize()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
if (window.removeEventListener) {
|
||||||
|
window.removeEventListener('load', this.connectEditor)
|
||||||
|
window.removeEventListener('resize', this.fixSize)
|
||||||
|
} else if (window.detachEvent) {
|
||||||
|
window.detachEvent('onload', this.connectEditor)
|
||||||
|
window.detachEvent('onresize', this.fixSize)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user