zoukankan      html  css  js  c++  java
  • app保存图片

    <div class="mui-content indexBg">
    <a href="javascript:void();" onclick="dfileimg()"><img src="http://6.a2klw.cn{$erwei}" alt="" class="codeimh" ></a>
    </div>

    // 扩展API加载完毕后调用onPlusReady回调函数 
    document.addEventListener("plusready", onPlusReady, false);
    function onPlusReady(){}
     
     function dfileimg(){


          var self = plus.webview.currentWebview();
          var imgsrc=$(".codeimh").attr("src");
          plus.nativeUI.showWaiting('加载中...')
          var dtask = plus.downloader.createDownload(imgsrc, {}, function (d, status) {
      

            // 下载完成
            if (status == 200) {
              layer.open({
              content: '下载成功,文件保存在'+d.filename,
              skin: 'msg',
              time: 2 //停留2秒
              });
              plus.gallery.save(d.filename, function () {
      //保存到相册方法
              plus.nativeUI.closeWaiting()
             layer.open({
             content: '已保存到手机相册!',
             skin: 'msg',
             time: 2 //停留2秒
             }); 
              }, function () {
              plus.nativeUI.closeWaiting();
             layer.open({
             content: '保存失败,请重试!',
             skin: 'msg',
             time: 2 //停留2秒
             }); 
              });
            } else {
             layer.open({
             content: '下载失败!',
             skin: 'msg',
             time: 2 //停留2秒
             }); 
            }
          });
          dtask.start(); 
     
    }

  • 相关阅读:
    逻辑回归(logistics regression) 总结
    SQL注入原理
    xss绕过过滤之方法
    PHP CALC
    IP欺骗原理与过程分析
    DNS域传送漏洞利用
    linux性能测试工具perf
    linux设置程序开机自启
    Http请求中Content-Type和Accept讲解以及在Spring MVC中的应用
    random函数的使用
  • 原文地址:https://www.cnblogs.com/sure2016/p/10591366.html
Copyright © 2011-2022 走看看