import bridge from '@/utils/bridge' // 设置当前是否是NFC设备 const SET_IS_NFC_DEVICE = 'SET_IS_NFC_DEVICE' export default { namespaced: true, state: { NFCCode: ['X960_6762_66_P'], isNFCDevice: false }, mutations: { /** * 设置当前是否是nfc设备 */ [SET_IS_NFC_DEVICE](state, payload) { state.isNFCDevice = payload } }, actions: { /** * 初始化nfc设备 */ initNFCDevice({ commit, state }) { bridge.geOtgReadType((code = '') => { commit(SET_IS_NFC_DEVICE, state.NFCCode.includes(code.toUpperCase())) }) }, /** * 获取nfc设备中的数据 */ getNFCData({ commit, state }) { bridge.readIDCardByOTG(data => { console.log(data) }) } } }