添加102
This commit is contained in:
@ -1118,7 +1118,7 @@
|
||||
|
||||
let json = recei.ReceiveData(receive, device, pagePath, recArr);
|
||||
|
||||
// console.log("收到设备的数据", json)
|
||||
console.log("收到设备的数据", json)
|
||||
let key = 'sta_VoiceDate';
|
||||
if (key in json) {
|
||||
|
||||
@ -1126,6 +1126,7 @@
|
||||
console.log("22222", val)
|
||||
if (val === 'start') {
|
||||
//开始发包
|
||||
console.log("开始发送数据");
|
||||
updateLoading(these, {
|
||||
text: "开始发送"
|
||||
});
|
||||
|
||||
1694
pages/102/HBY102.vue
Normal file
1694
pages/102/HBY102.vue
Normal file
File diff suppressed because it is too large
Load Diff
310
pages/4877/BJQ4877CheckColor.vue
Normal file
310
pages/4877/BJQ4877CheckColor.vue
Normal file
@ -0,0 +1,310 @@
|
||||
<template>
|
||||
<view class="contentBg mainContent">
|
||||
<view class="colorContent">
|
||||
<view v-for="item,index in colors" class="item" :class="{active:item.check,marginNoLeft:index%3===0}"
|
||||
@click.stop="CheckGroup(item,index)">
|
||||
|
||||
<view class="polygon" :style="{backgroundColor:item.hex}">
|
||||
|
||||
</view>
|
||||
<view class="text">{{item.name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="footer">
|
||||
<view class="btnSave" @click.stop="CheckOver()">确定</view>
|
||||
</view>
|
||||
|
||||
<MessagePopup :visible="Status.Pop.showPop" :type="Status.Pop.popType" :bgColor="Status.Pop.bgColor"
|
||||
:borderColor="Status.Pop.borderColor" :textColor="Status.Pop.textColor"
|
||||
:buttonBgColor="Status.Pop.buttonBgColor" :buttonTextColor="Status.Pop.buttonTextColor"
|
||||
:iconUrl="Status.Pop.iconUrl" :message="Status.Pop.message" :buttonText="Status.Pop.buttonText"
|
||||
@buttonClick="HidePop" :visiblePrompt="Status.Pop.visiblePrompt" :promptTitle="Status.Pop.promptTitle"
|
||||
v-model="Status.Pop.modelValue" @closePop="closePop" :buttonCancelText="Status.Pop.buttonCancelText"
|
||||
:showCancel="Status.Pop.showCancel" @cancelPop="closePop" />
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
colors
|
||||
} from '@/api/4877/BJQ4877.js';
|
||||
var eventChannel = null;
|
||||
var these=null;
|
||||
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
Status: {
|
||||
|
||||
Pop: {
|
||||
showPop: false, //是否显示弹窗
|
||||
popType: 'custom',
|
||||
bgColor: '#383934bd',
|
||||
borderColor: '#BBE600',
|
||||
textColor: '#ffffffde',
|
||||
buttonBgColor: '#BBE600',
|
||||
buttonTextColor: '#232323DE',
|
||||
iconUrl: '',
|
||||
message: '您确定要这样做吗?',
|
||||
buttonText: '确定',
|
||||
clickEvt: '',
|
||||
visiblePrompt: false,
|
||||
promptTitle: '设备名称',
|
||||
modelValue: '',
|
||||
visibleClose: false,
|
||||
okCallback: null,
|
||||
buttonCancelText: '',
|
||||
showCancel: false,
|
||||
}
|
||||
},
|
||||
colors: [
|
||||
|
||||
],
|
||||
device:{
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
these=this;
|
||||
this.colors = Object.assign([], colors);
|
||||
eventChannel = this.getOpenerEventChannel();
|
||||
|
||||
eventChannel.on('CheckGroup', function(data) {
|
||||
debugger;
|
||||
if (data && data.id) {
|
||||
these.device=data;
|
||||
uni.getStorage({
|
||||
key: "4877CheckColor_" + data.id,
|
||||
success: (res) => {
|
||||
if (res.data) {
|
||||
debugger;
|
||||
for (var index = 0; index < these.colors.length; index++) {
|
||||
let f=res.data.find(v=>{
|
||||
return v===these.colors[index].id;
|
||||
});
|
||||
if(f){
|
||||
these.$set(these.colors[index], 'check',true);
|
||||
}else{
|
||||
these.$set(these.colors[index], 'check',false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
CheckOver() {
|
||||
|
||||
let arr = this.colors.map(v => {
|
||||
return v.check ? 1 : 0;
|
||||
})
|
||||
if (!arr.length) {
|
||||
this.showMsg("请选择至少1个颜色配组");
|
||||
return;
|
||||
}
|
||||
|
||||
let checks = this.colors.filter(v => {
|
||||
return v.check
|
||||
}).map(item => {
|
||||
return item.id
|
||||
});
|
||||
console.log("checks=", checks);
|
||||
|
||||
eventChannel.emit('CheckGroupOver', {allFlag:arr,checkIds:checks});
|
||||
uni.setStorage({
|
||||
key: "4877CheckColor_" + this.device.id,
|
||||
data: checks
|
||||
});
|
||||
uni.navigateBack();
|
||||
|
||||
},
|
||||
CheckGroup(item, index) {
|
||||
this.$set(this.colors[index], 'check', !item.check)
|
||||
},
|
||||
closePop: function() {
|
||||
this.Status.Pop.showPop = false;
|
||||
|
||||
if (this.Status.Pop.cancelCallback) {
|
||||
this.Status.Pop.cancelCallback();
|
||||
}
|
||||
},
|
||||
HidePop: function() {
|
||||
if (this.Status.Pop.clickEvt == 'SendUsr') {
|
||||
|
||||
}
|
||||
|
||||
|
||||
this.Status.Pop.showPop = false;
|
||||
if (this.Status.Pop.okCallback) {
|
||||
this.Status.Pop.okCallback();
|
||||
}
|
||||
},
|
||||
showPop: function(option) {
|
||||
hideLoading(this);
|
||||
let def = {
|
||||
showPop: true, //是否显示弹窗
|
||||
popType: 'custom',
|
||||
bgColor: '#383934bd',
|
||||
borderColor: '#BBE600',
|
||||
textColor: '#ffffffde',
|
||||
buttonBgColor: '#BBE600',
|
||||
buttonTextColor: '#232323DE',
|
||||
iconUrl: '',
|
||||
message: '',
|
||||
buttonText: '确定',
|
||||
clickEvt: '',
|
||||
visiblePrompt: false,
|
||||
promptTitle: '',
|
||||
modelValue: '',
|
||||
visibleClose: false,
|
||||
okCallback: null,
|
||||
showSlot: false,
|
||||
buttonCancelText: '',
|
||||
showCancel: false,
|
||||
}
|
||||
|
||||
let keys = Object.keys(def);
|
||||
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
let key = keys[i];
|
||||
if (key in option) {
|
||||
continue;
|
||||
}
|
||||
this.Status.Pop[key] = def[key];
|
||||
}
|
||||
if (option) {
|
||||
keys = Object.keys(option);
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
let key = keys[i];
|
||||
|
||||
this.Status.Pop[key] = option[key];
|
||||
}
|
||||
}
|
||||
|
||||
if (!option.borderColor) {
|
||||
option.borderColor = '#BBE600';
|
||||
option.buttonBgColor = '#BBE600';
|
||||
}
|
||||
these.Status.Pop.showPop = true;
|
||||
},
|
||||
showMsg(msg, isSucc) {
|
||||
let icoUrl = '/static/images/6155/DeviceDetail/uploadErr.png';
|
||||
let borderColor = "#e034344d";
|
||||
let buttonBgColor = "#E03434";
|
||||
if (isSucc) {
|
||||
icoUrl = '/static/images/common/success.png';
|
||||
borderColor = "#BBE600";
|
||||
buttonBgColor = "#BBE600";
|
||||
}
|
||||
this.showPop({
|
||||
message: msg,
|
||||
iconUrl: icoUrl,
|
||||
borderColor: borderColor,
|
||||
buttonBgColor: buttonBgColor,
|
||||
buttonText: '确定',
|
||||
okCallback: null
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.mainContent {
|
||||
width: 100%;
|
||||
min-height: 100vh;
|
||||
box-sizing: border-box;
|
||||
padding: 30rpx
|
||||
}
|
||||
|
||||
.colorContent {
|
||||
display: flex;
|
||||
align-content: center;
|
||||
justify-content: flex-start;
|
||||
justify-items: center;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
|
||||
}
|
||||
|
||||
.polygon {
|
||||
/* 矩形 235 */
|
||||
width: 30rpx;
|
||||
height: 30rpx;
|
||||
border-radius: 8rpx;
|
||||
|
||||
}
|
||||
|
||||
.text {
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
font-family: PingFang SC;
|
||||
font-size: 28rpx;
|
||||
font-weight: 400;
|
||||
letter-spacing: 2rpx;
|
||||
margin-left: 15rpx;
|
||||
}
|
||||
|
||||
.item {
|
||||
background-color: #1A1A1A;
|
||||
margin-left: 36rpx;
|
||||
width: calc(calc(100% - 72rpx) / 3);
|
||||
height: 90rpx;
|
||||
margin-top: 24rpx;
|
||||
box-sizing: border-box;
|
||||
padding-left: 25rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
align-content: center;
|
||||
border-width: 1rpx;
|
||||
border-style: solid;
|
||||
border-color: #00000000;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.item.active {
|
||||
border-color: #AED600 !important;
|
||||
}
|
||||
|
||||
.marginNoLeft {
|
||||
margin-left: 0rpx !important;
|
||||
}
|
||||
|
||||
.footer {
|
||||
position: fixed;
|
||||
bottom: 75px;
|
||||
left: 00rpx;
|
||||
width: 100%;
|
||||
height: 100rpx;
|
||||
box-sizing: border-box;
|
||||
padding: 0rpx 120rpx;
|
||||
}
|
||||
|
||||
.btnSave {
|
||||
|
||||
background-color: #BBE600;
|
||||
color: #232323DE;
|
||||
text-align: center;
|
||||
border-radius: 60rpx;
|
||||
width: 100%;
|
||||
height: 100rpx;
|
||||
font-family: PingFang SC;
|
||||
font-size: 32rpx;
|
||||
font-weight: 400;
|
||||
line-height: 100rpx;
|
||||
letter-spacing: 12rpx;
|
||||
|
||||
}
|
||||
</style>
|
||||
1596
pages/4877/BJQ4877V1.vue
Normal file
1596
pages/4877/BJQ4877V1.vue
Normal file
File diff suppressed because it is too large
Load Diff
@ -617,25 +617,26 @@
|
||||
var processAndSendImageData = function(pixels) {
|
||||
return new Promise((resolve, reject) => {
|
||||
// 创建RGB565格式的像素数据
|
||||
// console.log("pixels=",pixels);
|
||||
const arr = ble.convertToRGB565(pixels, 'bgr');
|
||||
|
||||
|
||||
var list = [];
|
||||
let index = 0; // 用于追踪arr的当前位置
|
||||
let packetSize = 2048;
|
||||
let cSize = 248;
|
||||
let packetSize = 3200;
|
||||
let cSize = 200;
|
||||
// 外层循环:7个主要元素(i从1到7)
|
||||
for (let i = 1; i < 8; i++) {
|
||||
for (let i = 1; i < 9; i++) {
|
||||
let secondLevel = [];
|
||||
let secondCnt = 0;
|
||||
// 中层循环:每个主要元素包含9个子数组(j从1到9)
|
||||
for (let j = 1; j < 10; j++) {
|
||||
for (let j = 1; j < 9; j++) {
|
||||
// 确定当前子数组的长度:前8个是254,第9个是64
|
||||
|
||||
|
||||
let thirdLevel = [];
|
||||
|
||||
|
||||
// 从arr中提取相应数量的元素
|
||||
for (let k = 0; k < cSize && index < arr.length; k++) {
|
||||
|
||||
|
||||
if (secondCnt == packetSize) {
|
||||
break;
|
||||
}
|
||||
@ -643,14 +644,14 @@
|
||||
secondCnt++;
|
||||
index++;
|
||||
}
|
||||
|
||||
|
||||
secondLevel.push(thirdLevel);
|
||||
}
|
||||
list.push(secondLevel);
|
||||
}
|
||||
|
||||
|
||||
console.log("list=", list);
|
||||
|
||||
|
||||
let length = 0;
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
const item = list[i];
|
||||
@ -660,8 +661,8 @@
|
||||
console.log("第" + i + "包,第" + j + "小包,长度:" + element.length)
|
||||
length += element.length;
|
||||
clength += element.length;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
// 分包发送
|
||||
@ -675,118 +676,102 @@
|
||||
var sendImagePackets = function(imageData) {
|
||||
return new Promise((resolve, reject) => {
|
||||
// 总数据包数
|
||||
const totalPackets = 7;
|
||||
const totalPackets = 8;
|
||||
let currentPacket = 1;
|
||||
let childPacket = 1;
|
||||
let totalChildPacket = 9;
|
||||
|
||||
|
||||
let totalChildPacket = 8;
|
||||
|
||||
|
||||
// 发送单个数据包
|
||||
const sendNextPacket = () => {
|
||||
if (currentPacket > totalPackets) {
|
||||
updateLoading(these,{text:'发送完成,等待设备30秒'});
|
||||
setTimeout(() => {
|
||||
hideLoading(these);
|
||||
these.Status.BottomMenu.show = false;
|
||||
|
||||
|
||||
these.showPop({
|
||||
message: "上传成功",
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png",
|
||||
borderColor: '#BBE600',
|
||||
buttonBgColor: '#BBE600'
|
||||
});
|
||||
|
||||
|
||||
resolve();
|
||||
}, 20000)
|
||||
|
||||
}, 0)
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var packetData = imageData[currentPacket - 1][childPacket - 1];
|
||||
// if (packetData.length == 0) {
|
||||
// hideLoading(these);
|
||||
// these.Status.BottomMenu.show = false;
|
||||
|
||||
// these.showPop({
|
||||
// message: "上传成功",
|
||||
// iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png"
|
||||
// });
|
||||
|
||||
// resolve();
|
||||
// return;
|
||||
// }
|
||||
console.log("childPacket=", childPacket);
|
||||
console.log("packetData=", packetData);
|
||||
let start = 0;
|
||||
let bufferSize = packetData.length * 2;
|
||||
|
||||
if (currentPacket == 7) {
|
||||
if (childPacket > 2 && childPacket < 9) {
|
||||
bufferSize = 496;
|
||||
} else if (childPacket == 9) {
|
||||
bufferSize = 128;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (childPacket == 1) {
|
||||
bufferSize = bufferSize + 8
|
||||
start = 8;
|
||||
}
|
||||
if (childPacket == 9) { //|| (currentPacket==7 && childPacket==3
|
||||
if (childPacket == 8) { //|| (currentPacket==7 && childPacket==3
|
||||
bufferSize = bufferSize + 1
|
||||
}
|
||||
|
||||
|
||||
//FA 09 10 04 FC 09 [00] [01] + 4096字节+FF 数据格式
|
||||
|
||||
|
||||
//FA 09 0C 84 FB 09 00 [01~08] + 3200字节 +FF 数据格式
|
||||
var buffer = new ArrayBuffer(bufferSize);
|
||||
var dataView = new DataView(buffer);
|
||||
if (childPacket == 1) {
|
||||
dataView.setUint8(0, 0xFA); // 帧头
|
||||
dataView.setUint8(1, 0x09); // 帧头
|
||||
dataView.setUint8(2, 0x10); // 帧头
|
||||
dataView.setUint8(3, 0x04); // 帧头
|
||||
dataView.setUint8(4, 0xFC); // 帧头
|
||||
dataView.setUint8(5, 0x09); // 帧头
|
||||
|
||||
dataView.setUint8(6, 0x00); // 图序号,图片固定0,视频的话要写序号
|
||||
dataView.setUint8(7, currentPacket); //子包序号
|
||||
dataView.setUint8(2, 0x0C); // 帧头
|
||||
dataView.setUint8(3, 0x84); // 帧头
|
||||
dataView.setUint8(4, 0xFB); // 帧头
|
||||
dataView.setUint8(5, 0x09);
|
||||
dataView.setUint8(6, 0x00); // 帧头
|
||||
dataView.setUint8(7, currentPacket); //包序号
|
||||
}
|
||||
|
||||
|
||||
for (let i = 0; i < packetData.length; i++) {
|
||||
dataView.setUint16(start + i * 2, packetData[i], false); //本包数据,大端字节序
|
||||
}
|
||||
console.log("packetData.length=", packetData.length);
|
||||
console.log("bufferSize=", bufferSize)
|
||||
if (childPacket == 9) { // || (currentPacket==7 && childPacket==3
|
||||
if (childPacket == 8) { // || (currentPacket==7 && childPacket==3
|
||||
dataView.setUint8(bufferSize - 1, 0xFF);
|
||||
}
|
||||
|
||||
|
||||
//发送数据包
|
||||
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId,
|
||||
30)
|
||||
.then(() => {
|
||||
|
||||
|
||||
let curr = childPacket + (currentPacket - 1) *
|
||||
totalChildPacket;
|
||||
console.log("第" + currentPacket + "大包,第" + childPacket +
|
||||
"小包发送完成,总计:" + curr);
|
||||
updateLoading(these, {
|
||||
text: "正在发送" + curr + "/63"
|
||||
|
||||
text: "正在发送" + curr + "/64"
|
||||
|
||||
})
|
||||
if (childPacket == 9) {
|
||||
if (childPacket == 8) {
|
||||
currentPacket++;
|
||||
childPacket = 1;
|
||||
} else {
|
||||
childPacket++;
|
||||
}
|
||||
|
||||
|
||||
setTimeout(sendNextPacket, 100);
|
||||
}).catch(err => {
|
||||
if (err.code == 10007) {
|
||||
setTimeout(sendNextPacket, 100);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
console.log("发送数据包失败了", err);
|
||||
|
||||
|
||||
these.Status.BottomMenu.show = false;
|
||||
these.showPop({
|
||||
message: "发送数据包失败了" + err.msg,
|
||||
@ -794,14 +779,14 @@
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
});
|
||||
|
||||
|
||||
hideLoading(these);
|
||||
reject(err);
|
||||
});
|
||||
}
|
||||
// 开始发送数据
|
||||
sendNextPacket();
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -386,11 +386,11 @@
|
||||
|
||||
Promise.allSettled(promis).finally(() => {
|
||||
ble.StopSearch().finally(res => {
|
||||
// console.log("停止搜索成功");
|
||||
console.log("停止搜索成功");
|
||||
these.EquipMents = [];
|
||||
these.PairEquip = [];
|
||||
ble.StartSearch().then(result => {
|
||||
// console.log("开始搜索成功");
|
||||
console.log("开始搜索成功");
|
||||
}).catch(err => {
|
||||
console.error("开始搜索失败,err=", err);
|
||||
if (err.code === 10001) {
|
||||
|
||||
Reference in New Issue
Block a user