起步软件技术论坛
搜索
 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1609|回复: 3

[结贴] 附件预览无法打开

[复制链接]

18

主题

92

帖子

244

积分

中级会员

Rank: 3Rank: 3

积分
244
QQ
发表于 2017-11-29 16:36:44 | 显示全部楼层 |阅读模式
想在点击图片的时候预览该文件,代码如下:Model.prototype.toShow = function(event, rowid) {
                debugger;
                var fUploadFiles = this.comp("productDocumentation").getValueByID("fUploadFiles", rowid);
                var json = eval("("+fUploadFiles+")");
                var fileID = json["fileID"];
                var docName = json["docName"];
                var docPath = json["docPath"];
                var url = DocUtils.InnerUtils.getdocServerAction({
                                 "docPath" : docPath,
                                 urlPattern : "/repository/file/view/" + fileID + "/last/content",
                                 isFormAction : false,
                                 context : this.getContext()
                            });
                 url = url.indexOf(window.location.protocol) < 1 ? url : window.location.protocol + "//" + window.location.host + url;// 拼接最终需要的url
                 url = encodeURI(encodeURI(url));
               
             var fileType = docName.substring(docName.indexOf(".")),type;// 获取文件的后缀判断设置不同的类型
             if (fileType == ".doc" || fileType == ".docx") type = "Word.Application";
             else if (fileType == ".xls" || fileType == ".xlsx") type = "Excel.Application" ;
             var divID = this.getIDByXID("officeViewer");
             var ocxID = divID + "_ocx";
             if (!($(".officeViewr").length > 0)) {
                    $("#" + divID).append('<div class="officeViewr" style="overflow:hidden;width:100%;height:100%;"><div style="overflow:auto;width:100%;height:100%;" id="' + ocxID + '"></div></div>');
             }
             $('#' + ocxID).attr('showToolbar', false);// 隐藏工具栏
       
             $OV(ocxID).CreateOfficeViewer('100%', '100%');
             var officeObj = $OV(ocxID);
             officeObj.ShowMenubar(false);// 隐藏菜单栏
             if (type && !officeObj.isOpened()) {
                officeObj.Open(url, type);
             }
        };

列表.png
发表于 2017-12-6 16:32:36 | 显示全部楼层
qq:1912779713
WeX5教程--WeX5下载
回复 支持 反对

使用道具 举报

18

主题

92

帖子

244

积分

中级会员

Rank: 3Rank: 3

积分
244
QQ
 楼主| 发表于 2018-1-10 10:16:24 | 显示全部楼层
liangyongfei 发表于 2017-12-6 16:32
APP 中打开文件吗?
http://docs.wex5.com/wex5-app-question-list-2097

我已经打开了,谢谢大佬,浏览器插件的问题
回复 支持 反对

使用道具 举报

18

主题

92

帖子

244

积分

中级会员

Rank: 3Rank: 3

积分
244
QQ
 楼主| 发表于 2018-1-10 10:17:14 | 显示全部楼层
请结贴
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|X3技术论坛|Justep Inc.    

GMT+8, 2025-6-26 15:37 , Processed in 0.056780 second(s), 27 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表