Compare commits
16 Commits
bd56ca997b
...
b8ce1621b4
| Author | SHA1 | Date | |
|---|---|---|---|
| b8ce1621b4 | |||
| c81a4d1903 | |||
| 27d212e7dc | |||
| 9037ef6ac3 | |||
| a30a631ea6 | |||
| 2b72cc1a5c | |||
| 77be45f1f3 | |||
| a0c883f4e3 | |||
| 9313ec0106 | |||
| ca6345ee3e | |||
| d06cd6cdfd | |||
| 2218ca0650 | |||
| 500b461bdd | |||
| 3526f28d06 | |||
| 3eeffdb62c | |||
| 317c762edc |
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<canvas type="2d" canvas-id="reusableCanvas" :width="currentCanvasWidth" :height="currentCanvasHeight"
|
<canvas canvas-id="reusableCanvas" :width="currentCanvasWidth" :height="currentCanvasHeight"
|
||||||
class="offscreen-canvas"></canvas>
|
class="offscreen-canvas"></canvas>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@ -27,6 +27,16 @@
|
|||||||
color: {
|
color: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "#000000"
|
default: "#000000"
|
||||||
|
},
|
||||||
|
// 二值化阈值(0~1),越大越细;默认偏清晰
|
||||||
|
threshold: {
|
||||||
|
type: Number,
|
||||||
|
default: 0.45
|
||||||
|
},
|
||||||
|
// 是否启用轻度笔画修复(3x3 膨胀);默认关闭以避免变粗
|
||||||
|
sharpen: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@ -48,6 +58,16 @@
|
|||||||
this.ctx = uni.createCanvasContext('reusableCanvas', this);
|
this.ctx = uni.createCanvasContext('reusableCanvas', this);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
/**
|
||||||
|
* 外部可调用:复位画布为纯背景并立即提交
|
||||||
|
*/
|
||||||
|
async resetCanvas() {
|
||||||
|
if (!this.ctx) return;
|
||||||
|
this.clearCanvas();
|
||||||
|
await new Promise((resolve) => {
|
||||||
|
this.ctx.draw(true, () => setTimeout(resolve, 30));
|
||||||
|
});
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 估算单行文本所需的Canvas宽度
|
* 估算单行文本所需的Canvas宽度
|
||||||
*/
|
*/
|
||||||
@ -59,6 +79,8 @@
|
|||||||
* 清除Canvas内容
|
* 清除Canvas内容
|
||||||
*/
|
*/
|
||||||
clearCanvas() {
|
clearCanvas() {
|
||||||
|
// 先清除,再用背景色填充,确保无残留
|
||||||
|
this.ctx.clearRect(0, 0, this.currentCanvasWidth, this.currentCanvasHeight);
|
||||||
this.ctx.setFillStyle(this.bgColor);
|
this.ctx.setFillStyle(this.bgColor);
|
||||||
this.ctx.fillRect(0, 0, this.currentCanvasWidth, this.currentCanvasHeight);
|
this.ctx.fillRect(0, 0, this.currentCanvasWidth, this.currentCanvasHeight);
|
||||||
},
|
},
|
||||||
@ -67,6 +89,11 @@
|
|||||||
* 复用单个Canvas处理所有文本行
|
* 复用单个Canvas处理所有文本行
|
||||||
*/
|
*/
|
||||||
async drawAndGetPixels() {
|
async drawAndGetPixels() {
|
||||||
|
// 发送前:确保画布处于干净背景态
|
||||||
|
await this.resetCanvas();
|
||||||
|
// 超采样比例(提高分辨率再降采样,减少模糊)
|
||||||
|
const SCALE = 3;
|
||||||
|
const PADDING_X = 1 * SCALE; // 左侧预留像素,避免首字裁剪
|
||||||
let binaryToHex = (binaryArray) => {
|
let binaryToHex = (binaryArray) => {
|
||||||
if (!Array.isArray(binaryArray) || binaryArray.length !== 8) {
|
if (!Array.isArray(binaryArray) || binaryArray.length !== 8) {
|
||||||
throw new Error("输入必须是包含8个元素的二进制数组");
|
throw new Error("输入必须是包含8个元素的二进制数组");
|
||||||
@ -90,25 +117,107 @@
|
|||||||
return hexString;
|
return hexString;
|
||||||
}
|
}
|
||||||
|
|
||||||
let convertCharToMatrix = (imageData, item) => {
|
let convertCharToMatrix = (drawResult, item) => {
|
||||||
|
// 设备端使用13x13点阵渲染(保持输出13列×13行),但只在内部采样12×12,保留右侧与底部1像素缓冲
|
||||||
const charWidth = 13;
|
const charWidth = 13;
|
||||||
const charHeight = 12;
|
const charHeight = 13;
|
||||||
const pixels = [];
|
const effectiveWidth = 12; // 仅采样前12列
|
||||||
for (let i = 0; i < imageData.length; i += 4) {
|
const effectiveHeight = 12; // 仅采样前12行
|
||||||
const R = imageData[i];
|
const { pixelData, width, height } = drawResult;
|
||||||
pixels.push(R < 128 ? 1 : 0);
|
// 将高分辨率像素降采样为13x13的布尔矩阵
|
||||||
|
const target = new Array(charWidth * charHeight).fill(0);
|
||||||
|
const threshold = Math.max(0.2, Math.min(0.8, this.threshold || 0.45));
|
||||||
|
|
||||||
|
// 确保采样区域严格对齐,从PADDING_X开始,只采样12列(右侧预留1px),12行(底部预留1px)
|
||||||
|
// 字符实际绘制区域:从PADDING_X开始,宽度为12*SCALE
|
||||||
|
const charStartX = PADDING_X;
|
||||||
|
const charEndX = PADDING_X + effectiveWidth * SCALE; // 仅采样到第12列
|
||||||
|
|
||||||
|
for (let y = 0; y < charHeight; y++) {
|
||||||
|
for (let x = 0; x < charWidth; x++) {
|
||||||
|
// 超出有效采样区域(第13列或第13行)直接置0,作为缓冲
|
||||||
|
if (x >= effectiveWidth || y >= effectiveHeight) {
|
||||||
|
target[y * charWidth + x] = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let onCount = 0;
|
||||||
|
let total = 0;
|
||||||
|
// 采样区域:字符从PADDING_X开始绘制,每列宽度为SCALE
|
||||||
|
const startX = PADDING_X + x * SCALE;
|
||||||
|
const startY = y * SCALE;
|
||||||
|
|
||||||
|
for (let sy = 0; sy < SCALE; sy++) {
|
||||||
|
for (let sx = 0; sx < SCALE; sx++) {
|
||||||
|
const px = startX + sx;
|
||||||
|
const py = startY + sy;
|
||||||
|
|
||||||
|
// 边界检查:确保不超出Canvas边界,且不超出字符实际绘制区域
|
||||||
|
if (px < 0 || py < 0 || px >= width || py >= height) {
|
||||||
|
// 边界外视为背景(黑色)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 额外检查:确保不采样到字符右侧的残留区域
|
||||||
|
if (px >= charEndX) {
|
||||||
|
// 超出字符区域,视为背景
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const idx = (py * width + px) * 4;
|
||||||
|
const R = pixelData[idx];
|
||||||
|
const G = pixelData[idx + 1];
|
||||||
|
const B = pixelData[idx + 2];
|
||||||
|
const A = pixelData[idx + 3] || 255;
|
||||||
|
// 计算亮度
|
||||||
|
const luminance = 0.299 * R + 0.587 * G + 0.114 * B;
|
||||||
|
const alpha = A / 255;
|
||||||
|
// 背景是黑色,文字是白色,所以判断亮色(>=128)为文字点
|
||||||
|
if (luminance >= 128 && alpha > 0.5) onCount++;
|
||||||
|
total++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 当亮色占比超过阈值时判为1(至少需要采样到一些像素)
|
||||||
|
target[y * charWidth + x] = (total > 0 && onCount / total >= threshold) ? 1 : 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 轻度笔画修复:可选 3x3 膨胀(启用时阈值更严格,避免变粗)
|
||||||
|
if (this.sharpen) {
|
||||||
|
const dilated = target.slice();
|
||||||
|
for (let y = 0; y < effectiveHeight; y++) {
|
||||||
|
for (let x = 0; x < effectiveWidth; x++) {
|
||||||
|
const idx = y * charWidth + x;
|
||||||
|
if (target[idx] === 1) continue;
|
||||||
|
let neighbors = 0;
|
||||||
|
for (let dy = -1; dy <= 1; dy++) {
|
||||||
|
for (let dx = -1; dx <= 1; dx++) {
|
||||||
|
if (dx === 0 && dy === 0) continue;
|
||||||
|
const nx = x + dx;
|
||||||
|
const ny = y + dy;
|
||||||
|
if (nx < 0 || ny < 0 || nx >= effectiveWidth || ny >= effectiveHeight) continue;
|
||||||
|
if (target[ny * charWidth + nx] === 1) neighbors++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 使用更严格的邻居门限,避免整体变粗
|
||||||
|
if (neighbors >= 5) {
|
||||||
|
dilated[idx] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (let i = 0; i < target.length; i++) target[i] = dilated[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
const lowBytes = new Array(charWidth).fill(0);
|
const lowBytes = new Array(charWidth).fill(0);
|
||||||
const highBytes = new Array(charWidth).fill(0);
|
const highBytes = new Array(charWidth).fill(0);
|
||||||
|
// 按列打包,每列13行分成上下两字节:低字节0-7行(8行),高字节8-12行(5行)
|
||||||
for (let col = 0; col < charWidth; col++) {
|
for (let col = 0; col < charWidth; col++) {
|
||||||
for (let row = 0; row < charHeight; row++) {
|
for (let row = 0; row < charHeight; row++) {
|
||||||
const pixel = pixels[row * charWidth + col];
|
const pixel = target[row * charWidth + col];
|
||||||
if (pixel === 1) {
|
if (pixel === 1) {
|
||||||
if (row < 8) {
|
if (row < 8) {
|
||||||
|
// 低字节:0-7行,从低位到高位
|
||||||
lowBytes[col] |= (1 << row);
|
lowBytes[col] |= (1 << row);
|
||||||
} else {
|
} else {
|
||||||
|
// 高字节:8-12行,从低位到高位(使用5位,剩余3位未使用)
|
||||||
highBytes[col] |= (1 << (row - 8));
|
highBytes[col] |= (1 << (row - 8));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -121,34 +230,32 @@
|
|||||||
let result = {};
|
let result = {};
|
||||||
let ctx = this.ctx;
|
let ctx = this.ctx;
|
||||||
|
|
||||||
// 1. 动态调整Canvas尺寸
|
// 1. 动态调整Canvas尺寸(高分辨率)
|
||||||
this.currentCanvasWidth = 13;
|
// 设备端使用13x13点阵渲染
|
||||||
this.currentCanvasHeight = 12;
|
this.currentCanvasWidth = 13 * SCALE + PADDING_X;
|
||||||
|
this.currentCanvasHeight = 13 * SCALE;
|
||||||
|
|
||||||
// 2. 清空Canvas(绘制背景)
|
// 2. 清空Canvas(绘制背景)
|
||||||
this.clearCanvas();
|
this.clearCanvas();
|
||||||
|
|
||||||
// 3. 设置文字样式
|
// 3. 设置文字样式(整数像素对齐,顶部基线,避免首字裁剪)
|
||||||
ctx.setFillStyle(this.color);
|
ctx.setFillStyle(this.color);
|
||||||
ctx.setTextBaseline('middle');
|
ctx.setTextBaseline('top');
|
||||||
// ctx.setTextAlign('center')
|
ctx.setTextAlign('left');
|
||||||
ctx.setFontSize(this.fontSize);
|
const fs = Math.max(1, Math.round(this.fontSize)) * SCALE;
|
||||||
ctx.font = `${this.fontSize}px "PingFangBold", "PingFang SC", Arial, sans-serif`;
|
ctx.setFontSize(fs);
|
||||||
|
ctx.font = `${fs}px "PingFangBold", "PingFang SC", Arial, sans-serif`;
|
||||||
|
|
||||||
// 4. 绘制当前行文本
|
// 4. 绘制单个字符(每个字符独立绘制在固定位置)
|
||||||
let currentX = 0;
|
// 确保字符始终从PADDING_X开始绘制,Y坐标为0,保证采样一致性
|
||||||
let currentY = this.fontSize / 2 + 1;
|
const charX = PADDING_X;
|
||||||
for (let j = 0; j < textLine.length; j++) {
|
const charY = 0;
|
||||||
let char = textLine[j];
|
ctx.fillText(textLine, charX, charY);
|
||||||
ctx.fillText(char, currentX, currentY);
|
|
||||||
// 按实际字符宽度计算间距
|
|
||||||
let charWidth = ctx.measureText(char).width;
|
|
||||||
currentX += charWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 5. 异步绘制并获取像素数据(串行处理避免冲突)
|
// 5. 异步绘制并获取像素数据(串行处理避免冲突)
|
||||||
await new Promise((resolve, reject) => {
|
const grabPixels = () => new Promise((resolve, reject) => {
|
||||||
ctx.draw(false, () => {
|
// 立即绘制并给一点缓冲时间,避免取像素过早
|
||||||
|
ctx.draw(true, () => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.canvasGetImageData({
|
uni.canvasGetImageData({
|
||||||
canvasId: 'reusableCanvas',
|
canvasId: 'reusableCanvas',
|
||||||
@ -165,15 +272,23 @@
|
|||||||
};
|
};
|
||||||
resolve();
|
resolve();
|
||||||
},
|
},
|
||||||
fail: err => {
|
fail: err => reject(err)
|
||||||
// console.error(`处理第${i+1}行失败:`, err);
|
|
||||||
reject(err)
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}, 100);
|
}, 70);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await grabPixels();
|
||||||
|
// 一次性校验:若像素全黑或明显异常,重绘重取一次
|
||||||
|
let nonZero = false;
|
||||||
|
for (let i = 0; i < result.pixelData.length; i += 4) {
|
||||||
|
if (result.pixelData[i] || result.pixelData[i+1] || result.pixelData[i+2]) { nonZero = true; break; }
|
||||||
|
}
|
||||||
|
if (!nonZero) {
|
||||||
|
await new Promise(r => setTimeout(r, 50));
|
||||||
|
await grabPixels();
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
let arr = [];
|
let arr = [];
|
||||||
@ -184,13 +299,23 @@
|
|||||||
let item = this.validTxts[i];
|
let item = this.validTxts[i];
|
||||||
// console.log("item=", item);
|
// console.log("item=", item);
|
||||||
for (var j = 0; j < item.length; j++) {
|
for (var j = 0; j < item.length; j++) {
|
||||||
let result = await drawTxt(item[j]);
|
let char = item[j];
|
||||||
linePixls.push(convertCharToMatrix(result.pixelData, item));
|
let result = await drawTxt(char);
|
||||||
|
let matrix = convertCharToMatrix(result, item);
|
||||||
|
// 调试:打印每个字符的点阵数据
|
||||||
|
console.log(`[点阵生成] 字符"${char}" 点阵数据:`, matrix.map(b => '0x' + b.toString(16).padStart(2, '0')).join(' '));
|
||||||
|
linePixls.push(matrix);
|
||||||
|
// 在字符间增加轻微延时,避免相邻提取竞争(尤其是末字符)
|
||||||
|
await new Promise(r => setTimeout(r, 20));
|
||||||
}
|
}
|
||||||
// console.log("hexs=", linePixls.join(","));
|
// console.log("hexs=", linePixls.join(","));
|
||||||
arr.push(linePixls);
|
arr.push(linePixls);
|
||||||
|
// 每行结束再等一会,提高末字符稳定性
|
||||||
|
await new Promise(r => setTimeout(r, 40));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 发送后:再次清空画布,避免残留影响下一次
|
||||||
|
await this.resetCanvas();
|
||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -202,6 +327,5 @@
|
|||||||
position: fixed;
|
position: fixed;
|
||||||
left: -9999px;
|
left: -9999px;
|
||||||
top: -9999px;
|
top: -9999px;
|
||||||
visibility: hidden;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
34
pages.json
34
pages.json
@ -164,6 +164,12 @@
|
|||||||
"fullscreen": true
|
"fullscreen": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/6075/BJQ6075",
|
||||||
|
"style": {
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/common/map/index",
|
"path": "pages/common/map/index",
|
||||||
"style": {
|
"style": {
|
||||||
@ -252,31 +258,27 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path" : "pages/6331/BJQ6331",
|
"path": "pages/6331/BJQ6331",
|
||||||
"style" :
|
"style": {
|
||||||
{
|
"navigationBarTitleText": "BJQ6331"
|
||||||
"navigationBarTitleText" : "BJQ6331"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path" : "pages/6331/AudioManager",
|
"path": "pages/6331/AudioManager",
|
||||||
"style" :
|
"style": {
|
||||||
{
|
"navigationBarTitleText": "语音管理"
|
||||||
"navigationBarTitleText" : "语音管理"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path" : "pages/4877/BJQ4877",
|
"path": "pages/4877/BJQ4877",
|
||||||
"style" :
|
"style": {
|
||||||
{
|
"navigationBarTitleText": "BJQ 4877"
|
||||||
"navigationBarTitleText" : "BJQ 4877"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path" : "pages/100/HBY100",
|
"path": "pages/100/HBY100",
|
||||||
"style" :
|
"style": {
|
||||||
{
|
"navigationBarTitleText": "HBY 100"
|
||||||
"navigationBarTitleText" : "HBY 100"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -147,7 +147,6 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="arrowContent marginTop10">
|
<view class="arrowContent marginTop10">
|
||||||
<view class="modeSetting">
|
<view class="modeSetting">
|
||||||
|
|
||||||
<view class="arrow" @click.stop="ArrowSet('red_all')"
|
<view class="arrow" @click.stop="ArrowSet('red_all')"
|
||||||
:class="formData.sta_ArrowType=='red_all'?'active':''">
|
:class="formData.sta_ArrowType=='red_all'?'active':''">
|
||||||
<view class="outCircle">
|
<view class="outCircle">
|
||||||
|
|||||||
1391
pages/6075/BJQ6075.vue
Normal file
1391
pages/6075/BJQ6075.vue
Normal file
File diff suppressed because it is too large
Load Diff
@ -297,11 +297,8 @@
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
lastBrightnessTime: 0,
|
|
||||||
isCardSliding: false,
|
isCardSliding: false,
|
||||||
cardRect: null,
|
cardRect: null,
|
||||||
touchStartX: 0,
|
|
||||||
touchStartY: 0,
|
|
||||||
pageLoading: true,
|
pageLoading: true,
|
||||||
navBarHeight: 70 + uni.getSystemInfoSync().statusBarHeight,
|
navBarHeight: 70 + uni.getSystemInfoSync().statusBarHeight,
|
||||||
navTitle: "",
|
navTitle: "",
|
||||||
@ -338,7 +335,6 @@
|
|||||||
isLaserOn: false,
|
isLaserOn: false,
|
||||||
isSending: false,
|
isSending: false,
|
||||||
isProcessing: false,
|
isProcessing: false,
|
||||||
isLoading: false, // 主加载状态
|
|
||||||
isPolling: false // 轮询状态
|
isPolling: false // 轮询状态
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -557,7 +553,6 @@
|
|||||||
};
|
};
|
||||||
lightModeSettings(data).then((res) => {
|
lightModeSettings(data).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
// 只有确认成功才更新实际模式,选中模式
|
|
||||||
this.currentMainMode = this.pendingMainMode;
|
this.currentMainMode = this.pendingMainMode;
|
||||||
this.selectedItemIndex = selectedItem;
|
this.selectedItemIndex = selectedItem;
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@ -566,15 +561,11 @@
|
|||||||
})
|
})
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
this.lightModeA = false;
|
this.lightModeA = false;
|
||||||
//this.isProcessing = false
|
|
||||||
//loadingShown = false
|
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
//this.isProcessing = false
|
|
||||||
//loadingShown = false
|
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -88,62 +88,65 @@
|
|||||||
<view class="btnSend fright" v-on:click.stop="sendUsr">发送</view>
|
<view class="btnSend fright" v-on:click.stop="sendUsr">发送</view>
|
||||||
<view class="clear"></view>
|
<view class="clear"></view>
|
||||||
<textToDotMatrixFor7305 class="TextToHex" ref="textToHex" :txts="formData.textLines"
|
<textToDotMatrixFor7305 class="TextToHex" ref="textToHex" :txts="formData.textLines"
|
||||||
:bgColor="'#FFFFFF'" :color="'#000000'" :fontSize="11" />
|
:bgColor="'#000000'" :color="'#FFFFFF'" :fontSize="11" ></textToDotMatrixFor7305>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="item">
|
||||||
|
<text class="lbl">单位:</text>
|
||||||
|
<input class="value" v-model="formData.textLines[0]" placeholder="请输入"
|
||||||
|
placeholder-class="usrplace" />
|
||||||
|
</view>
|
||||||
|
<view class="item">
|
||||||
|
<text class="lbl">部门:</text>
|
||||||
|
<input class="value" v-model="formData.textLines[1]" placeholder="请输入"
|
||||||
|
placeholder-class="usrplace" />
|
||||||
|
</view>
|
||||||
|
<view class="item">
|
||||||
|
<text class="lbl">姓名:</text>
|
||||||
|
<input class="value" v-model="formData.textLines[2]" placeholder="请输入"
|
||||||
|
placeholder-class="usrplace" />
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
<view class="proinfo lamp">
|
||||||
|
<text class="title">产品信息</text>
|
||||||
|
<view class="itemcontent">
|
||||||
|
<view class="item" @click="proParam()">
|
||||||
|
<image class="img" src="/static/images/6155/DeviceDetail/param.png" mode="aspectFit"></image>
|
||||||
|
<text class="txt">产品参数</text>
|
||||||
|
</view>
|
||||||
|
<view class="item" @click="handRemark()">
|
||||||
|
<image class="img" src="/static/images/6155/DeviceDetail/remark.png" mode="aspectFit"></image>
|
||||||
|
<text class="txt">操作说明</text>
|
||||||
|
</view>
|
||||||
|
<view class="item" @click="handVideo()">
|
||||||
|
<image class="img" src="/static/images/6155/DeviceDetail/video.png" mode="aspectFit"></image>
|
||||||
|
<text class="txt">操作视频</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="item">
|
<!-- 弹窗通知 -->
|
||||||
<text class="lbl">单位:</text>
|
<MessagePopup :visible="Status.Pop.showPop" :type="Status.Pop.popType" :bgColor="Status.Pop.bgColor"
|
||||||
<input class="value" v-model="formData.textLines[0]" placeholder="请输入单位" placeholder-class="usrplace" />
|
:borderColor="Status.Pop.borderColor" :textColor="Status.Pop.textColor"
|
||||||
</view>
|
:buttonBgColor="Status.Pop.buttonBgColor" :buttonTextColor="Status.Pop.buttonTextColor"
|
||||||
<view class="item">
|
:iconUrl="Status.Pop.iconUrl" :message="Status.Pop.message" :buttonText="Status.Pop.buttonText"
|
||||||
<text class="lbl">部门:</text>
|
@buttonClick="HidePop" @closePop="closePop" :visiblePrompt="Status.Pop.visiblePrompt"
|
||||||
<input class="value" v-model="formData.textLines[1]" placeholder="请输入姓名" placeholder-class="usrplace" />
|
:promptTitle="Status.Pop.promptTitle" v-model="Status.Pop.modelValue" />
|
||||||
</view>
|
|
||||||
<view class="item">
|
|
||||||
<text class="lbl">姓名:</text>
|
|
||||||
<input class="value" v-model="formData.textLines[2]" placeholder="请输入职位" placeholder-class="usrplace" />
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
<!-- 下方菜单 -->
|
||||||
|
<BottomSlideMenuPlus :config="Status.BottomMenu" @close="closeMenu" @itemClick="handleItemClick"
|
||||||
|
@btnClick="btnClick">
|
||||||
|
<view class="addIco">
|
||||||
|
<view class="icoContent center" v-on:click.stop="checkImgUpload()">
|
||||||
|
<image mode="aspectFit" class="img" src="/static/images/6155/DeviceDetail/add.png"></image>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</BottomSlideMenuPlus>
|
||||||
|
|
||||||
|
<global-loading ref="loading" />
|
||||||
</view>
|
</view>
|
||||||
<view class="proinfo lamp">
|
|
||||||
<text class="title">产品信息</text>
|
|
||||||
<view class="itemcontent">
|
|
||||||
<view class="item" @click="proParam()">
|
|
||||||
<image class="img" src="/static/images/6155/DeviceDetail/param.png" mode="aspectFit"></image>
|
|
||||||
<text class="txt">产品参数</text>
|
|
||||||
</view>
|
|
||||||
<view class="item" @click="handRemark()">
|
|
||||||
<image class="img" src="/static/images/6155/DeviceDetail/remark.png" mode="aspectFit"></image>
|
|
||||||
<text class="txt">操作说明</text>
|
|
||||||
</view>
|
|
||||||
<view class="item" @click="handVideo()">
|
|
||||||
<image class="img" src="/static/images/6155/DeviceDetail/video.png" mode="aspectFit"></image>
|
|
||||||
<text class="txt">操作视频</text>
|
|
||||||
</view>
|
|
||||||
</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" @closePop="closePop" :visiblePrompt="Status.Pop.visiblePrompt"
|
|
||||||
:promptTitle="Status.Pop.promptTitle" v-model="Status.Pop.modelValue" />
|
|
||||||
|
|
||||||
<!-- 下方菜单 -->
|
|
||||||
<BottomSlideMenuPlus :config="Status.BottomMenu" @close="closeMenu" @itemClick="handleItemClick"
|
|
||||||
@btnClick="btnClick">
|
|
||||||
<view class="addIco">
|
|
||||||
<view class="icoContent center" v-on:click.stop="checkImgUpload()">
|
|
||||||
<image mode="aspectFit" class="img" src="/static/images/6155/DeviceDetail/add.png"></image>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
</view>
|
|
||||||
</BottomSlideMenuPlus>
|
|
||||||
|
|
||||||
<global-loading ref="loading" />
|
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@ -189,7 +192,7 @@
|
|||||||
visibleClose: false,
|
visibleClose: false,
|
||||||
okCallback: null
|
okCallback: null
|
||||||
},
|
},
|
||||||
BottomMenu: {
|
BottomMenu: {
|
||||||
show: false,
|
show: false,
|
||||||
showHeader: true,
|
showHeader: true,
|
||||||
menuItems: [{
|
menuItems: [{
|
||||||
@ -223,7 +226,11 @@
|
|||||||
btnTextColor: "#232323de",
|
btnTextColor: "#232323de",
|
||||||
showMask: true,
|
showMask: true,
|
||||||
maskBgColor: '#00000066',
|
maskBgColor: '#00000066',
|
||||||
showClose: false
|
showClose: false
|
||||||
|
},
|
||||||
|
// 发送互斥,防止三屏过程中被其它BLE写入打断
|
||||||
|
Send: {
|
||||||
|
lock: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
formData: {
|
formData: {
|
||||||
@ -259,7 +266,8 @@
|
|||||||
alarmStatus: null,
|
alarmStatus: null,
|
||||||
detailPageUrl: "/pages/6155/deviceDetail",
|
detailPageUrl: "/pages/6155/deviceDetail",
|
||||||
showConfirm: false
|
showConfirm: false
|
||||||
}
|
},
|
||||||
|
sendSeq: 0
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -298,6 +306,17 @@
|
|||||||
these.showBleUnConnect();
|
these.showBleUnConnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 确保设备对象的detailPageUrl正确设置,以便ReceiveData能找到对应的handler
|
||||||
|
if (f.device) {
|
||||||
|
f.device.detailPageUrl = "/pages/7305/BJQ7305";
|
||||||
|
} else {
|
||||||
|
f.device = {
|
||||||
|
...device,
|
||||||
|
detailPageUrl: "/pages/7305/BJQ7305"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
let form = f.formData;
|
let form = f.formData;
|
||||||
if (form) {
|
if (form) {
|
||||||
let keys = Object.keys(form);
|
let keys = Object.keys(form);
|
||||||
@ -311,10 +330,30 @@
|
|||||||
these.formData.img = device.devicePic;
|
these.formData.img = device.devicePic;
|
||||||
these.formData.id = device.id;
|
these.formData.id = device.id;
|
||||||
these.formData.deviceId = f.deviceId;
|
these.formData.deviceId = f.deviceId;
|
||||||
these.formData.bleStatu = false;
|
// 更新缓存中的设备信息
|
||||||
|
ble.updateCache();
|
||||||
|
|
||||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
console.log("连接成功")
|
console.log("连接成功");
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
|
|
||||||
|
// 连接成功后,同步BleHelper中的连接状态
|
||||||
|
if (f) {
|
||||||
|
f.Linked = true;
|
||||||
|
ble.updateCache();
|
||||||
|
console.log("页面初始化连接成功,同步BleHelper连接状态为已连接");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 确保订阅消息已开启
|
||||||
|
let linkedDevice = ble.data.LinkedList.find(v => v.deviceId == f.deviceId);
|
||||||
|
if (linkedDevice && !linkedDevice.notifyState) {
|
||||||
|
console.log("连接成功但未订阅,主动订阅消息");
|
||||||
|
ble.subScribe(f.deviceId, true).then(() => {
|
||||||
|
console.log("订阅消息成功");
|
||||||
|
}).catch(err => {
|
||||||
|
console.error("订阅消息失败:", err);
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
these.setBleFormData();
|
these.setBleFormData();
|
||||||
these.getDetail();
|
these.getDetail();
|
||||||
@ -384,6 +423,25 @@
|
|||||||
}
|
}
|
||||||
if (res.deviceId == these.formData.deviceId) {
|
if (res.deviceId == these.formData.deviceId) {
|
||||||
this.formData.bleStatu = true;
|
this.formData.bleStatu = true;
|
||||||
|
|
||||||
|
// 连接恢复后,同步BleHelper中的连接状态
|
||||||
|
let f = this.getDevice();
|
||||||
|
if (f) {
|
||||||
|
f.Linked = true;
|
||||||
|
ble.updateCache();
|
||||||
|
console.log("设备连接恢复,同步BleHelper连接状态为已连接");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 连接恢复后,确保重新订阅消息以接收设备上报的数据
|
||||||
|
if (f && (f.notifyServiceid || f.notifyCharactId)) {
|
||||||
|
console.log("连接恢复,重新订阅消息");
|
||||||
|
ble.subScribe(res.deviceId, true).then(() => {
|
||||||
|
console.log("订阅消息成功,等待设备上报数据");
|
||||||
|
}).catch(err => {
|
||||||
|
console.error("订阅消息失败:", err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
hideLoading(these, 1000);
|
hideLoading(these, 1000);
|
||||||
});
|
});
|
||||||
@ -434,6 +492,13 @@
|
|||||||
});
|
});
|
||||||
ble.LinkBlue(these.formData.deviceId).then(() => {
|
ble.LinkBlue(these.formData.deviceId).then(() => {
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
|
// 连接成功后,同步BleHelper中的连接状态
|
||||||
|
let f = this.getDevice();
|
||||||
|
if (f) {
|
||||||
|
f.Linked = true;
|
||||||
|
ble.updateCache();
|
||||||
|
console.log("蓝牙状态恢复后连接成功,同步BleHelper连接状态为已连接");
|
||||||
|
}
|
||||||
updateLoading(these, {
|
updateLoading(these, {
|
||||||
text: '连接成功'
|
text: '连接成功'
|
||||||
});
|
});
|
||||||
@ -467,39 +532,56 @@
|
|||||||
return f;
|
return f;
|
||||||
},
|
},
|
||||||
bleValueNotify: function(receive, device, path, recArr) {
|
bleValueNotify: function(receive, device, path, recArr) {
|
||||||
if (receive.deviceId !== this.formData.deviceId) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (this.Status.pageHide) {
|
if (this.Status.pageHide) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let json = recei.ReceiveData(receive, device, path, recArr);
|
let json = recei.ReceiveData(receive, device, path, recArr);
|
||||||
|
|
||||||
if (!json) {
|
// 检查返回的数据是否有效(应该是解析后的对象,不是原始receive对象)
|
||||||
|
// 如果返回的是原始receive对象(有bytes属性),说明handler没有匹配或解析失败
|
||||||
|
if (!json || (json.hasOwnProperty('bytes') && (!json.battary && json.battary !== 0))) {
|
||||||
|
console.log("收到7305数据但未解析或解析失败:", json);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let keys = Object.keys(json);
|
|
||||||
keys.forEach((key) => {
|
console.log("收到7305解析数据:", json);
|
||||||
if (key in these.formData) {
|
console.log("formData更新前 - battary:", these.formData.battary, "xuhang:", these.formData.xuhang, "statu:", these.formData.statu);
|
||||||
these.formData[key] = json[key];
|
|
||||||
|
// 确保电量和续航时间正确更新(使用 $set 确保 Vue 响应式)
|
||||||
|
if (json.battary !== undefined && json.battary !== null) {
|
||||||
|
this.$set(these.formData, 'battary', json.battary);
|
||||||
|
console.log("更新电量:", json.battary, "->", these.formData.battary);
|
||||||
|
if (json.battary <= 20) {
|
||||||
|
this.showPop({
|
||||||
|
message: "设备电量低",
|
||||||
|
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||||
|
borderColor: "#e034344d",
|
||||||
|
buttonBgColor: "#E03434",
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
|
||||||
if ('statu' in json) {
|
|
||||||
these.formData.statu = json.statu == '1' ? '充电中' : '未充电';
|
|
||||||
}
|
}
|
||||||
if ('xuhang' in json) {
|
if (json.xuhang !== undefined && json.xuhang !== null) {
|
||||||
these.formData.xuhang = json.xuhang;
|
this.$set(these.formData, 'xuhang', json.xuhang);
|
||||||
|
console.log("更新续航时间:", json.xuhang, "->", these.formData.xuhang);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('battary' in json && this.formData.battary <= 20) {
|
// 更新充电状态
|
||||||
this.showPop({
|
if (json.statu !== undefined && json.statu !== null) {
|
||||||
message: "设备电量低",
|
this.$set(these.formData, 'statu', json.statu);
|
||||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
console.log("更新充电状态:", json.statu, "->", these.formData.statu);
|
||||||
borderColor: "#e034344d",
|
|
||||||
buttonBgColor: "#E03434",
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 更新其他字段
|
||||||
|
let keys = Object.keys(json);
|
||||||
|
keys.forEach((key) => {
|
||||||
|
if (key in these.formData && key !== 'battary' && key !== 'xuhang' && key !== 'statu') {
|
||||||
|
this.$set(these.formData, key, json[key]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("formData更新后 - battary:", these.formData.battary, "xuhang:", these.formData.xuhang, "statu:", these.formData.statu);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
proParam: function() {
|
proParam: function() {
|
||||||
@ -534,7 +616,6 @@
|
|||||||
borderColor: "#e034344d",
|
borderColor: "#e034344d",
|
||||||
buttonBgColor: "#E03434",
|
buttonBgColor: "#E03434",
|
||||||
buttonText: '去连接',
|
buttonText: '去连接',
|
||||||
buttonTextColor: '#232323de',
|
|
||||||
okCallback: function() {
|
okCallback: function() {
|
||||||
console.log("1111");
|
console.log("1111");
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
@ -876,6 +957,11 @@
|
|||||||
this.closeMenu();
|
this.closeMenu();
|
||||||
},
|
},
|
||||||
setMode(mode, type) {
|
setMode(mode, type) {
|
||||||
|
// 发送互斥:人员信息发送期间禁止模式切换
|
||||||
|
if (this.Status.Send && this.Status.Send.lock) {
|
||||||
|
console.warn('正在发送三屏数据,模式切换已忽略');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let dataValue = 0;
|
let dataValue = 0;
|
||||||
|
|
||||||
@ -926,6 +1012,13 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 发送前确保连接状态同步:如果页面显示已连接,同步更新 BleHelper 中的 Linked 状态
|
||||||
|
if (this.formData.bleStatu && f) {
|
||||||
|
f.Linked = true;
|
||||||
|
ble.updateCache();
|
||||||
|
console.log("发送模式指令前同步连接状态为已连接");
|
||||||
|
}
|
||||||
|
|
||||||
showLoading(these, {
|
showLoading(these, {
|
||||||
text: "请稍候..."
|
text: "请稍候..."
|
||||||
});
|
});
|
||||||
@ -993,54 +1086,54 @@
|
|||||||
this.Status.Pop.showPop = false;
|
this.Status.Pop.showPop = false;
|
||||||
},
|
},
|
||||||
showPop: function(option) {
|
showPop: function(option) {
|
||||||
|
|
||||||
hideLoading(this);
|
hideLoading(this);
|
||||||
let def = {
|
let defaultCfg = {
|
||||||
showPop: true, //是否显示弹窗
|
showHeader: false,
|
||||||
popType: 'custom',
|
headerTxt: "",
|
||||||
bgColor: '#383934bd',
|
showHeader: false,
|
||||||
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,
|
showCancel: false,
|
||||||
|
borderColor: '#BBE600',
|
||||||
|
buttonBgColor: '#BBE600',
|
||||||
|
okCallback: null,
|
||||||
|
cancelCallback: null,
|
||||||
|
popType: 'custom',
|
||||||
|
buttonText: '确定',
|
||||||
|
clickEvt: ''
|
||||||
|
};
|
||||||
|
if (!option) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
let keys = Object.keys(option);
|
||||||
let keys = Object.keys(def);
|
for (var i = 0; i < keys.length; i++) {
|
||||||
|
let key = keys[i];
|
||||||
for (let i = 0; i < keys.length; i++) {
|
this.Status.Pop[key] = option[key];
|
||||||
|
}
|
||||||
|
keys = Object.keys(defaultCfg);
|
||||||
|
for (var i = 0; i < keys.length; i++) {
|
||||||
let key = keys[i];
|
let key = keys[i];
|
||||||
if (key in option) {
|
if (key in option) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
this.Status.Pop[key] = def[key];
|
this.Status.Pop[key] = defaultCfg[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) {
|
this.Status.Pop.showPop = true;
|
||||||
option.borderColor = '#BBE600';
|
|
||||||
option.buttonBgColor = '#BBE600';
|
|
||||||
}
|
|
||||||
these.Status.Pop.showPop = true;
|
|
||||||
},
|
},
|
||||||
sendUsr() {
|
sendUsr() {
|
||||||
|
// 互斥:三屏发送期间禁止其它BLE写入插队
|
||||||
|
if (this.Status.Send && this.Status.Send.lock) {
|
||||||
|
this.showPop({
|
||||||
|
message: "正在发送,请稍候完成后再试",
|
||||||
|
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||||
|
borderColor: "#e034344d",
|
||||||
|
buttonBgColor: "#E03434",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.Status.Send) this.Status.Send.lock = true;
|
||||||
|
this.sendSeq++;
|
||||||
|
const currentSeq = this.sendSeq;
|
||||||
let f = this.getDevice();
|
let f = this.getDevice();
|
||||||
if (!f) {
|
if (!f) {
|
||||||
these.showBleUnConnect()
|
these.showBleUnConnect()
|
||||||
@ -1068,8 +1161,16 @@
|
|||||||
text: "请稍候..."
|
text: "请稍候..."
|
||||||
});
|
});
|
||||||
this.setBleFormData();
|
this.setBleFormData();
|
||||||
|
|
||||||
|
// 发送前确保连接状态同步:如果页面显示已连接,同步更新 BleHelper 中的 Linked 状态
|
||||||
|
if (this.formData.bleStatu && f) {
|
||||||
|
f.Linked = true;
|
||||||
|
ble.updateCache();
|
||||||
|
console.log("发送人员信息前同步连接状态为已连接");
|
||||||
|
}
|
||||||
|
|
||||||
let task = async () => {
|
let task = async () => {
|
||||||
var sendTxtPackge = (rgbdata, type, str) => {
|
var sendTxtPackge = (rgbdata, type, str, lineIndex) => {
|
||||||
|
|
||||||
var promise = new Promise((resolve, reject) => {
|
var promise = new Promise((resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
@ -1094,6 +1195,16 @@
|
|||||||
dataView.setUint8(bufferSize - 1, 0xFF);
|
dataView.setUint8(bufferSize - 1, 0xFF);
|
||||||
|
|
||||||
// 2. 将完整数据包切片成20字节的小块进行发送
|
// 2. 将完整数据包切片成20字节的小块进行发送
|
||||||
|
// 打印完整数据包,便于首次与再次发送对比
|
||||||
|
try {
|
||||||
|
const fullBytes = new Uint8Array(fullBuffer);
|
||||||
|
const hexString = Array.from(fullBytes).map(b => b.toString(16).padStart(2, '0')).join(' ');
|
||||||
|
console.log('[7305][SEQ ' + currentSeq + '][Line ' + lineIndex + '] 完整BLE数据包 len=261 type=' + type + ' text="' + (str || '') + '"');
|
||||||
|
console.log('[7305][SEQ ' + currentSeq + '][Line ' + lineIndex + '] HEX:\n' + hexString);
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('[7305][SEQ ' + currentSeq + '] 打印完整BLE数据包失败:', e);
|
||||||
|
}
|
||||||
|
|
||||||
const chunkSize = 20;
|
const chunkSize = 20;
|
||||||
const numChunks = Math.ceil(fullBuffer.byteLength / chunkSize);
|
const numChunks = Math.ceil(fullBuffer.byteLength / chunkSize);
|
||||||
let chunkIndex = 0;
|
let chunkIndex = 0;
|
||||||
@ -1108,25 +1219,41 @@
|
|||||||
const end = Math.min(start + chunkSize, fullBuffer.byteLength);
|
const end = Math.min(start + chunkSize, fullBuffer.byteLength);
|
||||||
const chunk = fullBuffer.slice(start, end);
|
const chunk = fullBuffer.slice(start, end);
|
||||||
|
|
||||||
const hexArray = Array.from(new Uint8Array(chunk)).map(b => b
|
const hexArray = Array.from(new Uint8Array(chunk)).map(b => b.toString(16).padStart(2, '0'));
|
||||||
.toString(16).padStart(2, '0'));
|
console.log(`[7305][SEQ ${currentSeq}][Line ${lineIndex}] 发送块 ${chunkIndex + 1}/${numChunks}: ${hexArray.join(' ')}`);
|
||||||
console.log(`发送数据块 ${chunkIndex + 1}/${numChunks}:`, hexArray
|
|
||||||
.join(' '));
|
|
||||||
|
|
||||||
ble.sendData(f.deviceId, chunk, f.writeServiceId, f
|
ble.sendData(f.deviceId, chunk, f.writeServiceId, f
|
||||||
.wirteCharactId, 100).then(() => {
|
.wirteCharactId, 100).then(() => {
|
||||||
chunkIndex++;
|
chunkIndex++;
|
||||||
setTimeout(sendNextChunk, 30); // 每个小包之间延时30ms
|
// 前3个小包放慢节奏,给设备解析时间
|
||||||
|
const gap = chunkIndex <= 3 ? 60 : 30;
|
||||||
|
setTimeout(sendNextChunk, gap);
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
if (err.code == '10007') {
|
if (err.code == '10007') {
|
||||||
setTimeout(sendNextChunk, 30);
|
setTimeout(sendNextChunk, 50);
|
||||||
} else {
|
return;
|
||||||
reject(err);
|
|
||||||
}
|
}
|
||||||
|
// 边界情况:设备报告无连接/服务未就绪,等待后重试一次当前块
|
||||||
|
if (err.code == 10004 || err.errCode == 10004 || err.code == 10006) {
|
||||||
|
console.warn('[BLE] 当前块发送失败(10004/10006),延时重试一次');
|
||||||
|
setTimeout(() => {
|
||||||
|
ble.sendData(f.deviceId, chunk, f.writeServiceId, f.wirteCharactId, 100)
|
||||||
|
.then(() => {
|
||||||
|
chunkIndex++;
|
||||||
|
const gap = chunkIndex <= 3 ? 60 : 30;
|
||||||
|
setTimeout(sendNextChunk, gap);
|
||||||
|
})
|
||||||
|
.catch(e2 => reject(e2));
|
||||||
|
}, 150);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
reject(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
sendNextChunk();
|
// 初次发送前增加更长延迟,避免第一次发送异常
|
||||||
|
setTimeout(sendNextChunk, 100);
|
||||||
|
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
console.log("ex=", ex);
|
console.log("ex=", ex);
|
||||||
@ -1139,15 +1266,36 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.log("11111");
|
console.log("11111");
|
||||||
|
// UI顺序: [单位(0), 部门(1), 姓名(2)]
|
||||||
|
// 设备三屏顺序: [单位, 部门, 姓名]
|
||||||
|
const uiBackupLines = [...this.formData.textLines];
|
||||||
|
// 与UI一致:单位→第一屏,部门→第二屏,姓名→第三屏
|
||||||
|
const deviceOrderLines = [uiBackupLines[0] || '', uiBackupLines[1] || '', uiBackupLines[2] || ''];
|
||||||
|
// 临时切换为设备顺序供画布组件生成(组件为离屏隐藏,不影响UI)
|
||||||
|
this.formData.textLines = deviceOrderLines;
|
||||||
var result = null;
|
var result = null;
|
||||||
try {
|
try {
|
||||||
console.log("this.$refs.textToHex=", this.$refs.textToHex);
|
console.log("this.$refs.textToHex=", this.$refs.textToHex);
|
||||||
|
// 等待一次tick,确保子组件收到prop变更
|
||||||
|
await new Promise(r => setTimeout(r, 50));
|
||||||
|
// 发送前强制清空画布
|
||||||
|
if (this.$refs.textToHex && this.$refs.textToHex.resetCanvas) {
|
||||||
|
await this.$refs.textToHex.resetCanvas();
|
||||||
|
}
|
||||||
result = await this.$refs.textToHex.drawAndGetPixels();
|
result = await this.$refs.textToHex.drawAndGetPixels();
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
console.log("ex=", ex);
|
console.log("ex=", ex);
|
||||||
|
} finally {
|
||||||
|
// 立即恢复UI顺序,避免影响输入框
|
||||||
|
this.formData.textLines = uiBackupLines;
|
||||||
|
// 发送后再次清空画布
|
||||||
|
if (this.$refs.textToHex && this.$refs.textToHex.resetCanvas) {
|
||||||
|
await this.$refs.textToHex.resetCanvas();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!result) {
|
if (!result) {
|
||||||
hideLoading(this);
|
hideLoading(this);
|
||||||
|
if (this.Status.Send) this.Status.Send.lock = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log("result=", result);
|
console.log("result=", result);
|
||||||
@ -1159,8 +1307,11 @@
|
|||||||
let pros = [];
|
let pros = [];
|
||||||
let flag = true;
|
let flag = true;
|
||||||
for (var i = 0; i < result.length; i++) {
|
for (var i = 0; i < result.length; i++) {
|
||||||
|
// 屏间稳定等待,避免上一屏残留影响下一屏
|
||||||
|
await new Promise(r => setTimeout(r, 200));
|
||||||
|
|
||||||
let str = this.formData.textLines[i];
|
// 发送的文本与点阵一一对应(设备顺序: 单位, 部门, 姓名)
|
||||||
|
let str = deviceOrderLines[i];
|
||||||
|
|
||||||
if (str.length > 0) {
|
if (str.length > 0) {
|
||||||
|
|
||||||
@ -1168,9 +1319,18 @@
|
|||||||
var rgb = result[i];
|
var rgb = result[i];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// console.log("1111");
|
// 首屏(单位)类型固定为 0x06,增加首屏稳定策略:预等待+双发送
|
||||||
await sendTxtPackge(rgb, h3dic[i], str);
|
console.log(`[7305] 准备发送 屏${i+1} type=0x${h3dic[i].toString(16)} text="${str}"`);
|
||||||
// console.log("222222");
|
if (i === 0) {
|
||||||
|
await new Promise(r => setTimeout(r, 200));
|
||||||
|
await sendTxtPackge(rgb, h3dic[i], str, i);
|
||||||
|
await new Promise(r => setTimeout(r, 150));
|
||||||
|
await sendTxtPackge(rgb, h3dic[i], str, i);
|
||||||
|
} else {
|
||||||
|
await sendTxtPackge(rgb, h3dic[i], str, i);
|
||||||
|
}
|
||||||
|
// 每屏之间插入更长延迟,避免解析竞争
|
||||||
|
await new Promise(r => setTimeout(r, 200));
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
flag = false;
|
flag = false;
|
||||||
console.log("发送数据包出现异常", ex);
|
console.log("发送数据包出现异常", ex);
|
||||||
@ -1210,6 +1370,7 @@
|
|||||||
buttonBgColor: "#E03434",
|
buttonBgColor: "#E03434",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (this.Status.Send) this.Status.Send.lock = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(task, 0);
|
setTimeout(task, 0);
|
||||||
@ -1249,6 +1410,11 @@
|
|||||||
}, 100);
|
}, 100);
|
||||||
},
|
},
|
||||||
sendBrightness: function() {
|
sendBrightness: function() {
|
||||||
|
// 发送互斥:人员信息发送期间禁止调亮度
|
||||||
|
if (this.Status.Send && this.Status.Send.lock) {
|
||||||
|
console.warn('正在发送三屏数据,亮度指令已忽略');
|
||||||
|
return;
|
||||||
|
}
|
||||||
const buffer = new ArrayBuffer(6);
|
const buffer = new ArrayBuffer(6);
|
||||||
const dataView = new DataView(buffer);
|
const dataView = new DataView(buffer);
|
||||||
let data = '0x' + parseInt(this.formData.liangDu).toString(16);
|
let data = '0x' + parseInt(this.formData.liangDu).toString(16);
|
||||||
@ -1262,6 +1428,13 @@
|
|||||||
|
|
||||||
let f = this.getDevice();
|
let f = this.getDevice();
|
||||||
if (f) {
|
if (f) {
|
||||||
|
// 发送前确保连接状态同步:如果页面显示已连接,同步更新 BleHelper 中的 Linked 状态
|
||||||
|
if (this.formData.bleStatu && f) {
|
||||||
|
f.Linked = true;
|
||||||
|
ble.updateCache();
|
||||||
|
console.log("发送亮度指令前同步连接状态为已连接");
|
||||||
|
}
|
||||||
|
|
||||||
// 发送数据
|
// 发送数据
|
||||||
|
|
||||||
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 100).catch(ex => {
|
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 100).catch(ex => {
|
||||||
@ -1311,6 +1484,13 @@
|
|||||||
dataView.setUint8(3, '9C41'); // 数据长度
|
dataView.setUint8(3, '9C41'); // 数据长度
|
||||||
let f = this.getDevice();
|
let f = this.getDevice();
|
||||||
if (f) {
|
if (f) {
|
||||||
|
// 发送前确保连接状态同步:如果页面显示已连接,同步更新 BleHelper 中的 Linked 状态
|
||||||
|
if (this.formData.bleStatu && f) {
|
||||||
|
f.Linked = true;
|
||||||
|
ble.updateCache();
|
||||||
|
console.log("发送命令前同步连接状态为已连接");
|
||||||
|
}
|
||||||
|
|
||||||
// 发送数据
|
// 发送数据
|
||||||
|
|
||||||
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 100).catch(ex => {
|
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 100).catch(ex => {
|
||||||
|
|||||||
BIN
static/images/6075/cq.png
Normal file
BIN
static/images/6075/cq.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1013 B |
BIN
static/images/6075/fg.png
Normal file
BIN
static/images/6075/fg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 874 B |
BIN
static/images/6075/gz.png
Normal file
BIN
static/images/6075/gz.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 586 B |
BIN
static/images/6075/jn.png
Normal file
BIN
static/images/6075/jn.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 616 B |
BIN
static/images/6075/jsg.png
Normal file
BIN
static/images/6075/jsg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 997 B |
BIN
static/images/6075/sos.png
Normal file
BIN
static/images/6075/sos.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 745 B |
@ -752,30 +752,35 @@ class BleHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let receivJson = JSON.parse(str);
|
let trimmedStr = str.trim();
|
||||||
let key = "sta_address"; //HBY100以此方式上传mac地址
|
if (trimmedStr && (trimmedStr.startsWith('{') || trimmedStr.startsWith('['))) {
|
||||||
if (key in receivJson) {
|
let receivJson = JSON.parse(str);
|
||||||
this.data.LinkedList.find((v) => {
|
let key = "sta_address"; //HBY100以此方式上传mac地址
|
||||||
if (v.deviceId == receive
|
if (key in receivJson) {
|
||||||
.deviceId) {
|
this.data.LinkedList.find((v) => {
|
||||||
let macStr = receivJson[
|
if (v.deviceId == receive
|
||||||
key];
|
.deviceId) {
|
||||||
if (macStr.includes(':')) {
|
let macStr = receivJson[
|
||||||
v.macAddress = macStr;
|
key];
|
||||||
} else {
|
if (macStr.includes(':')) {
|
||||||
v.macAddress = macStr
|
v.macAddress = macStr;
|
||||||
.replace(/(.{2})/g,
|
} else {
|
||||||
'$1:').slice(0,
|
v.macAddress = macStr
|
||||||
-1)
|
.replace(/(.{2})/g,
|
||||||
|
'$1:').slice(0,
|
||||||
|
-1)
|
||||||
|
}
|
||||||
|
|
||||||
|
isUpdate = true;
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
isUpdate = true;
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (convertException) {
|
} catch (convertException) {
|
||||||
console.error("文本无法转json", convertException)
|
if (str && (str.trim().startsWith('{') || str.trim().startsWith('['))) {
|
||||||
|
console.error("JSON解析失败(可能是格式错误的数据)", convertException);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isUpdate) {
|
if (isUpdate) {
|
||||||
@ -1029,7 +1034,7 @@ class BleHelper {
|
|||||||
|
|
||||||
//订阅消息
|
//订阅消息
|
||||||
subScribe(deviceId, state) {
|
subScribe(deviceId, state) {
|
||||||
// console.log("开始订阅消息", state);
|
console.log("开始订阅消息", deviceId, state);
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|
||||||
@ -1150,13 +1155,12 @@ class BleHelper {
|
|||||||
|
|
||||||
results.forEach((result, index) => {
|
results.forEach((result, index) => {
|
||||||
if (result.status === "fulfilled") {
|
if (result.status === "fulfilled") {
|
||||||
// console.log(`操作${index + 1}成功:`, result.value);
|
console.log(`订阅消息操作${index + 1}成功:`, result.value);
|
||||||
} else {
|
} else {
|
||||||
// console.log(`操作${index + 1}失败:`, result.reason
|
console.error(`订阅消息操作${index + 1}失败:`, result.reason);
|
||||||
// .message);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// console.log("订阅消息成功");
|
console.log("订阅消息完成,deviceId:", deviceId);
|
||||||
resolve();
|
resolve();
|
||||||
}).catch((ex) => {
|
}).catch((ex) => {
|
||||||
console.error("异常,ex=", ex);
|
console.error("异常,ex=", ex);
|
||||||
@ -1547,9 +1551,19 @@ class BleHelper {
|
|||||||
}
|
}
|
||||||
} else { //已连接过,直接订阅消息
|
} else { //已连接过,直接订阅消息
|
||||||
// console.log("11111111");
|
// console.log("11111111");
|
||||||
if (fIndex > -1 && f && !f.notifyState) {
|
if (fIndex > -1 && f) {
|
||||||
|
if (!f.notifyState) {
|
||||||
this.subScribe(deviceId, true);
|
console.log("设备已连接但未订阅,开始订阅消息");
|
||||||
|
return this.subScribe(deviceId, true).then(() => {
|
||||||
|
console.log("订阅消息完成");
|
||||||
|
return Promise.resolve(true);
|
||||||
|
}).catch(err => {
|
||||||
|
console.error("订阅消息失败:", err);
|
||||||
|
return Promise.resolve(true);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.log("设备已连接且已订阅消息");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return Promise.resolve(true); //已连接过的设备无需获取服务
|
return Promise.resolve(true); //已连接过的设备无需获取服务
|
||||||
}
|
}
|
||||||
@ -1698,8 +1712,32 @@ class BleHelper {
|
|||||||
if (this.data.platform == 'web') {
|
if (this.data.platform == 'web') {
|
||||||
return Promise.resolve("h5平台默认成功");
|
return Promise.resolve("h5平台默认成功");
|
||||||
}
|
}
|
||||||
// console.log("deviceid=" + deviceid + ",writeServiceId=" + writeServiceId + ",wirteCharactId=" +
|
|
||||||
// wirteCharactId + ",timeout=" + ms)
|
// 打印发送的蓝牙指令
|
||||||
|
let bufferHex = '';
|
||||||
|
if (buffer) {
|
||||||
|
let bytes = [];
|
||||||
|
// 处理不同类型的buffer(ArrayBuffer、Uint8Array等)
|
||||||
|
if (buffer instanceof ArrayBuffer) {
|
||||||
|
let dataView = new DataView(buffer);
|
||||||
|
for (let i = 0; i < buffer.byteLength; i++) {
|
||||||
|
bytes.push(dataView.getUint8(i));
|
||||||
|
}
|
||||||
|
} else if (buffer.byteLength !== undefined) {
|
||||||
|
// 如果是 Uint8Array 或其他类型
|
||||||
|
for (let i = 0; i < buffer.byteLength; i++) {
|
||||||
|
bytes.push(buffer[i] || 0);
|
||||||
|
}
|
||||||
|
} else if (Array.isArray(buffer)) {
|
||||||
|
bytes = buffer;
|
||||||
|
}
|
||||||
|
if (bytes.length > 0) {
|
||||||
|
bufferHex = bytes.map(b => '0x' + b.toString(16).padStart(2, '0').toUpperCase()).join(' ');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log("准备发送蓝牙指令 - deviceId:", deviceid, "writeServiceId:", writeServiceId, "writeCharactId:", wirteCharactId);
|
||||||
|
console.log("发送数据(Hex):", bufferHex || "(空数据)");
|
||||||
|
console.log("发送数据(原始buffer长度):", buffer ? (buffer.byteLength || buffer.length || 0) : 0);
|
||||||
if (ms === undefined) {
|
if (ms === undefined) {
|
||||||
ms = 50;
|
ms = 50;
|
||||||
}
|
}
|
||||||
@ -1743,13 +1781,14 @@ class BleHelper {
|
|||||||
serviceId: device.writeServiceId,
|
serviceId: device.writeServiceId,
|
||||||
characteristicId: device.wirteCharactId,
|
characteristicId: device.wirteCharactId,
|
||||||
value: buffer,
|
value: buffer,
|
||||||
|
writeType: 'write',
|
||||||
success: () => {
|
success: () => {
|
||||||
// console.log("发送数据成功");
|
console.log("✓ 蓝牙指令发送成功 - deviceId:", device.deviceId);
|
||||||
succ();
|
succ();
|
||||||
},
|
},
|
||||||
fail: (ex) => {
|
fail: (ex) => {
|
||||||
ex = this.getError(ex);
|
ex = this.getError(ex);
|
||||||
console.error("发送数据失败", ex);
|
console.error("✗ 蓝牙指令发送失败 - deviceId:", device.deviceId, "错误:", ex);
|
||||||
|
|
||||||
err(ex);
|
err(ex);
|
||||||
}
|
}
|
||||||
@ -1787,10 +1826,10 @@ class BleHelper {
|
|||||||
|
|
||||||
}
|
}
|
||||||
if (c.Linked) {
|
if (c.Linked) {
|
||||||
// console.log("蓝牙已连接,直接发送");
|
console.log("蓝牙已连接,直接发送数据");
|
||||||
return sendBuffer();
|
return sendBuffer();
|
||||||
} else {
|
} else {
|
||||||
// console.log("先连接蓝牙再发送");
|
console.log("蓝牙未连接,先连接蓝牙再发送数据");
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let f = this.data.LinkedList.find((v) => {
|
let f = this.data.LinkedList.find((v) => {
|
||||||
return v.deviceId == deviceid;
|
return v.deviceId == deviceid;
|
||||||
|
|||||||
@ -44,24 +44,27 @@ class BleReceive {
|
|||||||
if (f && f.macAddress && f.device && f.device.id) {
|
if (f && f.macAddress && f.device && f.device.id) {
|
||||||
let handler = null;
|
let handler = null;
|
||||||
let keys = Object.keys(this.HandlerMap);
|
let keys = Object.keys(this.HandlerMap);
|
||||||
|
let devKey = f.device.detailPageUrl ? f.device.detailPageUrl.replace(/\//g, '').toLowerCase() : '';
|
||||||
|
console.log("查找handler - detailPageUrl:", f.device.detailPageUrl, "转换后:", devKey);
|
||||||
for (let index = 0; index < keys.length; index++) {
|
for (let index = 0; index < keys.length; index++) {
|
||||||
let key = keys[index].replaceAll('/', '').toLowerCase();
|
let key = keys[index].replace(/\//g, '').toLowerCase();
|
||||||
let devKey = f.device.detailPageUrl ? f.device.detailPageUrl.replaceAll('/', '').toLowerCase() : '';
|
|
||||||
if (key == devKey) {
|
if (key == devKey) {
|
||||||
handler = this.HandlerMap[keys[index]];
|
handler = this.HandlerMap[keys[index]];
|
||||||
|
console.log("找到匹配的handler:", keys[index]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handler) {
|
if (handler) {
|
||||||
let data = handler(receive, f, path, recArr);
|
let data = handler(receive, f, path, recArr);
|
||||||
|
console.log("handler返回的数据:", data);
|
||||||
return data;
|
return data;
|
||||||
} else {
|
} else {
|
||||||
console.log("已收到消息,但无指定处理程序", receive);
|
console.log("已收到消息,但无指定处理程序, deviceUrl:", f.device.detailPageUrl, "可用handlers:", keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
console.log("已收到该消息,但无法处理", receive);
|
console.log("已收到该消息,但无法处理", receive, "f:", f);
|
||||||
}
|
}
|
||||||
|
|
||||||
return receive;
|
return receive;
|
||||||
@ -467,11 +470,12 @@ class BleReceive {
|
|||||||
formData.statu = warn;
|
formData.statu = warn;
|
||||||
formData.xuhang = lightingTime;
|
formData.xuhang = lightingTime;
|
||||||
|
|
||||||
|
console.log("7305解析结果 - 电量:", batteryLevel, "续航:", lightingTime, "完整数据:", formData);
|
||||||
|
|
||||||
let recCnt = recArr.find(v => {
|
let recCnt = recArr.find(v => {
|
||||||
|
|
||||||
return v.key.replaceAll('/', '').toLowerCase() === f.device.detailPageUrl.replaceAll(
|
return v.key.replace(/\//g, '').toLowerCase() === f.device.detailPageUrl.replace(
|
||||||
'/', '').toLowerCase();
|
/\//g, '').toLowerCase();
|
||||||
});
|
});
|
||||||
if (!recCnt) {
|
if (!recCnt) {
|
||||||
if (batteryLevel <= 20) {
|
if (batteryLevel <= 20) {
|
||||||
@ -487,9 +491,11 @@ class BleReceive {
|
|||||||
this.setBleFormData(formData, f);
|
this.setBleFormData(formData, f);
|
||||||
return formData;
|
return formData;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('数据解析错误:', error);
|
console.log('7305数据解析错误:', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Receive_4877(receive,f,path,recArr){
|
Receive_4877(receive,f,path,recArr){
|
||||||
|
|||||||
Reference in New Issue
Block a user