From 1b78e33e0d0340f3d45f87160abcb0f13f013774 Mon Sep 17 00:00:00 2001
From: xuxueyang <xuxy@fengyuntec.com>
Date: 星期五, 02 八月 2024 00:10:56 +0800
Subject: [PATCH] fix bug
---
sub_pages/supplier/print/print-list.vue | 91 +++++++++++++++++++++++++++++++++------------
1 files changed, 67 insertions(+), 24 deletions(-)
diff --git a/sub_pages/supplier/print/print-list.vue b/sub_pages/supplier/print/print-list.vue
index 66c3832..431f6a0 100644
--- a/sub_pages/supplier/print/print-list.vue
+++ b/sub_pages/supplier/print/print-list.vue
@@ -199,6 +199,12 @@
})
}
},
+ fail: function() {
+ wx.showModal({
+ title: '提示',
+ content: '蓝牙状态获取失败',
+ })
+ }
})
},
fail: function() {
@@ -221,13 +227,19 @@
} else if (platform == "android") {
// uni.getDeviceInfo().platform = "android"
console.log(uni.getDeviceInfo()) //这里是拿到安卓的系统版本名 如:Android 9
- console.log('输出系统版本号', uni.getDeviceInfo().system.substring(uni.getDeviceInfo().system.length - (
- uni.getDeviceInfo().system.length -
- 8), uni.getDeviceInfo().system.length - (uni.getDeviceInfo().system.length - 8) +
- 1)) //这里为了获取到系统的版本号,如 9
- var systemVersion = uni.getDeviceInfo().system.substring(uni.getDeviceInfo().system.length - (uni
- .getDeviceInfo().system.length -
- 8), uni.getDeviceInfo().system.length - (uni.getDeviceInfo().system.length - 8) + 1)
+ 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) {
@@ -237,14 +249,27 @@
scope: 'scope.userLocation',
complete: function(res) {
that.getBluetoothDevices()
- }
+ },
+ fail: function(res) {
+ that.$message.showToast('获取蓝牙系统位置信息错误')
+
+ },
})
} else {
that.getBluetoothDevices()
}
- }
+ },
+ fail: function(res) {
+ that.$message.showToast('获取系统设置错误' + (res || ''))
+
+ },
})
+ } else {
+ that.$message.showToast('获取系统版本过低,版本号:' + systemVersion)
+
}
+ } else {
+ that.$message.showToast('未知平台:' + (platform || '-'))
}
},
@@ -275,15 +300,23 @@
}
}
// 数据赋值 关闭刷新
- that.list = devices
+ that.list = devices || []
that.isScanning = false
wx.hideLoading()
wx.stopPullDownRefresh()
},
+ fail(e) {
+ that.$message.showToast('获取蓝牙设备出错:' + (e || ''))
+
+ }
})
}, 3000) //到这里 都是三秒后执行的内容
},
+ fail(e) {
+ that.$message.showToast('扫描蓝牙报错:' + (e || ''))
+
+ }
})
},
@@ -577,22 +610,32 @@
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)
+ // }
}
}
})
--
Gitblit v1.9.3