소스 검색

文件预览调整

user5 4 년 전
부모
커밋
0a4dc8b34f
2개의 변경된 파일49개의 추가작업 그리고 5개의 파일을 삭제
  1. 47 3
      src/main/webapp/static/common/js/common.js
  2. 2 2
      src/main/webapp/webpage/modules/ruralprojectrecords/projectAccessoryForm.jsp

+ 47 - 3
src/main/webapp/static/common/js/common.js

@@ -78,9 +78,31 @@ function preview(title,url,width,height,type){
     }
     //var u = 'http://ow365.cn/?i=14411&furl='+url;
     if(url.indexOf("http://gangwan-app.oss-cn-hangzhou.aliyuncs.com")>-1) {
-        var u = 'https://view.officeapps.live.com/op/view.aspx?src='+encodeURIComponent(url);
+        var u = 'http://www.xdocin.com/xdoc?_func=to&_format=html&_cache=true&_xdoc='+encodeURIComponent(url);
     }else{
-        var u = 'https://view.officeapps.live.com/op/view.aspx?src='+encodeURIComponent(url);
+        //你的文档地址
+        var file = url;
+        //XDOC文档预览服务地址
+        var xurl = "https://view.xdocin.com/xdoc?_xdoc=";
+        //传入文档地址
+        xurl += encodeURIComponent(file);
+        //预览参数
+        var ops = {
+            // "_pdf": true, //word/excel文档尝试以pdf方式显示,默认false
+            // "_watermark": "XDOC文档预览", //水印文本,显示水印
+            // "_saveable": false, //是否允许保存PDF,默认true
+            // "_printable": false, //是否允许打印PDF,默认true
+            // "_copyable": false, //是否允许选择复制内容,默认true
+            // "_toolbar": false, //是否显示底部工具条,默认true
+            // "_title": "文档预览", //自定义标题
+            "_expire": 30, //预览链接有效期,单位分钟,默认永久有效
+            // "_limit": "1,3", //限制页数,如:“5”表示只显示前5页,“2,5”表示从第2页开始的5页,对pdf/doc/docx/ppt/pptx有效
+        };
+        //传入预览参数
+        for (var a in ops) {
+            xurl += "&" + encodeURIComponent(a) + "=" + encodeURIComponent(ops[a]);
+        }
+        u = xurl;
     }
 
     function encodeContent(data){
@@ -91,7 +113,29 @@ function preview(title,url,width,height,type){
     }
 
     if(type == 1){
-        u = 'http://www.xdocin.com/xdoc?_func=to&_format=html&_cache=true&_xdoc='+encodeURIComponent(url);
+        //你的文档地址
+        var file = url;
+        //XDOC文档预览服务地址
+        var xurl = "https://view.xdocin.com/xdoc?_xdoc=";
+        //传入文档地址
+        xurl += encodeURIComponent(file);
+        //预览参数
+        var ops = {
+            // "_pdf": true, //word/excel文档尝试以pdf方式显示,默认false
+            // "_watermark": "XDOC文档预览", //水印文本,显示水印
+            // "_saveable": false, //是否允许保存PDF,默认true
+            // "_printable": false, //是否允许打印PDF,默认true
+            // "_copyable": false, //是否允许选择复制内容,默认true
+            // "_toolbar": false, //是否显示底部工具条,默认true
+            // "_title": "文档预览", //自定义标题
+            "_expire": 30, //预览链接有效期,单位分钟,默认永久有效
+            // "_limit": "1,3", //限制页数,如:“5”表示只显示前5页,“2,5”表示从第2页开始的5页,对pdf/doc/docx/ppt/pptx有效
+        };
+        //传入预览参数
+        for (var a in ops) {
+            xurl += "&" + encodeURIComponent(a) + "=" + encodeURIComponent(ops[a]);
+        }
+        u = xurl;
     }
     parent.layer.open({
         type: 2,

+ 2 - 2
src/main/webapp/webpage/modules/ruralprojectrecords/projectAccessoryForm.jsp

@@ -608,7 +608,7 @@
                                                            or fn:containsIgnoreCase(fileGistdata.attachName,'gif')
                                                            or fn:containsIgnoreCase(fileGistdata.attachName,'bmp')
                                                            or fn:containsIgnoreCase(fileGistdata.attachName,'jpeg')}">
-																<img src="${fileGistdata.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${fileGistdata.temporaryUrl}','90%','90%')" alt="${fileGistdata.attachName}">
+																<img src="${fileGistdata.temporaryUrl}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${fileGistdata.temporaryUrl}','90%','90%')" alt="${fileGistdata.attachName}">
 															</c:when>
 															<c:otherwise>
 																<c:choose>
@@ -756,7 +756,7 @@
                                                            or fn:containsIgnoreCase(fileOther.attachName,'gif')
                                                            or fn:containsIgnoreCase(fileOther.attachName,'bmp')
                                                            or fn:containsIgnoreCase(fileOther.attachName,'jpeg')}">
-																	<img src="${fileOther.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${fileOther.temporaryUrl}','90%','90%')" alt="${fileOther.attachName}">
+																	<img src="${fileOther.temporaryUrl}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${fileOther.temporaryUrl}','90%','90%')" alt="${fileOther.attachName}">
 																</c:when>
 																<c:otherwise>
 																	<c:choose>