jf 5 лет назад
Родитель
Сommit
5db8f36596
1 измененных файлов с 8 добавлено и 4 удалено
  1. 8 4
      ghsApp/src/mixins/BLE.js

+ 8 - 4
ghsApp/src/mixins/BLE.js

@@ -23,11 +23,10 @@ export default {
 	methods: {
 		//断开蓝牙链接
 		destroyed(BleVal) {
-			this.BleVal = BleVal;
 			let self = this;
 			uni.closeBLEConnection({deviceId: uni.getStorageSync('BLE').deviceId,success(res) {
 					console.log(res);
-					self.autoLinkBle();
+					self.autoLinkBle(BleVal);
 				}
 			});
 			// if (this.connId != "") {
@@ -274,6 +273,8 @@ export default {
 			realWriteData(sendloop, i);
 		},
 		senBleLabel() {
+			let BleVal = this.BleVal;
+			console.log(BleVal,'BleValBleVal')
 			let currDev = uni.getStorageSync('BLE');
 			//标签模式
 			let deviceId = currDev.deviceId;
@@ -283,8 +284,11 @@ export default {
 			command.setSize(40, 60);
 			command.setGap(2);
 			command.setCls();
-			command.setText(this.BleVal[0].name);
-			command.setText(this.BleVal[0].phone);
+			for (let i=0;i<BleVal.length;i++){
+				command.setText(BleVal[i].name);
+				command.setText(BleVal[i].phone);
+			}
+
 			command.setPagePrint();
 			this.senBlData(deviceId, serviceId, characteristicId, command.getData());
 		},