diff --git a/pages/6155/deviceDetail.vue b/pages/6155/deviceDetail.vue
index 6dae39d..952b0be 100644
--- a/pages/6155/deviceDetail.vue
+++ b/pages/6155/deviceDetail.vue
@@ -77,7 +77,7 @@
泛光模式
-
+
+
@@ -938,7 +938,9 @@
if (res.statusCode === 200) {
if (res.data.code == 200) {
console.log("上传完成,耗时:" + m + "分" + s + "秒");
- updateLoading(these,{text:"上传完成,耗时:" + m + "分" + s + "秒,正在切片。"})
+ updateLoading(these, {
+ text: "上传完成,耗时:" + m + "分" + s + "秒,正在切片。"
+ })
resolve(res.data);
return;
@@ -1004,7 +1006,7 @@
}
});
}
-
+
//发送视频到设备
let shotVideoClick = (array, type, ReSendNo) => {
var sendImagePackets = () => {
@@ -1033,37 +1035,38 @@
resolve();
return;
}
-
+
if (!array[imgIndex]) {
console.error("没有找到对应的帧数据", imgIndex);
reject(`帧数据缺失,索引 ${imgIndex}`);
return;
}
-
+
let childPacketsGroup = array[imgIndex][imgPackIndex];
if (!childPacketsGroup || !childPacketsGroup.length) {
console.error("帧数据结构异常", imgIndex, imgPackIndex);
reject(`帧数据结构异常,帧 ${imgIndex}`);
return;
}
-
+
let packetData = childPacketsGroup[childPacketIndex];
let packetSize = packetData.length;
-
+
const isFirstChild = childPacketIndex === 0;
- const isLastChild = childPacketIndex === (childPacketsGroup.length - 1);
-
+ const isLastChild = childPacketIndex === (childPacketsGroup
+ .length - 1);
+
if (isFirstChild) {
packetSize = packetData.length + 8;
}
-
+
if (isLastChild) {
packetSize = packetData.length + (isFirstChild ? 9 : 1);
}
-
+
const buffer = new ArrayBuffer(packetSize);
const dataView = new DataView(buffer);
-
+
let start = 0;
if (isFirstChild) {
// 填充头部
@@ -1077,28 +1080,30 @@
dataView.setUint8(7, imgPackIndex + 1);
start = 8;
}
-
+
for (let i = 0; i < packetData.length; i++) {
dataView.setUint8(start + i, these.toByteValue(packetData[i]));
}
-
+
if (isLastChild) {
dataView.setUint8(packetSize - 1, 0xFF);
}
let inteval = parseInt(this.inteval ? this.inteval : 80);
-
- ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId).then(() => {
+
+ ble.sendData(f.deviceId, buffer, f.writeServiceId, f
+ .wirteCharactId).then(() => {
if (ReSendNo) {
resolve();
return;
}
// 更新进度
this.currentPacket = currentPacket;
-
- updateLoading(these,{
- text:'正在发送:'+currentPacket+"/"+totalPackets
+
+ updateLoading(these, {
+ text: '正在发送:' + currentPacket + "/" +
+ totalPackets
});
-
+
childPacketIndex++;
if (childPacketIndex >= childPacketsGroup.length) {
childPacketIndex = 0;
@@ -1110,7 +1115,7 @@
}
// 发送下一个包(添加延迟避免蓝牙缓冲区溢出)
currentPacket++;
-
+
setTimeout(sendNextPacket, inteval);
}).catch(err => {
if (err.code == 10007) {
@@ -1119,9 +1124,11 @@
setTimeout(sendNextPacket, 100);
return;
}
-
+
console.error(err.errMsg + ",发送失败了" + currentPacket);
- updateLoading(these,{text:"发送失败,"+err.errMsg});
+ updateLoading(these, {
+ text: "发送失败," + err.errMsg
+ });
reject(err);
});
};
@@ -1134,7 +1141,7 @@
uni.chooseVideo({
sourceType: ['album'],
success: function(res) {
- console.log("res=",res);
+ console.log("res=", res);
let path = res.tempFilePath;
// iOS可能返回浮点数,需要转换为整数进行比较
let width = Math.round(res.width);
@@ -1185,29 +1192,32 @@
}
videoCutPacket(convertedData).then(array => {
-
- let start = new Date();
- console.log("开始发送");
- shotVideoClick(array).then(() => {
- console.log("发送完成");
- let end = new Date();
- var diff = (end.getTime() - start.getTime()) / 1000;
- let s =parseInt(diff % 60);
- let m =parseInt((diff - s) / 60);
- console.log("发送完成,耗时:" + m + "分" + s + "秒");
- updateLoading(these,{
- text: "发送完成,耗时:" + m + "分" + s + "秒",
- });
-
- }).catch((ex1) => {
- console.log("出现了异常", ex1)
- }).finally(() => {
- timeDelayCloseLoading();
- });
-
-
-
-
+
+ let start = new Date();
+ console.log("开始发送");
+ shotVideoClick(array).then(() => {
+ console.log("发送完成");
+ let end = new Date();
+ var diff = (end.getTime() - start
+ .getTime()) / 1000;
+ let s = parseInt(diff % 60);
+ let m = parseInt((diff - s) / 60);
+ console.log("发送完成,耗时:" + m + "分" +
+ s + "秒");
+ updateLoading(these, {
+ text: "发送完成,耗时:" + m +
+ "分" + s + "秒",
+ });
+
+ }).catch((ex1) => {
+ console.log("出现了异常", ex1)
+ }).finally(() => {
+ timeDelayCloseLoading();
+ });
+
+
+
+
}).catch(err => {
timeDelayCloseLoading();
});
@@ -1470,6 +1480,24 @@
these.showBleUnConnect()
return;
}
+ let err = false;
+ this.formData.textLines.find((txt) => {
+ if (txt.length === 0 || txt.length > 7) {
+ console.log("txt=", txt);
+ err = true;
+ return true;
+ }
+ return false;
+ })
+ if (err) {
+ this.showPop({
+ message: "单位、部门、姓名必须填写且最多7字",
+ iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
+ borderColor: "#e034344d",
+ buttonBgColor: "#E03434",
+ });
+ return;
+ }
showLoading(these, {
text: "请稍候..."
});
diff --git a/utils/BleReceive.js b/utils/BleReceive.js
index 5d13216..36aaea6 100644
--- a/utils/BleReceive.js
+++ b/utils/BleReceive.js
@@ -483,11 +483,11 @@ class BleReceive {
});
if (!recCnt) {
if (batteryLevel <= 20) {
-
- uni.showModal({
- content: "设备电量低",
- title: "提示"
- });
+ // 会弹出两个框,暂且注释掉这段代码
+ // uni.showModal({
+ // content: "设备电量低",
+ // title: "提示"
+ // });
}
}