zoukankan      html  css  js  c++  java
  • h5+ 分享到"QQ"失败: {"code":-100,"message":"[ShareQQ分享:-6]非法的图片地址!, http://ask.dcloud.net.cn/article/287"}

    原因:

    QQ不支持网路图片地址,需要给api传本地图片地址,是file///:开头的路径,具体可以参考5+的地址转换方法
    requestFileSystem: 请求本地文件系统对象

    resolveLocalFileSystemURL: 通过URL参数获取目录对象或文件对象

    convertLocalFileSystemURL: 将本地URL路径转换成平台绝对路径

    convertAbsoluteFileSystem: 将平台绝对路径转换成本地URL路径

     if (a == 'qq') {
              $(function() {
                mui.plusReady(function() {
                  console.log(' mui.plusReady执行了')
                  // plus.io.resolveLocalFileSystemURL('_www/static/img/android.png', function(entry) {//安卓
                  plus.io.resolveLocalFileSystemURL('_www/static/img/ios.png', function(entry) {//ios
                    let pictures = [];
                    var dirReader = entry.toLocalURL();
                    pictures.push(dirReader);
                    console.log(pictures,'绝对路径')
                    let qq_msg = {
                      type: 'image', //分享的内容的类型
                      pictures:pictures,
                    }
                    plus.nativeUI.actionSheet({
                      title: '分享图片到QQ',
                      cancel: '取消',
                      buttons: _this.buttons1,
                    }, function(e) {
                      (e.index > 0) && _this.sharePage(_this.sqq, qq_msg, _this.buttons[e.index - 1]);
                    })
                  }, function(e) {
                    alert('路径或文件不存在')
                  });
                })
              })
            }
  • 相关阅读:
    java基础笔记-类与对象(多态)
    oracle中trim,ltrim,rtrim函数用法
    git stash
    update from select
    oracle 查看主外键约束
    eclipse git 解决冲突
    根据Request获取客户端IP
    简单说说Spring Security 使用(附加验证码登录,自定义认证)
    linux的nohup命令的用法
    Python包管理工具介绍
  • 原文地址:https://www.cnblogs.com/fanqiuzhuji/p/13166089.html
Copyright © 2011-2022 走看看