Bladeren bron

bug 修复

lilei 4 jaren geleden
bovenliggende
commit
44df2254b2
1 gewijzigde bestanden met toevoegingen van 10 en 17 verwijderingen
  1. 10 17
      pages/index/index.vue

+ 10 - 17
pages/index/index.vue

@@ -126,17 +126,8 @@
 				let _this = this
 				// 连接成功
 				if(this.connectStatus){
-					uni.showModal({
-						title:'提示',
-						content:'请检查物品是否已经放在电子秤上?',
-						complete(e) {
-							console.log(e)
-							if(e.confirm){
-								 uni.navigateTo({
-								 	url: '/pages/userAuth/userAuth?deviceId=' + _this.deviceId
-								 })
-							}
-						}
+					uni.navigateTo({
+						url: '/pages/userAuth/userAuth?deviceId=' + _this.deviceId
 					})
 				}else{
 					let hasDev = this.deviceList.length
@@ -235,7 +226,6 @@
 				    console.log(res)
 					// 监听寻找到新设备的事件
 					uni.onBluetoothDeviceFound(function (res) {
-				      console.log(res,'devices list')
 					  let devices = res.devices.filter(item => item.name == 'FAYA')
 					  console.log(devices,'devices list')
 					  if(devices.length){
@@ -279,7 +269,7 @@
 					_this.connectedDeviceId = _this.deviceId
 					// 获取连接设备的service服务
 					setTimeout(()=>{
-						_this.getBLEDeviceServices()						  
+						_this.getBLEDeviceServices()
 					},1000)
 				  },
 				  fail(err) {
@@ -358,13 +348,16 @@
 					success(res) {
 						console.log(res,'notifyBLECharacteristicValueChange')
 						that.statusStr = '连接成功,请投放称重'
-						that.connectStatus = true
+						if(!that.connectStatus){
+							uni.$emit('blueConnectCallback',1)
+							that.connectStatus = true
+							uni.hideLoading()
+						}
 						that.loading = false
-						uni.$emit('blueConnectCallback',1)
-						uni.hideLoading()
+						
 						/*用来监听手机蓝牙设备的数据变化*/
 						uni.onBLECharacteristicValueChange(function(res) {
-							// console.log(res,'read data')
+							console.log(res,'read data')
 							that.balanceData = that.buf2string(res.value)
 							that.$u.vuex('vuex_balanceData',that.balanceData)
 						})