function save___img(picurl) {

// 创建下载任务
// picurl="http://*************/Public/Uploads/dingwei/erwei.png";
//图片保存到手机后的路径
// picname="_downloads/"+randomString(16)+".png";
plus.nativeUI.showWaiting('加载中...');
var dtask = plus.downloader.createDownload(picurl, {}, function ( d, status ) {
console.log(status);
// 下载完成
if ( status == 200 ) {
// alert( "Download success: " + d.filename );
plus.gallery.save(d.filename,function() {//保存到相册方法
plus.nativeUI.closeWaiting();
mui.toast('已保存到手机相册');
}, function() {
plus.nativeUI.closeWaiting();
mui.toast('保存失败,请重试!');
});
} else {
// alert( "Download failed: " + status );

mui.toast("下载失败");
}
});
//dtask.addEventListener( "statechanged", onStateChanged, false );
dtask.start();//开始下载
}

相关文章:

  • 2021-11-25
  • 2021-10-01
  • 2021-10-26
  • 2021-12-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-28
  • 2021-06-12
  • 2022-12-23
  • 2021-07-13
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案