漠
  • 发布:2017-12-07 23:00
  • 更新:2017-12-07 23:00
  • 阅读:1430

读取 "_doc"文件出错

分类:HTML5+

详细问题描述:步骤重现:
循环一:
步骤1: 使用H5+ ,调取摄像头拍照,保存路径为 "_doc",执行多次成功。确认这部分代码没错。
步骤2: 使用H5+ ,调取io模块,删除 "_doc"目录下的所有文件, 执行成功,确认“_doc”目录没有文件,
步骤3: 使用H5+, 调取zip模块,配合相册模块压缩图片,保存路径为“_doc/”, 成功回掉函数执行
步骤4: 使用H5+, 调取io模块,查询到“_doc”目录下为空

循环二:
重复步骤1,3,4,
步骤一成功回掉函数执行,
步骤四查询“_doc”目录为空,
步骤3,成功回调函数不执行,失败函数执行。

多次循环,返回循环二结果。

删除手机端调试基座,重启pc端HBuilder,
执行步骤1.3.4,得到循环一结果。
再次执行1.3.4,得到循环二结果

[期望]
期望压缩成功后的新文件能够正确保存在指定路径下

运行环境
android6.0,huilder最新版

function duqu (){  
//读取“_doc”目录下所有文件  
    plus.io.requestFileSystem(2, function(fs) {  
        var directoryReader = fs.root.createReader();  
        directoryReader.readEntries(function(entries) {  
            var i;  
            console.log(entries.length)  
            for(i = 0; i < entries.length; i++) {  
                console.log(entries[i].name)  
            }  
        }, function(e) {  
            alert("Read entries failed: " + e.message);  
        });  
    });  
}  

function yasuo (url,imgDom){  
//压缩文件  
    var pp = "";  
    var rname = fileName(url);  
    console.log(rname)  
    plus.zip.compressImage({  
        src:url,  
        dst: sg("src"),  
        quality:20,  
        overwrite:true,  
        width:'50%',  
        clip:{  
            top:"25%",  
            left:"25%",  
            width:"50%",  
            height:"50%"  
        }  
    },  
    function(i){  
        //display.style.display="block";  
        imgDom.src=i.target+rname;  
        pp = i.target;  
        mui.toast("图片压缩成功")  
        duqu()  
        console.log("压缩图片成功:"+JSON.stringify(i));  
    },function(e){  
        plus.nativeUI.closeWaiting();  
        mui.toast("压缩图片失败: "+JSON.stringify(e));  
        console.log("压缩图片失败: "+JSON.stringify(e));  
    });  
    return pp;  
}  

//部分拍照代码  
cmr.captureImage(function(path){  
            read(path,function(e){  
            lcb(".por>img").src = e.fullPath;  
            sg("userPor",e.fullPath);                             
            })  
    }, function(){}, {filename:'_doc/',index:1});  

[QQ]690871024

2017-12-07 23:00 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复