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('路径或文件不存在')
                  });
                })
              })
            }
  • 相关阅读:
    HDFS 2.X新特性
    kettle的系列教程
    Kettle基本使用
    MySQL流程控制结构
    MySQL函数
    MySQL存储过程和函数
    MySQL变量
    MySQL视图
    TCL(事务控制语言)
    MySQL标识列(自增长列)
  • 原文地址:https://www.cnblogs.com/fanqiuzhuji/p/13166089.html
Copyright © 2011-2022 走看看