关于移动端影像配置了https之后拍出来的照片在android手机无法显示的问题

话不多说上代码

// 函数-从url读取文件
            readFile(img){
                let vm = this;
                window.resolveLocalFileSystemURL(img.orgSrc, function(fileEntry) {
                    fileEntry.file(function (file) {
                        let reader = new FileReader();
                        let reader2 = new FileReader();
                        reader.readAsArrayBuffer(file);
                        reader2.readAsDataURL(file);

                        reader2.onloadend = function (e) {
                            console.log(e);
                            console.log(JSON.stringify(e));
                            let image = {
                                thumbnailurl:this.result,
                                // address:fileEntry.toInternalURL(), //address
                                imageId :img.imageId,
                                orgSrc:img.orgSrc, //file_path
                                imageName:img.imageName, //file_name
                            };
                            vm.imgList.push(image);
                        };


                        reader.onloadend = function (e) {
                            console.log('e.target.result',e.target.result)
                            var file = new Blob([e.target.result], {type: "image/jpeg"});
                            vm.addFile(file,img.imageId,img.imageName);
                            console.log('file',file)
                        };
                    }, function (e) {
                      console.log("fileEntry.file==="+JSON.stringify(e));
                    });
                }, function (e) {
                      console.log("resolveLocalFileSystemURL==="+JSON.stringify(e));
                });
            },

 

posted @ 2019-01-08 15:29  codeMing  阅读(382)  评论(0编辑  收藏  举报