web-view使用scanQRCode接口
发布于 5 年前 作者 xia19 18208 次浏览 来自 问答

//web-view嵌入的网页代码

//微信签名后

wx.config({
    debug: false,
    appId: res.data.appId,
    timestamp: res.data.timestamp,
    nonceStr: res.data.nonceStr,
    signature: res.data.signature,
    beta: true,
     jsApiList: ['checkJsApi','scanQRCode']
});
wx.ready(function(){   
wx.checkJsApi({
                jsApiList: ['checkJsApi','scanQRCode'],
                success : function(res) {
                        console.log(res)
                }
       });
wx.scanQRCode({
            needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
                scanType: ["qrCode","barCode"], // 可以指定扫二维码还是一维码,默认二者都有
                success: function (res) {                  
                    alert(JSON.stringify(res))
                },
                fail:function(res){
                    alert(JSON.stringify(res))
                }
                 
});
 
}

bug描述:

使用jweixin-1.3.2.js。在微信中直接打开网页可以正常调用scanQRCode()接口,在小程序的web-view在部分android机型上报以下错误。checkJsApi返回scanQRCode为true。

3 回复

请问下楼主前端请求签名等信息的时候需要传url给后端吗?还有后端使用的appid和密钥是用的公众号的还是小程序的?

同求答案,项目上线在即,坑死个人了。

回到顶部