图片裁剪页面加入自定义尺寸,7305修改发送文字和图片的方式
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<view>
|
||||
<canvas id="splashCanvas" canvas-id="splashCanvas" style="width: 160px; height: 80px; z-index: 9999;position: fixed; visibility: hidden;"></canvas>
|
||||
<canvas id="splashCanvas" canvas-id="splashCanvas" :style="{'width':width+'px','height':height+'px'}" style=" z-index: 9999;position: fixed; visibility: hidden;"></canvas>
|
||||
|
||||
|
||||
<qf-image-cropper :src="src" :showAngle="false" :width="1600" :height="800" fileType="jpg"
|
||||
<qf-image-cropper :src="src" :showAngle="false" :width="cropWidth" :height="cropHeight" fileType="jpg"
|
||||
@crop="handleCrop" :gpu="true">
|
||||
</qf-image-cropper>
|
||||
</view>
|
||||
@ -18,17 +18,29 @@
|
||||
data() {
|
||||
return {
|
||||
src: "",
|
||||
Statu: false
|
||||
Statu: false,
|
||||
width:160,
|
||||
height:80
|
||||
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
cropWidth(){
|
||||
return this.width*10;
|
||||
}
|
||||
,
|
||||
cropHeight(){
|
||||
return this.height*10;
|
||||
}
|
||||
},
|
||||
onLoad: function(option) {
|
||||
const eventChannel = this.getOpenerEventChannel();
|
||||
var these = this;
|
||||
eventChannel.on('checkImg', (data)=> {
|
||||
console.log("我收到你的消息了,消息内容是:" + JSON.stringify(data));
|
||||
this.src = data.data;
|
||||
console.log("我收到你的消息了,消息内容是:",data);
|
||||
eventChannel.on('checkImg', (rec)=> {
|
||||
console.log("我收到你的消息了,消息内容是:" + JSON.stringify(rec));
|
||||
this.src = rec.data;
|
||||
this.width=rec.width?rec.width:160;
|
||||
this.height=rec.height?rec.height:80;
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
@ -43,7 +55,7 @@
|
||||
const ctx = uni.createCanvasContext('splashCanvas', this);
|
||||
ctx.drawImage(
|
||||
e.tempFilePath,
|
||||
0,0,160,80
|
||||
0,0,these.width,these.height
|
||||
);
|
||||
setTimeout(() => {
|
||||
ctx.draw(false, ()=>{
|
||||
@ -52,8 +64,8 @@
|
||||
canvasId: 'splashCanvas',
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 160,
|
||||
height: 80,
|
||||
width: these.width,
|
||||
height: these.height,
|
||||
success: (res) => {
|
||||
// 处理像素数据并发送
|
||||
|
||||
@ -81,8 +93,7 @@
|
||||
|
||||
<style>
|
||||
.canvas {
|
||||
width: 1600px;
|
||||
height: 800px;
|
||||
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
</style>
|
||||
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view class="content contentBg">
|
||||
<view class="eq">
|
||||
<view class="leftImg">
|
||||
<view class="leftImg" @click.stop="previewImg(formData.img)">
|
||||
<image class="img" :src="formData.img" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="rightTxt">
|
||||
@ -410,6 +410,15 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
previewImg(img){
|
||||
if(!img){
|
||||
return;
|
||||
}
|
||||
|
||||
uni.previewImage({
|
||||
urls:[img]
|
||||
})
|
||||
},
|
||||
getDevice: function() {
|
||||
// console.log("LinkedList=", ble.data.LinkedList);
|
||||
// console.log("formData=", these.formData);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view class="content contentBg">
|
||||
<view class="eq">
|
||||
<view class="leftImg">
|
||||
<view class="leftImg" @click.stop="previewImg(formData.img)">
|
||||
<image class="img" :src="formData.img" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="rightTxt">
|
||||
@ -367,6 +367,15 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
previewImg(img){
|
||||
if(!img){
|
||||
return;
|
||||
}
|
||||
|
||||
uni.previewImage({
|
||||
urls:[img]
|
||||
})
|
||||
},
|
||||
getWarnStyle(index) {
|
||||
let className = "";
|
||||
switch (this.formData.warnLevel) {
|
||||
@ -590,6 +599,7 @@
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonText: '去连接',
|
||||
buttonTextColor:'#FFFFFFde',
|
||||
okCallback: function() {
|
||||
|
||||
uni.navigateTo({
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
:rightIcons="Status.navbar.icons" @icon-click="handleRightClick"></custom-navbar>
|
||||
|
||||
<view class="eq" :style="{marginTop:Status.navbar.height+'px'}">
|
||||
<view class="leftImg">
|
||||
<view class="leftImg" @click.stop="previewImg(device['devicePic'])">
|
||||
<image class="img" :src="device['devicePic']" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="rightTxt">
|
||||
@ -524,6 +524,15 @@
|
||||
|
||||
},
|
||||
methods: {
|
||||
previewImg(img){
|
||||
if(!img){
|
||||
return;
|
||||
}
|
||||
|
||||
uni.previewImage({
|
||||
urls:[img]
|
||||
})
|
||||
},
|
||||
showBleUnConnect() {
|
||||
this.Status.bleLinkCnt++;
|
||||
if(this.Status.bleLinkCnt>3){
|
||||
@ -537,7 +546,7 @@
|
||||
buttonText: '去连接',
|
||||
showCancel: true,
|
||||
cancelCallback: () => {
|
||||
this.closePop();
|
||||
// this.closePop();
|
||||
},
|
||||
okCallback: function() {
|
||||
console.log("1111");
|
||||
@ -1200,7 +1209,7 @@
|
||||
message.deviceId = these.device.id;
|
||||
message.deviceImei = these.device.deviceImei;
|
||||
|
||||
let requestSend = () => {
|
||||
let requestSend = (callback) => {
|
||||
|
||||
message.isBluetooth = false;
|
||||
api.sendSos(message).then((res) => {
|
||||
@ -1211,12 +1220,18 @@
|
||||
code: 200,
|
||||
msg: '操作成功'
|
||||
});
|
||||
if(callback){
|
||||
callback();
|
||||
}
|
||||
} else {
|
||||
return this.sendMQ(json);
|
||||
}
|
||||
|
||||
}).then((res) => {
|
||||
console.log("res=", res);
|
||||
if(callback){
|
||||
callback();
|
||||
}
|
||||
}).catch((ex) => {
|
||||
console.log("ex=", ex);
|
||||
these.showPop({
|
||||
@ -1234,7 +1249,7 @@
|
||||
|
||||
}
|
||||
|
||||
let bleSendCmd = () => {
|
||||
let bleSendCmd = (callback) => {
|
||||
let f = this.getDevice();
|
||||
let buffer = null;
|
||||
if (f) {
|
||||
@ -1255,53 +1270,59 @@
|
||||
these.setBleFormData();
|
||||
message.isBluetooth = true;
|
||||
api.sendSos(message);
|
||||
if(callback){
|
||||
callback();
|
||||
}
|
||||
}).catch((ex) => {
|
||||
//使用4G发送
|
||||
console.log("蓝牙发送失败,转4g发送", ex);
|
||||
requestSend();
|
||||
requestSend(callback);
|
||||
});
|
||||
} else {
|
||||
console.log("找不到蓝牙设备");
|
||||
requestSend();
|
||||
requestSend(callback);
|
||||
these.showBleUnConnect();
|
||||
}
|
||||
}
|
||||
|
||||
let OpenSOS = () => {
|
||||
these.formData.qzwarn = true; //标记为强制报警了
|
||||
|
||||
these.Status.staticWarn.time = 180;
|
||||
this.formData.SOS = type;
|
||||
|
||||
let loopFunc = () => {
|
||||
if (these.Status.staticWarn.inteval === null) {
|
||||
return;
|
||||
let execSos=()=>{
|
||||
these.formData.qzwarn = true; //标记为强制报警了
|
||||
|
||||
these.Status.staticWarn.time = 180;
|
||||
this.formData.SOS = type;
|
||||
|
||||
let loopFunc = () => {
|
||||
if (these.Status.staticWarn.inteval === null) {
|
||||
return;
|
||||
}
|
||||
if (these.Status.staticWarn.time === 0) {
|
||||
|
||||
|
||||
clearInterval(these.Status.staticWarn.inteval);
|
||||
these.Status.staticWarn.inteval = null;
|
||||
these.formData.qzwarn = false;
|
||||
these.formData.SOS = 'close';
|
||||
these.CloseWarn(false);
|
||||
return;
|
||||
}
|
||||
these.Status.staticWarn.time = these.Status.staticWarn
|
||||
.time - 1;
|
||||
|
||||
if (these.Status.Pop.clickEvt == 'time' && this.Status.Pop.showPop) {
|
||||
console.log("111111");
|
||||
this.showQzWarn(this.Status.Pop.okCallback);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (these.Status.staticWarn.time === 0) {
|
||||
|
||||
|
||||
clearInterval(these.Status.staticWarn.inteval);
|
||||
these.Status.staticWarn.inteval = null;
|
||||
these.formData.qzwarn = false;
|
||||
these.formData.SOS = 'close';
|
||||
these.CloseWarn(false);
|
||||
return;
|
||||
}
|
||||
these.Status.staticWarn.time = these.Status.staticWarn
|
||||
.time - 1;
|
||||
|
||||
if (these.Status.Pop.clickEvt == 'time' && this.Status.Pop.showPop) {
|
||||
console.log("111111");
|
||||
this.showQzWarn(this.Status.Pop.okCallback);
|
||||
}
|
||||
|
||||
|
||||
these.Status.staticWarn.inteval = setInterval(() => {
|
||||
loopFunc();
|
||||
}, 1000);
|
||||
}
|
||||
these.Status.staticWarn.inteval = setInterval(() => {
|
||||
loopFunc();
|
||||
}, 1000);
|
||||
|
||||
|
||||
bleSendCmd();
|
||||
bleSendCmd(execSos);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view class="content contentBg">
|
||||
<view class="eq">
|
||||
<view class="leftImg">
|
||||
<view class="leftImg" @click.stop="previewImg(formData.img)">
|
||||
<image class="img" :src="formData.img" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="rightTxt">
|
||||
@ -83,7 +83,7 @@
|
||||
<text class="usrtitle fleft">人员信息登记</text>
|
||||
<view class="btnSend fright" v-on:click.stop="sendUsr">发送</view>
|
||||
<view class="clear"></view>
|
||||
<TextToHexV1 class="TextToHex" ref="textToHex" :txts="formData.textLines" :bgColor="'#FFFFFF'"
|
||||
<textToDotMatrix class="TextToHex" ref="textToHex" :txts="formData.textLines" :bgColor="'#FFFFFF'"
|
||||
:color="'#000000'" :fontSize="14" />
|
||||
</view>
|
||||
|
||||
@ -124,8 +124,8 @@
|
||||
: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" @closePop="closePop" :visiblePrompt="Status.Pop.visiblePrompt" :promptTitle="Status.Pop.promptTitle"
|
||||
v-model="Status.Pop.modelValue" />
|
||||
@buttonClick="HidePop" @closePop="closePop" :visiblePrompt="Status.Pop.visiblePrompt"
|
||||
:promptTitle="Status.Pop.promptTitle" v-model="Status.Pop.modelValue" />
|
||||
|
||||
<!-- 下方菜单 -->
|
||||
<BottomSlideMenuPlus :config="Status.BottomMenu" @close="closeMenu" @itemClick="handleItemClick"
|
||||
@ -143,7 +143,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import TextToHexV1 from '@/components/TextToHex/TextToHexV1.vue';
|
||||
import textToDotMatrix from '@/components/TextToHex/textToDotMatrix.vue';
|
||||
import bleTool from '@/utils/BleHelper.js';
|
||||
import usrApi from '@/api/670/HBY670.js'
|
||||
import {
|
||||
@ -161,7 +161,7 @@
|
||||
|
||||
export default {
|
||||
components: {
|
||||
TextToHexV1
|
||||
textToDotMatrix
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -182,7 +182,7 @@
|
||||
promptTitle: '设备名称',
|
||||
modelValue: '',
|
||||
visibleClose: false,
|
||||
okCallback:null
|
||||
okCallback: null
|
||||
},
|
||||
BottomMenu: {
|
||||
show: false,
|
||||
@ -410,6 +410,15 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
previewImg(img) {
|
||||
if (!img) {
|
||||
return;
|
||||
}
|
||||
|
||||
uni.previewImage({
|
||||
urls: [img]
|
||||
})
|
||||
},
|
||||
getDevice: function() {
|
||||
// console.log("LinkedList=", ble.data.LinkedList);
|
||||
// console.log("formData=", these.formData);
|
||||
@ -567,180 +576,83 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// 处理像素数据并发送
|
||||
var processAndSendImageData = function(pixels) {
|
||||
return new Promise((resolve, reject) => {
|
||||
// 创建RGB565格式的像素数据
|
||||
const arr = ble.convertToRGB565(pixels, 'bgr');
|
||||
|
||||
var list = [];
|
||||
let index = 0; // 用于追踪arr的当前位置
|
||||
let packetSize = 2048;
|
||||
let cSize = 248;
|
||||
// 外层循环:7个主要元素(i从1到7)
|
||||
for (let i = 1; i < 8; i++) {
|
||||
let secondLevel = [];
|
||||
let secondCnt = 0;
|
||||
// 中层循环:每个主要元素包含9个子数组(j从1到9)
|
||||
for (let j = 1; j < 10; j++) {
|
||||
// 确定当前子数组的长度:前8个是254,第9个是64
|
||||
|
||||
let thirdLevel = [];
|
||||
|
||||
// 从arr中提取相应数量的元素
|
||||
for (let k = 0; k < cSize && index < arr.length; k++) {
|
||||
|
||||
if (secondCnt == packetSize) {
|
||||
break;
|
||||
}
|
||||
thirdLevel.push(arr[index]);
|
||||
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];
|
||||
let clength = 0;
|
||||
for (let j = 0; j < item.length; j++) {
|
||||
const element = item[j];
|
||||
// console.log("第" + i + "包,第" + j + "小包,长度:" + element.length)
|
||||
length += element.length;
|
||||
clength += element.length;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
// 分包发送
|
||||
sendImagePackets(list).then(resolve).catch(reject);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 分包发送图片数据
|
||||
var sendImagePackets = function(imageData) {
|
||||
var sendImagePackets = function(packetData) {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
// 总数据包数
|
||||
const totalPackets = 7;
|
||||
const totalPackets = 3;
|
||||
let currentPacket = 1;
|
||||
let childPacket = 1;
|
||||
let totalChildPacket = 9;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 发送单个数据包
|
||||
const sendNextPacket = () => {
|
||||
if (currentPacket > totalPackets) {
|
||||
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;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
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
|
||||
bufferSize = bufferSize + 1
|
||||
}
|
||||
|
||||
|
||||
//FA 09 10 04 FC 09 [00] [01] + 4096字节+FF 数据格式
|
||||
let bufferSize = 343; //总共1029字节3包,正好每包343字节
|
||||
//FA 09 04 00 1024字节 FF
|
||||
var buffer = new ArrayBuffer(bufferSize);
|
||||
var dataView = new DataView(buffer);
|
||||
if (childPacket == 1) {
|
||||
if (currentPacket == 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(1, 0x09); // 帧头
|
||||
dataView.setUint8(2, 0x04); // 帧头
|
||||
dataView.setUint8(3, 0x00); // 帧头
|
||||
|
||||
|
||||
for (let i = 0; i < packetData.length; i++) {
|
||||
dataView.setUint8(4 + i, parseInt(packetData[i],16));
|
||||
}
|
||||
}
|
||||
|
||||
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 (currentPacket == totalPackets) {
|
||||
dataView.setUint8(bufferSize - 1, 0xFF);
|
||||
}
|
||||
|
||||
|
||||
//发送数据包
|
||||
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId,
|
||||
1000)
|
||||
30)
|
||||
.then(() => {
|
||||
|
||||
let curr = childPacket + (currentPacket - 1) *
|
||||
totalChildPacket;
|
||||
console.log("第" + currentPacket + "大包,第" + childPacket +
|
||||
"小包发送完成,总计:" + curr);
|
||||
|
||||
|
||||
updateLoading(these, {
|
||||
text: "正在发送" + curr + "/63"
|
||||
|
||||
text: "正在发送" + currentPacket + "/"+totalPackets
|
||||
|
||||
})
|
||||
if (childPacket == 9) {
|
||||
currentPacket++;
|
||||
childPacket = 1;
|
||||
} else {
|
||||
childPacket++;
|
||||
}
|
||||
|
||||
setTimeout(sendNextPacket, 1000);
|
||||
currentPacket++;
|
||||
|
||||
setTimeout(sendNextPacket, 100);
|
||||
}).catch(err => {
|
||||
if (err.code == 10007) {
|
||||
setTimeout(sendNextPacket, 1000);
|
||||
setTimeout(sendNextPacket, 100);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
console.log("发送数据包失败了", err);
|
||||
|
||||
|
||||
these.Status.BottomMenu.show = false;
|
||||
these.showPop({
|
||||
message: "发送数据包失败了" + err.msg,
|
||||
@ -748,13 +660,14 @@
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
});
|
||||
|
||||
|
||||
hideLoading(these);
|
||||
reject(err);
|
||||
});
|
||||
}
|
||||
// 开始发送数据
|
||||
sendNextPacket();
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
@ -770,13 +683,115 @@
|
||||
events: {
|
||||
ImgCutOver: function(data) {
|
||||
|
||||
let binaryToHex = (binaryArray) => {
|
||||
if (!Array.isArray(binaryArray) || binaryArray
|
||||
.length !== 8) {
|
||||
throw new Error("输入必须是包含8个元素的二进制数组");
|
||||
}
|
||||
|
||||
// 检查每个元素是否为0或1
|
||||
if (!binaryArray.every(bit => bit === 0 || bit ===
|
||||
1)) {
|
||||
throw new Error("数组元素必须只能是0或1");
|
||||
}
|
||||
|
||||
// 将二进制数组转换为十进制数
|
||||
let decimalValue = 0;
|
||||
for (let i = 0; i < 8; i++) {
|
||||
// 计算每个位的权重并累加
|
||||
decimalValue += binaryArray[i] * Math.pow(2,
|
||||
7 - i);
|
||||
}
|
||||
|
||||
// 将十进制转换为十六进制字符串,并添加0x前缀
|
||||
const hexString = "0x" + decimalValue.toString(16)
|
||||
.padStart(2, '0').toUpperCase();
|
||||
|
||||
return hexString;
|
||||
}
|
||||
|
||||
|
||||
let imageData = data.piexls;
|
||||
let arr = [];
|
||||
|
||||
for (let x = 0; x < imageData.length; x += 4) {
|
||||
let R = imageData[x];
|
||||
let G = imageData[x + 1];
|
||||
let B = imageData[x + 2];
|
||||
let A = imageData[x + 3];
|
||||
if (A < 128) {
|
||||
arr.push(0);
|
||||
continue;
|
||||
}
|
||||
let grayVal = Math.floor(R * 0.299 + G * 0.587 + B *
|
||||
0.114);
|
||||
// console.log("RGBA", R + "," + G + "," + B + "," + A +
|
||||
// ',' + grayVal);
|
||||
arr.push(grayVal < 128 ? 1 : 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
let f = arr.filter(v => {
|
||||
return v === 1;
|
||||
});
|
||||
//如果有超过1/3的亮点,将进行反色处理
|
||||
if (f.length > arr.length / 3) {
|
||||
for (var r = 0; r < arr.length; r++) {
|
||||
if (arr[r] === 0) {
|
||||
arr[r] = 1;
|
||||
} else {
|
||||
arr[r] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// console.log("arr=", JSON.stringify(arr));
|
||||
|
||||
let matrix = [];
|
||||
let size = 512;
|
||||
let len = arr.length / size;
|
||||
for (let j = 0; j < len; j++) {
|
||||
let start = j * size;
|
||||
let end = start + size;
|
||||
|
||||
let firstHalf = arr.slice(start, end);
|
||||
|
||||
let arr64 = [];
|
||||
for (let row = 0; row < 8; row++) {
|
||||
|
||||
for (let col = 0; col < 64; col++) {
|
||||
let ind = col + row * 64;
|
||||
if (col === 63) {
|
||||
|
||||
}
|
||||
let val = firstHalf[ind];
|
||||
if (arr64.length < col + 1) {
|
||||
arr64.push([])
|
||||
}
|
||||
|
||||
arr64[col].push(val);
|
||||
|
||||
if (arr64[col].length === 8) {
|
||||
|
||||
arr64[col] = arr64[col].reverse();
|
||||
matrix.push(binaryToHex(arr64[col]));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
console.log("matrix=", JSON.stringify(matrix));
|
||||
|
||||
|
||||
showLoading(these, {
|
||||
text: "正在发送0/52"
|
||||
text: "正在发送0/3"
|
||||
});
|
||||
|
||||
these.Status.BottomMenu.show = false;
|
||||
setTimeout(function() {
|
||||
processAndSendImageData(data.piexls).catch((
|
||||
sendImagePackets(matrix).catch((
|
||||
ex) => {
|
||||
console.log("出现异常", ex);
|
||||
});
|
||||
@ -786,7 +801,9 @@
|
||||
},
|
||||
success(ev) {
|
||||
ev.eventChannel.emit('checkImg', {
|
||||
data: res.tempFiles[0].path
|
||||
data: res.tempFiles[0].path,
|
||||
width: 64,
|
||||
height: 32
|
||||
})
|
||||
},
|
||||
fail(ex) {
|
||||
@ -973,12 +990,12 @@
|
||||
|
||||
},
|
||||
closePop: function() {
|
||||
this.Status.Pop.showPop = false;
|
||||
|
||||
if (this.Status.Pop.cancelCallback) {
|
||||
this.Status.Pop.cancelCallback();
|
||||
}
|
||||
},
|
||||
this.Status.Pop.showPop = false;
|
||||
|
||||
if (this.Status.Pop.cancelCallback) {
|
||||
this.Status.Pop.cancelCallback();
|
||||
}
|
||||
},
|
||||
HidePop: function() {
|
||||
console.log("1111");
|
||||
if (this.Status.Pop.clickEvt == 'SendUsr') {
|
||||
@ -1135,21 +1152,6 @@
|
||||
return level1.flat(Infinity);
|
||||
});
|
||||
console.log("result=", result);
|
||||
|
||||
// var str1="FA 06 01 00 FF FF F7 9F EF 6F EC F7 EA 09 CF FF AF FB EF EB EF EB EC 6B EF EB EC 6B EF EB EF FB EE 63 FF FF FF FF F7 9F EF 6F EC F7 EA 09 CF FF AF FB EF EB EF EB EC 6B EF EB EC 6B EF EB EF FB EE 63 FF FF FF FF F7 FF 81 03 ED BB DD B7 CB CF F3 C7 CD 39 BE FF FE FF C0 03 FE FB FD FB F3 F7 8F 87 FF FF FF FF FE FF FE FF FE FF C0 03 FF FB FD FB FD FB FD FB FD FB FB FB FB FF F7 F7 EF F7 9F 8F FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF"
|
||||
// var str2="FA 07 01 00 FF FF EE DD EE DF EF 5B AB DF AA 03 AE FF AE FF EE 03 EE FF EE FF EE 03 EE FF EE FF EE E3 FF FF FF FF EE DD EE DF EF 5B AB DF AA 03 AE FF AE FF EE 03 EE FF EE FF EE 03 EE FF EE FF EE E3 FF FF FF FF EF 77 EF 73 EF 7F 80 01 EF 7F EF 7F EF 03 E7 3B 8E BB EE D7 EE EF ED E7 ED 9B 8B 7D FF FF FF FF FF FF F7 EF F7 F7 EF F7 DF FB FF FF FF FF FE FF 80 01 FE 7F FD BF FB DF F7 E7 9F F9 FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF"
|
||||
// var str3="FA 08 01 00 FF FF EF DF EC 01 EF FF AB FF AA 03 AA FB AE FB EE 03 EF DF EF DF EE DB ED DF ED DD EF 1F FF FF FF FF EF BF EF 87 81 77 EE F7 EC 03 81 7F EF 7F EF 7F EF 03 81 7F EF 7F EF 7D EF 7D EF 03 FF FF FF FF F9 F1 CF BF DF FF DF FF C1 FF DD 81 DD F7 DD F7 C1 F7 DF 77 FF 77 BF 77 BF 77 FF F7 FF FF FF FF FD FF FD FF FB FF FB FF F0 07 E7 F7 EF F7 D8 07 BF F7 FF F7 F8 07 FF F7 FF F7 FF C7 FF FF FF FF FF FF FF FF FF FF FE FF FE 7F FE 7F FE FF FD BF FD FF FB DF F7 EF EF F7 DF FB BF FD FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF"
|
||||
|
||||
// let arr1=('0x'+(str1.split(' ').join(",0x"))).split(',');
|
||||
// let arr2=('0x'+(str2.split(' ').join(",0x"))).split(',');
|
||||
// let arr3=('0x'+(str3.split(' ').join(",0x"))).split(',');
|
||||
|
||||
// result=[arr1,arr2,arr3];
|
||||
|
||||
|
||||
// console.log("result=",result);
|
||||
|
||||
|
||||
let h3dic = [0x06, 0x07, 0x08];
|
||||
let pros = [];
|
||||
let flag = true;
|
||||
|
||||
Reference in New Issue
Block a user