const self = this
const u = navigator.userAgent
const app = navigator.appVersion
const isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)
let purl = ''
if (isIOS) {
purl = encodeURIComponent(window.localStorage.getItem('scanUrl'))
} else {
purl = encodeURIComponent(window.location.href.split('#')[0])
}
const params = {
url: purl
}
getWxConfig(params).then(res => {
console.log(res)
const { appId, timestamp, nonceStr, signature } = res
wx.config({
debug: true,
appId,
timestamp,
nonceStr,
signature,
jsApiList: [
'checkJsApi',
'scanQRCode'
]
})
wx.ready(function() {
wx.checkJsApi({
jsApiList: ['scanQRCode'],
success: function(res) {
wx.scanQRCode({
needResult: 1,
scanType: ['qrCode', 'barCode'],
success: function(res) {
var result = res.resultStr
self.invoiceStoreNumber = result
}
})
}
})
})
}, err => {})
你好,请参考https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html
参照这个步骤挨个检查了,都完全符合要求,还是不能调用,还是报invalid signature,我的是微信个人订阅号,没有认证,但是接口权限中即使没有认证,也是可以使用js调用微信扫一扫的。到底什么原因,微信技术可不可专门解答一下。