0

我用 Python+Flask 搭建了一个服务器,在我的页面中使用了 3rd 方 javascript SDK,这个页面会被微信打开。这是代码片段:

   document.querySelector('#scanQRCode1').onclick = function () {
       wx.scanQRCode({
         needResult: 1,
         desc: 'scanQRCode desc',
         success: function (res) {
        var newurl = "{{ url_for('ReturnStep1') }}" + "/" + res.resultStr;
        window.location.replace(newurl);
         }
       });

在 Android 上打开页面时,它可以正确重定向到新页面。但它会立即使用 res.resultStr 的内容刷新窗口。

在 iphone 上运行相同的代码时,它是正确的。

有没有人有任何想法?谢谢

4

1 回答 1

0

这是我在微信 API 文档中找到的两件事:

  1. needResult: 0, // 0 by default, with the scanning result processed by WeChat. The scanning result is directly returned if it is 1.
  2. 在微信安卓客户端通过扫描二维码打开的网页在调用scanQRCode API后会被关闭,扫描结果直接返回。(此问题已经微信团队确认,将在Android V6.1修复。)

我希望这有助于解释您面临的问题。

于 2015-11-02T09:09:52.550 回答