企业微信 小程序 调用nfc读卡报错 ‘企业微信error action’, 怎么解决?
wx.qy.getNFCReaderState({
success: (res) => {
console.log(JSON.stringify(res), 'getNFCReaderState-success')
// todo what you want
this.startNFCReader()
},
fail: (res) => {
console.log(JSON.stringify(res), 'getNFCReaderState-fail')
wx.showModal({
title: 'NFC-Not-Support',
content: JSON.stringify(res),
})
}
})
startNFCReader() {
wx.qy.startNFCReader({
success: (res) => {
console.log(JSON.stringify(res), 'startNFCReader-success')
wx.showModal({
title: 'NFC-Start',
content: JSON.stringify(res),
})
// wx.onNFCReadMessage()
},
fail: (res) => {
console.log(JSON.stringify(res), 'fail')
}
})
},
onNFCReadMessage: function (e) {
console.log(JSON.stringify(e),'onNFCReadMessage')
if (1 == e.messageType) {
wx.showModal({
title: 'NFC-Id',
content: JSON.stringify(e),
})
} else if (2 == e.messageType) {
console.log('Auto-Stop')
wx.showModal({
title: 'NFC-Auto-Stop',
content: JSON.stringify(e),
})
}
},