feat: There is no way the, online preview
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html style="height: 100%">
|
||||
<head>
|
||||
<head id="vue">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui"/>
|
||||
@@ -8,8 +8,10 @@
|
||||
<meta name="mobile-web-app-capable" content="yes"/>
|
||||
<title>在线编辑</title>
|
||||
<!-- 此处配置onlyOffice地址 -->
|
||||
<script type="text/javascript" src="http://106.2.13.189:9001/web-apps/apps/api/documents/api.js"></script>
|
||||
<!-- <script type="text/javascript" src="http://172.20.10.5/web-apps/apps/api/documents/api.js"></script>-->
|
||||
<script type="text/javascript" src="http://127.0.0.1:9011/web-apps/apps/api/documents/api.js"></script>
|
||||
<!-- <script src="js/vue.min.js"></script>-->
|
||||
|
||||
<!-- <script type="text/javascript" src="http://172.20.10.5/web-apps/apps/api/documents/api.js"></script>-->
|
||||
|
||||
</head>
|
||||
<body style="height: 100%">
|
||||
@@ -17,12 +19,46 @@
|
||||
<div id="iframeEditor"></div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
import { baseUrl } from '@/sysConfig'
|
||||
|
||||
// var preview = GetQueryValue('preview')
|
||||
// var vm = new Vue({
|
||||
// el: '#vue',
|
||||
// data: {
|
||||
// titleName: preview ? "在线预览":"在线编辑",
|
||||
// },
|
||||
// methods: {
|
||||
// details: function() {
|
||||
// return this.site + " - 学的不仅是技术,更是梦想!";
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
var oldFileName = GetQueryValue('oldFileName')
|
||||
var filePath = GetQueryValue('filePath')
|
||||
var fileName = GetQueryValue('fileName')
|
||||
var fileUrl = GetQueryValue('fileUrl')
|
||||
var standNo = GetQueryValue('standNo')
|
||||
var key = GetQueryValue('key')
|
||||
// var attId = GetQueryValue('attId')
|
||||
var fileSuffix = GetQueryValue('fileType')
|
||||
// 文档类word-text、表格类excel-spreadsheet、ppt类-presentation
|
||||
var documentType = ''
|
||||
var arr_data_ppt = ['pdf', 'PDF', 'pptx', 'PPTX', 'ppt', 'PPT'];
|
||||
var arr_data_word = ['pdf', 'PDF', 'doc','DOC', 'docx','DOCX'];
|
||||
var arr_data_xls = ['xls', 'XLS', 'xlsx', 'XLSX','.xls', '.XLS', '.xlsx', '.XLSX'];
|
||||
|
||||
arr_data_ppt.find(function(value) {
|
||||
if(value === fileSuffix) {
|
||||
documentType = 'presentation'
|
||||
}})
|
||||
arr_data_word.find(function(value) {
|
||||
if(value === fileSuffix) {
|
||||
documentType = 'text'
|
||||
}})
|
||||
arr_data_xls.find(function(value) {
|
||||
if(value === fileSuffix) {
|
||||
documentType = 'spreadsheet'
|
||||
}})
|
||||
//将文件后缀处理掉
|
||||
// fileSuffix = fileSuffix.split(".").join("");
|
||||
var docEditor;
|
||||
@@ -60,15 +96,20 @@
|
||||
// const fileUrl = 'http://172.20.10.2:9090/conver.docx'
|
||||
var config = {
|
||||
"document": {
|
||||
"fileType": 'docx',
|
||||
"permissions": {
|
||||
"edit": true, //是否可以编辑: 只能查看,传false
|
||||
"download":true,//是否可以下载
|
||||
"print":true //是否可以打印
|
||||
},
|
||||
"fileType": 'pptx',
|
||||
"key": key,
|
||||
"title": fileName,
|
||||
"title": oldFileName,
|
||||
"url": fileUrl
|
||||
},
|
||||
"documentType": "text",
|
||||
"documentType": documentType, // 文档类word-text、表格类excel-spreadsheet、ppt类-presentation
|
||||
"editorConfig": {
|
||||
// 此处配置回调地址
|
||||
"callbackUrl": `http://39.98.140.126:10005/api/att/attFile/recieveFile?fileNm=${fileName}&standNo=${standNo}`,
|
||||
"callbackUrl": baseUrl+`/api/att/attFile/recieveFile?fileNm=${fileName}&standNo=${filePath}`,
|
||||
"mode":"edit",
|
||||
"lang":"zh-CN",
|
||||
// "customization": {
|
||||
@@ -135,8 +176,10 @@
|
||||
// "frameEditorId": "iframeEditor",
|
||||
// "parentOrigin": "http://172.20.10.2:8081"
|
||||
// }
|
||||
|
||||
console.log(config)
|
||||
docEditor = new DocsAPI.DocEditor("iframeEditor", config);
|
||||
console.log(docEditor)
|
||||
|
||||
|
||||
/**
|
||||
* [通过参数名获取url中的参数值]
|
||||
|
||||
+6
File diff suppressed because one or more lines are too long
@@ -0,0 +1,199 @@
|
||||
<!DOCTYPE html>
|
||||
<html style="height: 100%">
|
||||
<head id="vue">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui"/>
|
||||
<meta name="apple-mobile-web-app-capable" content="yes"/>
|
||||
<meta name="mobile-web-app-capable" content="yes"/>
|
||||
<title>在线预览</title>
|
||||
<!-- 此处配置onlyOffice地址 -->
|
||||
<script type="text/javascript" src="http://127.0.0.1:9011/web-apps/apps/api/documents/api.js"></script>
|
||||
|
||||
<!-- <script type="text/javascript" src="http://172.20.10.5/web-apps/apps/api/documents/api.js"></script>-->
|
||||
|
||||
</head>
|
||||
<body style="height: 100%">
|
||||
<div class="form" style="height: 100%">
|
||||
<div id="iframeEditor"></div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
import { baseUrl } from '@/sysConfig'
|
||||
|
||||
// var preview = GetQueryValue('preview')
|
||||
// var vm = new Vue({
|
||||
// el: '#vue',
|
||||
// data: {
|
||||
// titleName: preview ? "在线预览":"在线编辑",
|
||||
// },
|
||||
// methods: {
|
||||
// details: function() {
|
||||
// return this.site + " - 学的不仅是技术,更是梦想!";
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
var fileName = GetQueryValue('fileName')
|
||||
var filePath = GetQueryValue('filePath')
|
||||
var fileUrl = GetQueryValue('fileUrl')
|
||||
var standNo = GetQueryValue('standNo')
|
||||
var key = GetQueryValue('key')
|
||||
// var attId = GetQueryValue('attId')
|
||||
var fileSuffix = GetQueryValue('fileType')
|
||||
// 文档类word-text、表格类excel-spreadsheet、ppt类-presentation
|
||||
var documentType = ''
|
||||
var arr_data_ppt = ['pdf', 'PDF', 'pptx', 'PPTX', 'ppt', 'PPT'];
|
||||
var arr_data_word = ['pdf', 'PDF', 'doc','DOC', 'docx','DOCX'];
|
||||
var arr_data_xls = ['xls', 'XLS', 'xlsx', 'XLSX','.xls', '.XLS', '.xlsx', '.XLSX'];
|
||||
|
||||
arr_data_ppt.find(function(value) {
|
||||
if(value === fileSuffix) {
|
||||
documentType = 'presentation'
|
||||
}})
|
||||
arr_data_word.find(function(value) {
|
||||
if(value === fileSuffix) {
|
||||
documentType = 'text'
|
||||
}})
|
||||
arr_data_xls.find(function(value) {
|
||||
if(value === fileSuffix) {
|
||||
documentType = 'spreadsheet'
|
||||
}})
|
||||
//将文件后缀处理掉
|
||||
// fileSuffix = fileSuffix.split(".").join("");
|
||||
var docEditor;
|
||||
|
||||
var innerAlert = function (message) {
|
||||
if (console && console.log)
|
||||
console.log(message);
|
||||
};
|
||||
|
||||
var onAppReady = function () {
|
||||
innerAlert("Document editor ready");
|
||||
};
|
||||
|
||||
var onDocumentStateChange = function (event) {
|
||||
var title = document.title.replace(/\*$/g, "");
|
||||
document.title = title + (event.data ? "*" : "");
|
||||
};
|
||||
|
||||
var onRequestEditRights = function () {
|
||||
location.href = location.href.replace(RegExp("mode=view\&?", "i"), "");
|
||||
};
|
||||
|
||||
var onError = function (event) {
|
||||
if (event)
|
||||
innerAlert(event.data);
|
||||
};
|
||||
|
||||
var onOutdatedVersion = function (event) {
|
||||
location.reload(true);
|
||||
};
|
||||
// console.log(key)
|
||||
// console.log(fileUrl)
|
||||
// console.log(attId)
|
||||
// console.log(fileName)
|
||||
// const fileUrl = 'http://172.20.10.2:9090/conver.docx'
|
||||
var config = {
|
||||
"document": {
|
||||
"permissions": {
|
||||
"edit": false, //是否可以编辑: 只能查看,传false
|
||||
"download":true,//是否可以下载
|
||||
"print":true //是否可以打印
|
||||
},
|
||||
"fileType": fileSuffix,
|
||||
"key": key,
|
||||
"title": fileName,
|
||||
"url": fileUrl
|
||||
},
|
||||
"documentType": documentType,
|
||||
"editorConfig": {
|
||||
// 此处配置回调地址
|
||||
"callbackUrl": baseUrl+`/api/att/attFile/recieveFile?fileNm=${fileName}&standNo=${filePath}`,
|
||||
"mode":"edit",
|
||||
"lang":"zh-CN",
|
||||
// "customization": {
|
||||
// "forcesave": "true"
|
||||
// }
|
||||
}
|
||||
};
|
||||
|
||||
// var config = {
|
||||
// "type": "desktop",
|
||||
// "mode": "edit",
|
||||
// "documentType": "text",
|
||||
// "document": {
|
||||
// "title": "new.docx",
|
||||
// "url": "http://172.20.10.2:9090/conver.docx",
|
||||
// "fileType": "docx",
|
||||
// "key": "-1988670278",
|
||||
// "permissions": {
|
||||
// "comment": true,
|
||||
// "download": true,
|
||||
// "edit": true,
|
||||
// "fillForms": true,
|
||||
// "modifyFilter": true,
|
||||
// "modifyContentControl": true,
|
||||
// "review": true
|
||||
// }
|
||||
// },
|
||||
// "editorConfig": {
|
||||
// "mode": "edit",
|
||||
// "callbackUrl": "http://39.98.140.126:10005/api/IndexServlet?type=track&fileName=new.docx&userAddress=172.20.10.2",
|
||||
// "lang": "zh",
|
||||
// "user": {
|
||||
// "id": "uid-1",
|
||||
// "name": "John Smith"
|
||||
// },
|
||||
// "customization": {
|
||||
// "goback": {
|
||||
// "url": "http://39.98.140.126:10005/api/IndexServlet"
|
||||
// },
|
||||
// "about": true,
|
||||
// "feedback": false
|
||||
// },
|
||||
// "canCoAuthoring": true,
|
||||
// "canUseHistory": false,
|
||||
// "canHistoryClose": false,
|
||||
// "canHistoryRestore": false,
|
||||
// "canSendEmailAddresses": false,
|
||||
// "canRequestEditRights": true,
|
||||
// "canRequestClose": false,
|
||||
// "canRename": false,
|
||||
// "canMakeActionLink": true,
|
||||
// "canRequestUsers": false,
|
||||
// "canRequestSendNotify": false,
|
||||
// "canRequestSaveAs": false,
|
||||
// "canRequestInsertImage": false,
|
||||
// "canRequestMailMergeRecipients": false,
|
||||
// "canRequestCompareFile": false,
|
||||
// "canRequestSharingSettings": false,
|
||||
// "canRequestCreateNew": false
|
||||
// },
|
||||
// "width": "100%",
|
||||
// "height": "100%",
|
||||
// "events": {},
|
||||
// "frameEditorId": "iframeEditor",
|
||||
// "parentOrigin": "http://172.20.10.2:8081"
|
||||
// }
|
||||
console.log(config)
|
||||
docEditor = new DocsAPI.DocEditor("iframeEditor", config);
|
||||
console.log(docEditor)
|
||||
|
||||
|
||||
/**
|
||||
* [通过参数名获取url中的参数值]
|
||||
* 示例URL:http://htmlJsTest/getrequest.html?uid=admin&rid=1&fid=2&name=小明
|
||||
* @param {[string]} queryName [参数名]
|
||||
* @return {[string]} [参数值]
|
||||
*/
|
||||
function GetQueryValue(queryName) {
|
||||
var query = decodeURI(window.location.search.substring(1));
|
||||
var vars = query.split("&");
|
||||
for (var i = 0; i < vars.length; i++) {
|
||||
var pair = vars[i].split("=");
|
||||
if (pair[0] == queryName) { return pair[1]; }
|
||||
}
|
||||
return null;
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user