| | |
| | | } else if (platform == "android") { |
| | | // uni.getDeviceInfo().platform = "android" |
| | | console.log(uni.getDeviceInfo()) //这里是拿到安卓的系统版本名 如:Android 9 |
| | | systemVersion = 10 |
| | | try { |
| | | var s = '' + (uni.getDeviceInfo().system || '') |
| | | console.log('输出系统版本号', s.substring(s.length - ( |
| | | s.length - |
| | | 8), s.length - (s.length - 8) + |
| | | 1)) //这里为了获取到系统的版本号,如 9 |
| | | systemVersion = s.substring(s.length - (s.length - |
| | | 8), s.length - (s.length - 8) + 1) |
| | | } catch (e) { |
| | | that.$message.showToast('获取系统版本错误,版本号:' + s) |
| | | systemVersion = 10 |
| | | } |
| | | var systemVersion = 10 |
| | | // try { |
| | | // var s = '' + (uni.getDeviceInfo().system || '') |
| | | // console.log('输出系统版本号', s.substring(s.length - ( |
| | | // s.length - |
| | | // 8), s.length - (s.length - 8) + |
| | | // 1)) //这里为了获取到系统的版本号,如 9 |
| | | // systemVersion = s.substring(s.length - (s.length - |
| | | // 8), s.length - (s.length - 8) + 1) |
| | | // } catch (e) { |
| | | // that.$message.showToast('获取系统版本错误,版本号:' + s) |
| | | // systemVersion = 10 |
| | | // } |
| | | if (systemVersion > 5) { |
| | | wx.getSetting({ |
| | | success: function(res) { |
| | |
| | | } |
| | | } |
| | | // 数据赋值 关闭刷新 |
| | | that.list = devices |
| | | that.list = devices || [] |
| | | that.isScanning = false |
| | | |
| | | wx.hideLoading() |
| | |
| | | }, |
| | | fail(e) { |
| | | that.$message.showToast('获取蓝牙设备出错:' + (e || '')) |
| | | |
| | | |
| | | } |
| | | }) |
| | | }, 3000) //到这里 都是三秒后执行的内容 |
| | |
| | | wx.showToast({ |
| | | title: '已打印第' + currentPrint + '张', |
| | | }) |
| | | if (currentPrint == printNum) { |
| | | that.looptime = 0 |
| | | that.lastData = 0 |
| | | that.currentTime = 1 |
| | | that.isReceiptSend = false |
| | | that.isLabelSend = false |
| | | that.currentPrint = 1 |
| | | // if (currentPrint == printNum) { |
| | | that.looptime = 0 |
| | | that.lastData = 0 |
| | | that.currentTime = 1 |
| | | that.isReceiptSend = false |
| | | that.isLabelSend = false |
| | | that.currentPrint = 1 |
| | | try { |
| | | wx.closeBLEConnection({ |
| | | deviceId: that.deviceId, |
| | | success: function(res) { |
| | | console.log("关闭蓝牙成功") |
| | | }, |
| | | }) |
| | | } catch (e) { |
| | | |
| | | } else { |
| | | currentPrint++ |
| | | |
| | | that.currentPrint = currentPrint |
| | | that.currentTime = 1 |
| | | |
| | | that.Send(buff) |
| | | } |
| | | |
| | | // } else { |
| | | // currentPrint++ |
| | | |
| | | // that.currentPrint = currentPrint |
| | | // that.currentTime = 1 |
| | | |
| | | // that.Send(buff) |
| | | // } |
| | | } |
| | | } |
| | | }) |