Compare commits
2 Commits
ac7e1873cd
...
7b2b7ea34c
| Author | SHA1 | Date | |
|---|---|---|---|
| 7b2b7ea34c | |||
| eea68b5276 |
@ -77,7 +77,7 @@
|
|||||||
<text class="smallTxt">泛光模式</text>
|
<text class="smallTxt">泛光模式</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="mode fleft" v-on:click.stop="UploadOpenImg()">
|
<!-- <view class="mode fleft" v-on:click.stop="UploadOpenImg()">
|
||||||
<view class="leftImg">
|
<view class="leftImg">
|
||||||
<image class="img" src="/static/images/6155/DeviceDetail/open.png" mode="aspectFit"></image>
|
<image class="img" src="/static/images/6155/DeviceDetail/open.png" mode="aspectFit"></image>
|
||||||
</view>
|
</view>
|
||||||
@ -85,8 +85,8 @@
|
|||||||
<text class="bigTxt">开机画面</text>
|
<text class="bigTxt">开机画面</text>
|
||||||
<text class="smallTxt">上传</text>
|
<text class="smallTxt">上传</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view> -->
|
||||||
<view class="mode fleft marginLeft" v-on:click.stop="UploadOpenVideo()">
|
<view class="mode fleft" v-on:click.stop="UploadOpenVideo()">
|
||||||
<view class="leftImg">
|
<view class="leftImg">
|
||||||
<image class="img" src="/static/images/common/video.png" mode="aspectFit"></image>
|
<image class="img" src="/static/images/common/video.png" mode="aspectFit"></image>
|
||||||
</view>
|
</view>
|
||||||
@ -938,7 +938,9 @@
|
|||||||
if (res.statusCode === 200) {
|
if (res.statusCode === 200) {
|
||||||
if (res.data.code == 200) {
|
if (res.data.code == 200) {
|
||||||
console.log("上传完成,耗时:" + m + "分" + s + "秒");
|
console.log("上传完成,耗时:" + m + "分" + s + "秒");
|
||||||
updateLoading(these,{text:"上传完成,耗时:" + m + "分" + s + "秒,正在切片。"})
|
updateLoading(these, {
|
||||||
|
text: "上传完成,耗时:" + m + "分" + s + "秒,正在切片。"
|
||||||
|
})
|
||||||
resolve(res.data);
|
resolve(res.data);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -1004,7 +1006,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//发送视频到设备
|
//发送视频到设备
|
||||||
let shotVideoClick = (array, type, ReSendNo) => {
|
let shotVideoClick = (array, type, ReSendNo) => {
|
||||||
var sendImagePackets = () => {
|
var sendImagePackets = () => {
|
||||||
@ -1033,37 +1035,38 @@
|
|||||||
resolve();
|
resolve();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!array[imgIndex]) {
|
if (!array[imgIndex]) {
|
||||||
console.error("没有找到对应的帧数据", imgIndex);
|
console.error("没有找到对应的帧数据", imgIndex);
|
||||||
reject(`帧数据缺失,索引 ${imgIndex}`);
|
reject(`帧数据缺失,索引 ${imgIndex}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let childPacketsGroup = array[imgIndex][imgPackIndex];
|
let childPacketsGroup = array[imgIndex][imgPackIndex];
|
||||||
if (!childPacketsGroup || !childPacketsGroup.length) {
|
if (!childPacketsGroup || !childPacketsGroup.length) {
|
||||||
console.error("帧数据结构异常", imgIndex, imgPackIndex);
|
console.error("帧数据结构异常", imgIndex, imgPackIndex);
|
||||||
reject(`帧数据结构异常,帧 ${imgIndex}`);
|
reject(`帧数据结构异常,帧 ${imgIndex}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let packetData = childPacketsGroup[childPacketIndex];
|
let packetData = childPacketsGroup[childPacketIndex];
|
||||||
let packetSize = packetData.length;
|
let packetSize = packetData.length;
|
||||||
|
|
||||||
const isFirstChild = childPacketIndex === 0;
|
const isFirstChild = childPacketIndex === 0;
|
||||||
const isLastChild = childPacketIndex === (childPacketsGroup.length - 1);
|
const isLastChild = childPacketIndex === (childPacketsGroup
|
||||||
|
.length - 1);
|
||||||
|
|
||||||
if (isFirstChild) {
|
if (isFirstChild) {
|
||||||
packetSize = packetData.length + 8;
|
packetSize = packetData.length + 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isLastChild) {
|
if (isLastChild) {
|
||||||
packetSize = packetData.length + (isFirstChild ? 9 : 1);
|
packetSize = packetData.length + (isFirstChild ? 9 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const buffer = new ArrayBuffer(packetSize);
|
const buffer = new ArrayBuffer(packetSize);
|
||||||
const dataView = new DataView(buffer);
|
const dataView = new DataView(buffer);
|
||||||
|
|
||||||
let start = 0;
|
let start = 0;
|
||||||
if (isFirstChild) {
|
if (isFirstChild) {
|
||||||
// 填充头部
|
// 填充头部
|
||||||
@ -1077,28 +1080,30 @@
|
|||||||
dataView.setUint8(7, imgPackIndex + 1);
|
dataView.setUint8(7, imgPackIndex + 1);
|
||||||
start = 8;
|
start = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < packetData.length; i++) {
|
for (let i = 0; i < packetData.length; i++) {
|
||||||
dataView.setUint8(start + i, these.toByteValue(packetData[i]));
|
dataView.setUint8(start + i, these.toByteValue(packetData[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isLastChild) {
|
if (isLastChild) {
|
||||||
dataView.setUint8(packetSize - 1, 0xFF);
|
dataView.setUint8(packetSize - 1, 0xFF);
|
||||||
}
|
}
|
||||||
let inteval = parseInt(this.inteval ? this.inteval : 80);
|
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) {
|
if (ReSendNo) {
|
||||||
resolve();
|
resolve();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 更新进度
|
// 更新进度
|
||||||
this.currentPacket = currentPacket;
|
this.currentPacket = currentPacket;
|
||||||
|
|
||||||
updateLoading(these,{
|
updateLoading(these, {
|
||||||
text:'正在发送:'+currentPacket+"/"+totalPackets
|
text: '正在发送:' + currentPacket + "/" +
|
||||||
|
totalPackets
|
||||||
});
|
});
|
||||||
|
|
||||||
childPacketIndex++;
|
childPacketIndex++;
|
||||||
if (childPacketIndex >= childPacketsGroup.length) {
|
if (childPacketIndex >= childPacketsGroup.length) {
|
||||||
childPacketIndex = 0;
|
childPacketIndex = 0;
|
||||||
@ -1110,7 +1115,7 @@
|
|||||||
}
|
}
|
||||||
// 发送下一个包(添加延迟避免蓝牙缓冲区溢出)
|
// 发送下一个包(添加延迟避免蓝牙缓冲区溢出)
|
||||||
currentPacket++;
|
currentPacket++;
|
||||||
|
|
||||||
setTimeout(sendNextPacket, inteval);
|
setTimeout(sendNextPacket, inteval);
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
if (err.code == 10007) {
|
if (err.code == 10007) {
|
||||||
@ -1119,9 +1124,11 @@
|
|||||||
setTimeout(sendNextPacket, 100);
|
setTimeout(sendNextPacket, 100);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.error(err.errMsg + ",发送失败了" + currentPacket);
|
console.error(err.errMsg + ",发送失败了" + currentPacket);
|
||||||
updateLoading(these,{text:"发送失败,"+err.errMsg});
|
updateLoading(these, {
|
||||||
|
text: "发送失败," + err.errMsg
|
||||||
|
});
|
||||||
reject(err);
|
reject(err);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -1134,7 +1141,7 @@
|
|||||||
uni.chooseVideo({
|
uni.chooseVideo({
|
||||||
sourceType: ['album'],
|
sourceType: ['album'],
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
console.log("res=",res);
|
console.log("res=", res);
|
||||||
let path = res.tempFilePath;
|
let path = res.tempFilePath;
|
||||||
let width = res.width;
|
let width = res.width;
|
||||||
let height = res.height;
|
let height = res.height;
|
||||||
@ -1182,29 +1189,32 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
videoCutPacket(convertedData).then(array => {
|
videoCutPacket(convertedData).then(array => {
|
||||||
|
|
||||||
let start = new Date();
|
let start = new Date();
|
||||||
console.log("开始发送");
|
console.log("开始发送");
|
||||||
shotVideoClick(array).then(() => {
|
shotVideoClick(array).then(() => {
|
||||||
console.log("发送完成");
|
console.log("发送完成");
|
||||||
let end = new Date();
|
let end = new Date();
|
||||||
var diff = (end.getTime() - start.getTime()) / 1000;
|
var diff = (end.getTime() - start
|
||||||
let s =parseInt(diff % 60);
|
.getTime()) / 1000;
|
||||||
let m =parseInt((diff - s) / 60);
|
let s = parseInt(diff % 60);
|
||||||
console.log("发送完成,耗时:" + m + "分" + s + "秒");
|
let m = parseInt((diff - s) / 60);
|
||||||
updateLoading(these,{
|
console.log("发送完成,耗时:" + m + "分" +
|
||||||
text: "发送完成,耗时:" + m + "分" + s + "秒",
|
s + "秒");
|
||||||
});
|
updateLoading(these, {
|
||||||
|
text: "发送完成,耗时:" + m +
|
||||||
}).catch((ex1) => {
|
"分" + s + "秒",
|
||||||
console.log("出现了异常", ex1)
|
});
|
||||||
}).finally(() => {
|
|
||||||
timeDelayCloseLoading();
|
}).catch((ex1) => {
|
||||||
});
|
console.log("出现了异常", ex1)
|
||||||
|
}).finally(() => {
|
||||||
|
timeDelayCloseLoading();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
timeDelayCloseLoading();
|
timeDelayCloseLoading();
|
||||||
});
|
});
|
||||||
@ -1467,6 +1477,24 @@
|
|||||||
these.showBleUnConnect()
|
these.showBleUnConnect()
|
||||||
return;
|
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, {
|
showLoading(these, {
|
||||||
text: "请稍候..."
|
text: "请稍候..."
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user