file_preview.html 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
  6. <title>文件预览</title>
  7. <script src="https://office.jinjianghc.com/web-apps/apps/api/documents/api.js"></script>
  8. </head>
  9. <style>
  10. body, html {
  11. margin: 0;
  12. padding: 0;
  13. width: 100%;
  14. height: 100%;
  15. }
  16. </style>
  17. <body id="preview">
  18. </body>
  19. <script>
  20. let title = '{$title}',url = '{$url}';
  21. const index = title.lastIndexOf('.');
  22. const fileType = title.substr(index + 1);
  23. const config = {
  24. "document": {
  25. "permissions": {
  26. comment: false,
  27. fillForms: false,
  28. "edit": false,
  29. },
  30. "fileType": fileType,
  31. "title": title,
  32. "url": url,
  33. // "key": this.md5,
  34. "lang": "zh-CN"
  35. },
  36. "width": '100%',
  37. "editorConfig": {
  38. mode: 'view',
  39. "lang": "zh-CN"
  40. }
  41. };
  42. document.title = title;
  43. const docEditor = new window.DocsAPI.DocEditor("preview", config);
  44. </script>
  45. </html>