Browse Source

增加文档预览

zmw 8 tháng trước cách đây
mục cha
commit
7ae29b947f
2 tập tin đã thay đổi với 25 bổ sung1 xóa
  1. 1 0
      app/common/view/layout/content.html
  2. 24 1
      public/static/js/common/Feng.js

+ 1 - 0
app/common/view/layout/content.html

@@ -50,6 +50,7 @@
     <script src="/static/js/common/tree-table-object.js"></script>
     <script src="/static/js/common/web-upload-object.js"></script>
     <script src="/static/js/common/ztree-object.js"></script>
+    <script src="https://office.jinjianghc.com/web-apps/apps/api/documents/api.js"></script>
     <script type="text/javascript">
         document.write('<script src="/static/js/common/Feng.js?v=' + (new Date()).getTime() + '"><\/script>');
         document.write('<script src="/static/modular/common/config.js?v=' + (new Date()).getTime() + '"><\/script>');

+ 24 - 1
public/static/js/common/Feng.js

@@ -566,7 +566,30 @@ var Feng = {
         // layer.full(index);
     },
     showExcel: function (url, id, title) {
-        window.location.href = url;
+        const index = title.lastIndexOf('.');
+        const fileType = title.substr(index + 1);
+        const config = {
+            "document": {
+                "permissions": {
+                    comment: false,
+                    fillForms: false,
+                    "edit": false,
+                },
+                "fileType": fileType,
+                "title": title,
+                "url": url,
+                // "key": this.md5,
+                "lang": "zh-CN"
+            },
+            "width": '100%',
+            "editorConfig": {
+                mode: 'view',
+                "lang": "zh-CN"
+            }
+        };
+        document.title = title;
+        const docEditor = new DocsAPI.DocEditor("placeholder", config);
+        //window.location.href = url;
     },
     showFile: function (url, id, title) {
         if (Feng.isEmptyStr(id)) {