|
@@ -33,8 +33,17 @@
|
|
},
|
|
},
|
|
computed: mapState(['sysinfo', 'Bluetooth']),
|
|
computed: mapState(['sysinfo', 'Bluetooth']),
|
|
onLoad() {
|
|
onLoad() {
|
|
- // console.log(this.Bluetooth)
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
|
|
+ },
|
|
|
|
+ onShow() {
|
|
|
|
+ // if(this.Bluetooth){
|
|
|
|
+ // uni.navigateTo({
|
|
|
|
+ // url: '/pages/erpbusiness/sendCommand'
|
|
|
|
+ // })
|
|
|
|
+ // }
|
|
|
|
+ console.log(this.Bluetooth)
|
|
},
|
|
},
|
|
onUnload() {
|
|
onUnload() {
|
|
//停止搜索蓝牙设备
|
|
//停止搜索蓝牙设备
|
|
@@ -153,9 +162,9 @@
|
|
//校验权限
|
|
//校验权限
|
|
checkPemission() {
|
|
checkPemission() {
|
|
let that = this
|
|
let that = this
|
|
- let {
|
|
|
|
|
|
+ let
|
|
BLEInformation
|
|
BLEInformation
|
|
- } = that.Bluetooth;
|
|
|
|
|
|
+ = that.Bluetooth;
|
|
let platform = BLEInformation.platform;
|
|
let platform = BLEInformation.platform;
|
|
that.getBluetoothDevices();
|
|
that.getBluetoothDevices();
|
|
},
|
|
},
|
|
@@ -215,9 +224,9 @@
|
|
let {
|
|
let {
|
|
title
|
|
title
|
|
} = e.currentTarget.dataset;
|
|
} = e.currentTarget.dataset;
|
|
- let {
|
|
|
|
|
|
+ let
|
|
BLEInformation
|
|
BLEInformation
|
|
- } = that.Bluetooth;
|
|
|
|
|
|
+ = that.Bluetooth;
|
|
this.stopSearch();
|
|
this.stopSearch();
|
|
|
|
|
|
that.serviceId = 0;
|
|
that.serviceId = 0;
|
|
@@ -235,6 +244,7 @@
|
|
console.log('createBLEConnection success:', res)
|
|
console.log('createBLEConnection success:', res)
|
|
BLEInformation.deviceId = title;
|
|
BLEInformation.deviceId = title;
|
|
that.$store.commit('BLEInformationSet', BLEInformation);
|
|
that.$store.commit('BLEInformationSet', BLEInformation);
|
|
|
|
+ // console.log(this.Bluetooth,)
|
|
uni.hideLoading()
|
|
uni.hideLoading()
|
|
that.getSeviceId()
|
|
that.getSeviceId()
|
|
},
|
|
},
|
|
@@ -247,9 +257,9 @@
|
|
//获取蓝牙设备所有服务(service)。
|
|
//获取蓝牙设备所有服务(service)。
|
|
getSeviceId() {
|
|
getSeviceId() {
|
|
let that = this;
|
|
let that = this;
|
|
- let {
|
|
|
|
|
|
+ let
|
|
BLEInformation
|
|
BLEInformation
|
|
- } = that.Bluetooth;
|
|
|
|
|
|
+ = that.Bluetooth;
|
|
console.log('BLEInformation.deviceId:',BLEInformation.deviceId)
|
|
console.log('BLEInformation.deviceId:',BLEInformation.deviceId)
|
|
// uni.getBLEDeviceServices
|
|
// uni.getBLEDeviceServices
|
|
let t=setTimeout(()=>{
|
|
let t=setTimeout(()=>{
|
|
@@ -277,9 +287,9 @@
|
|
readCharacter: read,
|
|
readCharacter: read,
|
|
notifyCharacter: notify
|
|
notifyCharacter: notify
|
|
} = that;
|
|
} = that;
|
|
- let {
|
|
|
|
|
|
+ let
|
|
BLEInformation
|
|
BLEInformation
|
|
- } = that.Bluetooth;
|
|
|
|
|
|
+ = that.Bluetooth;
|
|
// uni.getBLEDeviceCharacteristics
|
|
// uni.getBLEDeviceCharacteristics
|
|
plus.bluetooth.getBLEDeviceCharacteristics({
|
|
plus.bluetooth.getBLEDeviceCharacteristics({
|
|
deviceId: BLEInformation.deviceId,
|
|
deviceId: BLEInformation.deviceId,
|
|
@@ -329,6 +339,7 @@
|
|
that.getCharacteristics()
|
|
that.getCharacteristics()
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
|
|
+ that.$store.commit('BLEInformationSet', BLEInformation);
|
|
that.openControl()
|
|
that.openControl()
|
|
}
|
|
}
|
|
},
|
|
},
|