From 07925905f1a596e20e980de6d42db217abb753b0 Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期五, 12 十二月 2025 18:06:11 +0800
Subject: [PATCH] plugin

---
 App.vue |  101 ++++++++++++++++++++++++++++++++++----------------
 1 files changed, 68 insertions(+), 33 deletions(-)

diff --git a/App.vue b/App.vue
index 2e4a818..7b95096 100644
--- a/App.vue
+++ b/App.vue
@@ -5,6 +5,7 @@
 		showError
 	} from "@/js/Page.js"
 	const rfidModule = uni.requireNativePlugin('RFIDModule');
+	// const honrfidModule = uni.requireNativePlugin('HonRFIDModule');
 	var main;
 	export default {
 		globalData: {
@@ -39,11 +40,20 @@
 			this.init();
 		},
 		onUnload() {
-
-			if (this.deviceInfo?.brand.includes('alps')) { // 姹夊痉闇嶅皵璁惧鐗瑰緛
-				// 姹夊痉闇嶅皵 PDA rfid鎵爜椤甸潰鍗歌浇鏃堕噴鏀捐祫婧�-				if (rfidModule) {
-					rfidModule.closeModule();
+			if (this.deviceInfo) {
+				if (this.deviceInfo?.brand.includes('alps')) { // 姹夊痉闇嶅皵璁惧鐗瑰緛
+					// 姹夊痉闇嶅皵 PDA rfid鎵爜椤甸潰鍗歌浇鏃堕噴鏀捐祫婧�+					if (rfidModule) {
+						rfidModule.closeModule();
+					}
+				} else if (this.deviceInfo?.brand.includes('honeywell') || this.deviceInfo?.deviceBrand.includes(
+						'honeywell')) {
+					// 闇嶅凹闊﹀皵 PDA rfid鎵爜椤甸潰鍗歌浇鏃堕噴鏀捐祫婧�+					if (rfidModule) {
+						rfidModule.closeModule();
+					}
+				} else {
+					main.unregisterReceiver(receiver); // 鍋滄鐩戝惉骞挎挱
 				}
 			} else {
 				main.unregisterReceiver(receiver); // 鍋滄鐩戝惉骞挎挱
@@ -65,24 +75,42 @@
 
 			init() {
 				let that = this;
+				console.log(this.deviceInfo);
+				if (this.deviceInfo) {
+					if (this.deviceInfo.brand.includes('alps')) { // 姹夊痉闇嶅皵璁惧鐗瑰緛
 
-				if (this.deviceInfo?.brand.includes('alps')) { // 姹夊痉闇嶅皵璁惧鐗瑰緛
+						rfidModule.initModule((res) => {
+							console.log("alps rfid initModule", res)
+							if (res.code < 0) {
+								showInfo(res.msg);
+							}
 
-					rfidModule.initModule((res) => {
-						console.log("rfid initModule", res)
-						if (res.code < 0) {
-							showInfo(res.msg);
-						}
+						})
+					} else if (this.deviceInfo.brand.includes('honeywell') || this.deviceInfo.deviceBrand.includes(
+							'honeywell')) { // 闇嶅凹闊﹀皵
+						console.log("honeywell rfid initModule")
+						rfidModule.initModule("honeywell",(res) => {
+							console.log("rfid initModule", res)
+							if (res.code < 0) {
+								showInfo(res.msg);
+							}
+						
+						})
 
-					})
-				} else if (this.deviceInfo?.brand.includes('mobiwire') || this.deviceInfo?.deviceBrand.includes(
-						'mobiwire')) { // 闇嶅凹闊﹀皵
+					} else if (this.deviceInfo.brand.includes('mobiwire') || this.deviceInfo.deviceBrand.includes(
+							'mobiwire')) { // 闇嶅凹闊﹀皵
 
-					this.initMobiwireScan()
+						this.initMobiwireScan()
+					} else {
+
+						console.log(this.initScan);
+						this.initScan()
+					}
 				} else {
 
 					this.initScan()
 				}
+
 			},
 			initMobiwireScan() {
 				main = plus.android.runtimeMainActivity(); // 鑾峰彇涓�activity
@@ -127,32 +155,39 @@
 				main.registerReceiver(receiver, filter); //娉ㄥ唽鐩戝惉	
 			},
 			onScan(callback) {
-				if (this.deviceInfo?.brand.includes('alps')) { // 姹夊痉闇嶅皵璁惧鐗瑰緛
-					if (!rfidModule)
-						return
-					rfidModule.startScan((ret) => {
-						console.log("startScan", ret)
-						let text = ""
-						if (ret.code < 0) {
-							showInfo(ret.msg);
-						} else {
-							const data = ret.data || []
-							if (Array.isArray(data)) {
-								if (data.length > 0)
-									text = data[0].epc
+				if (this.deviceInfo) {
+					if (this.deviceInfo?.brand.includes('alps') ||(this.deviceInfo?.brand.includes('honeywell') || this.deviceInfo?.deviceBrand.includes(
+							'honeywell'))) { // 姹夊痉闇嶅皵璁惧鐗瑰緛
+						if (!rfidModule)
+							return
+						rfidModule.startScan((ret) => {
+							console.log("startScan", ret)
+							let text = ""
+							if (ret.code < 0) {
+								showInfo(ret.msg);
 							} else {
-								text = data.epc || ""
+								const data = ret.data || []
+								if (Array.isArray(data)) {
+									if (data.length > 0)
+										text = data[0].epc
+								} else {
+									text = data.epc || ""
+								}
+								callback(text);
 							}
-							callback(text);
-						}
-					})
+						})
+					} else {
+						uni.$off("scanresult");
+						uni.$on("scanresult", (result) => {
+							callback(result);
+						});
+					}
 				} else {
 					uni.$off("scanresult");
 					uni.$on("scanresult", (result) => {
 						callback(result);
 					});
 				}
-
 			},
 
 		}

--
Gitblit v1.9.1