更新记录
0.1(2022-03-21)
亿数身份证读卡器
const FanBluetooth = uni.requireNativePlugin('Fan-Bluetooth-YishuModule');
methods: {
readCard() {
uni.showLoading({
title: '开始读卡...',
mask: true
});
FanBluetooth.readCard((ret) => {
uni.hideLoading();
if (ret.code == "1") {
let cardInfo = ret.data;
this.formData.idcard = cardInfo.number;
this.formData.customername = cardInfo.name;
this.formData.minority = cardInfo.nation + "族";
this.formData.addr = cardInfo.address;
this.formData.thumbnail = ('data:image/png;base64,' + cardInfo.image);
this.analysisIdCard(this.formData.idcard);
let nation = this.nationOptions.find(item => (item.datainfo == this.formData.minority));
this.formData.nation = nation.id;
} else {
this.initBluetoothReader();
}
});
},
initBluetoothReader() {
FanBluetooth.initBluetoothReader((res) => {
if (res.code == "1") {
this.getBluetoothDevices();
} else {
uni.showToast({
title: res.msg,
duration: 2000,
icon: "none"
});
}
})
},
getBluetoothDevices() {
var ret = FanBluetooth.getBluetoothDevice();
if (ret) {
if (ret.code == "1") {
this.bluetoothDeviceList = ret.data;
this.$refs.bluetoothDevicePopup.open();
} else {
uni.showToast({
title: ret.msg,
duration: 2000,
icon: "none"
});
}
} else {
uni.showToast({
title: "设备获取失败",
duration: 2000,
icon: "none"
});
}
},
connectBlueTooth(item) {
let timer = setTimeout(() => {
this.$refs.bluetoothDevicePopup.close();
uni.hideLoading();
this.readCard();
}, 10000);
uni.showLoading({
title: '连接中...',
mask: true
});
FanBluetooth.blueToothConnection({
address: item.address
}, (ret) => {
clearTimeout(timer);
uni.hideLoading();
if (ret.code == "0") {
uni.showToast({
title: ret.msg,
duration: 2000,
icon: "none"
});
}
});
}
}
超思C208指夹式脉搏血氧仪
const FanBluetooth = uni.requireNativePlugin('Fan-Bluetooth-ChoicemmedModule');
methods: {
readData() {
FanBluetooth.getChoicemmedDeviceData((res) => {
if (res.code == '1') {
this.spoData.cl_value = res.spo
} else {
uni.showToast({
title: res.msg,
icon: 'none'
});
}
})
}
}
平台兼容性
Android | Android CPU类型 | iOS |
---|---|---|
适用版本区间:5.0 - 10.0 | armeabi-v7a:支持,arm64-v8a:支持,x86:支持 | × |
原生插件通用使用流程:
- 购买插件,选择该插件绑定的项目。
- 在HBuilderX里找到项目,在manifest的app原生插件配置中勾选模块,如需要填写参数则参考插件作者的文档添加。
- 根据插件作者的提供的文档开发代码,在代码中引用插件,调用插件功能。
- 打包自定义基座,选择插件,得到自定义基座,然后运行时选择自定义基座,进行log输出测试。
- 开发完毕后正式云打包
付费原生插件目前不支持离线打包。
Android 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/android
iOS 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/ios
注意事项:使用HBuilderX2.7.14以下版本,如果同一插件且同一appid下购买并绑定了多个包名,提交云打包界面提示包名绑定不一致时,需要在HBuilderX项目中manifest.json->“App原生插件配置”->”云端插件“列表中删除该插件重新选择
亿数身份证读卡器
const FanBluetooth = uni.requireNativePlugin('Fan-Bluetooth-YishuModule');
methods: {
readCard() {
uni.showLoading({
title: '开始读卡...',
mask: true
});
FanBluetooth.readCard((ret) => {
uni.hideLoading();
if (ret.code == "1") {
let cardInfo = ret.data;
this.formData.idcard = cardInfo.number;
this.formData.customername = cardInfo.name;
this.formData.minority = cardInfo.nation + "族";
this.formData.addr = cardInfo.address;
this.formData.thumbnail = ('data:image/png;base64,' + cardInfo.image);
this.analysisIdCard(this.formData.idcard);
let nation = this.nationOptions.find(item => (item.datainfo == this.formData.minority));
this.formData.nation = nation.id;
} else {
this.initBluetoothReader();
}
});
},
initBluetoothReader() {
FanBluetooth.initBluetoothReader((res) => {
if (res.code == "1") {
this.getBluetoothDevices();
} else {
uni.showToast({
title: res.msg,
duration: 2000,
icon: "none"
});
}
})
},
getBluetoothDevices() {
var ret = FanBluetooth.getBluetoothDevice();
if (ret) {
if (ret.code == "1") {
this.bluetoothDeviceList = ret.data;
this.$refs.bluetoothDevicePopup.open();
} else {
uni.showToast({
title: ret.msg,
duration: 2000,
icon: "none"
});
}
} else {
uni.showToast({
title: "设备获取失败",
duration: 2000,
icon: "none"
});
}
},
connectBlueTooth(item) {
let timer = setTimeout(() => {
this.$refs.bluetoothDevicePopup.close();
uni.hideLoading();
this.readCard();
}, 10000);
uni.showLoading({
title: '连接中...',
mask: true
});
FanBluetooth.blueToothConnection({
address: item.address
}, (ret) => {
clearTimeout(timer);
uni.hideLoading();
if (ret.code == "0") {
uni.showToast({
title: ret.msg,
duration: 2000,
icon: "none"
});
}
});
}
}
超思C208指夹式脉搏血氧仪
const FanBluetooth = uni.requireNativePlugin('Fan-Bluetooth-ChoicemmedModule');
methods: {
readData() {
FanBluetooth.getChoicemmedDeviceData((res) => {
if (res.code == '1') {
this.spoData.cl_value = res.spo
} else {
uni.showToast({
title: res.msg,
icon: 'none'
});
}
})
}
}