移动端下载文件(mui框架)

for(var i = 0; i < data.photoList.photoAgoList.length; i++) {
console.log(JSON.stringify(data.photoList.photoAgoList))
var document_r = data.photoList.photoAgoList[i]; //文档对象


console.log(JSON.stringify(document_r));
var filelink = document_r.fileurl; //获取文档路径
console.log(JSON.stringify(filelink));
//dBase(filelink); //下载文档到手机本地 
var dtask = null;
var previmage = "../../../../app" + filelink;
var images = []; //维修前照片数组
images.push({
path: previmage
})
var html = template('imagelist', {
model: images
});


$('.row').html(html);


var imagesafter = [];
imagesafter.push(


)


console.log(JSON.stringify(images));
var s1 = filelink.lastIndexOf("/");
var filelink_real = "../app/" + filelink.substr(0, s1) + "/"; //文件真是路径
var httpfilelink = Const.ServerDomain + "/ioms/" + filelink;  //  服务器地址加上项目名称
console.log(JSON.stringify(filelink_real));


dtask = plus.downloader.createDownload(
httpfilelink, {
method: "GET",
filename: filelink_real,
},


//下载完成执行的回调函数  
function(d, status) {
console.log("完成")
// mui.toast(d.filename);
}
);
dtask.addEventListener("statechanged", function(task, status) {
if(!dtask) {
return;
}


});
dtask.start();


}

你可能感兴趣的:(混合app)