code init
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
<!DOCTYPE html>
|
||||
<html style="height: 100%">
|
||||
<head>
|
||||
<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>OCR在线编辑</title>
|
||||
<!-- 此处配置onlyOffice地址 -->
|
||||
<script type="text/javascript" src="http://106.2.13.189:9001/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" language="javascript">
|
||||
var fileName = GetQueryValue('fileName')
|
||||
var fileUrl = GetQueryValue('fileUrl')
|
||||
var key = GetQueryValue('key')
|
||||
var ocrId = GetQueryValue('ocrId')
|
||||
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);
|
||||
};
|
||||
var config = {
|
||||
"document": {
|
||||
"fileType": 'docx',
|
||||
"key": key,
|
||||
"title": fileName,
|
||||
"url": fileUrl
|
||||
},
|
||||
"documentType": "text",
|
||||
"editorConfig": {
|
||||
// 此处配置回调地址
|
||||
"callbackUrl": "http://106.2.13.189:10001/api/att/attFile/recieveFileByOcr?ocrId=" + ocrId + '&orifileUrl=' + fileUrl,
|
||||
"mode":"edit",
|
||||
"lang":"zh-CN",
|
||||
// "customization": {
|
||||
// "forcesave": "true"
|
||||
// }
|
||||
}
|
||||
};
|
||||
|
||||
docEditor = new DocsAPI.DocEditor("iframeEditor", config);
|
||||
|
||||
/**
|
||||
* [通过参数名获取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