feat: There is no way the, online preview

This commit is contained in:
Superman_Main
2021-11-27 20:33:55 +08:00
parent b87502f4b6
commit fa4f1a37ba
6 changed files with 324 additions and 31 deletions
+51 -8
View File
@@ -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中的参数值]