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

QQ登录

只需一步,快速开始

查看: 1452|回复: 1

[结贴] 使用 wex5的3.7版本打包 在安卓7.0以上系统 相机功能报错

[复制链接]

18

主题

53

帖子

137

积分

初级会员

Rank: 2

积分
137
QQ
发表于 2018-2-1 19:43:11 | 显示全部楼层 |阅读模式
测试在安卓6.0的版本下没有问题 ,但是安卓7.0使用相机,允许软件使用相机功能会闪退,再次打开软件点击拍照后进入失败的回调    提示error length=1;index=1


不过在本地相册选择图片上传是可以的

require("$UI/system/lib/cordova/cordova");
require("cordova!cordova-plugin-camera");


QQ图片20180201193527.png





代码如下:
        Model.prototype.liPhotoClick = function(event){
                var me = this;
                this.currentImgType = $(event.currentTarget).attr("imgtype");
                if ($(this.getElementByXid("span_check_" + this.currentImgType)).css("display") == "none") {
                        $(this.getElementByXid("pp_photo")).show();
                } else {
                        justep.Shell.showPage("bmphoto", {
                                imgType: this.currentImgType,
                                imgLabel: $(event.currentTarget).attr("imglabel"),
                                applyId: this.applyId,
                                backHandle: function(imgType){
                                        console.log(imgType);
                                        $(me.getElementByXid("span_check_" + imgType)).hide();
                                }
                        });
                }
        };
       
        Model.prototype.liPopCloseClick = function(event){
                $(this.getElementByXid("pp_photo")).hide();
        };
       
        Model.prototype.liSelPhotoClick = function(event){
                var me = this;
               
                if(!navigator.camera) {
                        return;
                }

                navigator.camera.getPicture(onLoadImageSuccess, onLoadImageFail, {
                        mediaType:0,
                        destinationType:navigator.camera.DestinationType.DATA_URL,
                        allowEdit:false,
                        quality:80,
                        sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY
                });
               
                function onLoadImageSuccess(imageData){
                        $(me.getElementByXid("pp_photo")).hide();
                       
                        var sendData = new Object();
                        sendData.applyId = me.applyId;
                        sendData.method = "UPLOAD_IMG_BASE64";
                        var imgs = new Array();
                        var img = new Object();
                        img.imgType = me.currentImgType;
                        img.imgContent = imageData;
                        imgs.push(img);
                        sendData.imgs = imgs;
                        sendData.userId = global_userid;
               
                        tfcall("DSP.C022", sendData, function (data){
                                if (data.replyCode == "1") {
                                        $(me.getElementByXid("span_check_" + me.currentImgType)).show();
                                } else {
                                        new MsgDialog({
                                                parentNode : me.getElementByXid("panel_main")
                                        }).show({
                                                title:'提醒',
                                                type:"OK",
                                                message:data.errorMsg
                                        });
                                }
                        });
                }

                function onLoadImageFail(error){
                        new MsgDialog({
                                parentNode : me.getElementByXid("panel_main")
                        }).show({
                                title:'错误',
                                type:"OK",
                                message:error
                        });
                }
        };
       
        Model.prototype.liDoPhotoClick = function(event){
                var me = this;
                       
                if(!navigator.camera) {
                        return;
                }


                navigator.camera.getPicture(onLoadImageSuccess, onLoadImageFail, {
                        destinationType:navigator.camera.DestinationType.DATA_URL,
                        allowEdit:false,
                        quality:80
                });
               
                function onLoadImageSuccess(imageData){
                        $(me.getElementByXid("pp_photo")).hide();
                       
                        var sendData = new Object();
                        sendData.applyId = me.applyId;
                        sendData.method = "UPLOAD_IMG_BASE64";
                        var imgs = new Array();
                        var img = new Object();
                        img.imgType = me.currentImgType;
                        img.imgContent = imageData;
                        imgs.push(img);
                        sendData.imgs = imgs;
                        sendData.userId = global_userid;
               
                        tfcall("DSP.C022", sendData, function (data){
                                if (data.replyCode == "1") {
                                        $(me.getElementByXid("span_check_" + me.currentImgType)).show();
                                } else {
                                        new MsgDialog({
                                                parentNode : me.getElementByXid("panel_main")
                                        }).show({
                                                title:'提醒',
                                                type:"OK",
                                                message:data.errorMsg
                                        });
                                }
                        });
                }

                function onLoadImageFail(error){
                        new MsgDialog({
                                parentNode : me.getElementByXid("panel_main")
                        }).show({
                                title:'错误',
                                type:"OK",
                                message:error
                        });
                }
        };



18

主题

53

帖子

137

积分

初级会员

Rank: 2

积分
137
QQ
 楼主| 发表于 2018-2-1 20:19:03 | 显示全部楼层
已经找到了解决方法
http://bbs.wex5.com/forum.php?mo ... page=2#pid165474010

/Native/plugins/cordova-plugin-inappbrowser 插件,下面的/src/android/res/filepaths.xml文件中的这一行  <external-path path="" name="external-path" />删除
然后重新打包
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-9-27 23:29 , Processed in 0.062887 second(s), 26 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

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