|
|
@@ -13,14 +13,15 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
open() {
|
|
|
+ if (this.show) return
|
|
|
this.show = true
|
|
|
this.onScan()
|
|
|
},
|
|
|
onScan() {
|
|
|
- this.getCofig()
|
|
|
+ this.getConfig()
|
|
|
const that = this
|
|
|
wx.ready(function() {
|
|
|
- console.log('测试')
|
|
|
+ console.log('测试2222')
|
|
|
wx.checkJsApi({
|
|
|
// 需要使用的JS接口列表,在这里只需要用到scanQRCode
|
|
|
jsApiList: ['scanQRCode'],
|
|
|
@@ -37,32 +38,18 @@ export default {
|
|
|
// window.location.href = result
|
|
|
},
|
|
|
error: function(response) {
|
|
|
- that.close()
|
|
|
- that.$nextTick(() => {
|
|
|
+ this.close()
|
|
|
+ this.$nextTick(() => {
|
|
|
that.$toast(response)
|
|
|
})
|
|
|
- },
|
|
|
- fail: function(err) {
|
|
|
- // 新增调用失败的处理方法
|
|
|
- that.close()
|
|
|
- that.$nextTick(() => {
|
|
|
- that.$toast('扫码失败: ' + (err && err.errMsg ? err.errMsg : '未知错误'))
|
|
|
- })
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
- },
|
|
|
- fail: function(err) {
|
|
|
- // checkJsApi 调用失败的处理
|
|
|
- that.close()
|
|
|
- that.$nextTick(() => {
|
|
|
- that.$toast('微信接口调用失败: ' + (err && err.errMsg ? err.errMsg : '未知错误'))
|
|
|
- })
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
- async getCofig() {
|
|
|
+ async getConfig() {
|
|
|
const that = this
|
|
|
const res = await getSignature({ url: encodeURIComponent(window.location.href.split('#')[0]) })
|
|
|
// console.log('res', res)
|
|
|
@@ -82,6 +69,7 @@ export default {
|
|
|
}
|
|
|
wx.config(params)
|
|
|
wx.error(function(res) {
|
|
|
+ console.log('测试测试111')
|
|
|
that.close()
|
|
|
alert('出错了👉' + res.errMsg) // wx.config配置错误,会弹出窗口哪里错误,然后根据微信文档查询即可。
|
|
|
})
|