From 317c762edc62551c2045415b0f4e598b0772a622 Mon Sep 17 00:00:00 2001
From: fengerli <528575642@qq.com>
Date: Fri, 31 Oct 2025 11:13:07 +0800
Subject: [PATCH 01/11] =?UTF-8?q?7305=E6=96=87=E4=BB=B6=E6=8A=A5=E9=94=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/7305/BJQ7305.vue | 3152 ++++++++++++++++++++--------------------
1 file changed, 1575 insertions(+), 1577 deletions(-)
diff --git a/pages/7305/BJQ7305.vue b/pages/7305/BJQ7305.vue
index cb0a35e..bcd738a 100644
--- a/pages/7305/BJQ7305.vue
+++ b/pages/7305/BJQ7305.vue
@@ -8,14 +8,14 @@
- {{formData.battary}}%
+ {{ formData.battary }}%
电量
- {{formData.xuhang}}
+ {{ formData.xuhang }}
续航时间
@@ -24,25 +24,25 @@
蓝牙名称
- {{formData.blename}}
+ {{ formData.blename }}
设备名称
- {{formData.deviceName}}
+ {{ formData.deviceName }}
充电状态
- {{formData.statu}}
+ {{ formData.statu }}
蓝牙状态
- {{formData.bleStatu?'已连接':'未连接'}}
+ {{ formData.bleStatu ? '已连接' : '未连接' }}
灯光亮度
- {{formData.liangDu}}%
+ {{ formData.liangDu }}%
@@ -59,7 +59,7 @@
主灯模式
- {{getMode}}
+ {{ getMode }}
-
+
+ 单位:
+
+
+
+ 部门:
+
+
+
+ 姓名:
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+ 产品信息
+
+
+
+ 产品参数
+
+
+
+ 操作说明
+
+
+
+ 操作视频
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
From 3526f28d067bbcfb1f91bd2f86faa478f5f23794 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=AE=E5=BE=AE=E4=B8=80=E7=AC=91?= <709648985@qq.com>
Date: Fri, 31 Oct 2025 15:35:03 +0800
Subject: [PATCH 02/11] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=93=9D=E7=89=99?=
=?UTF-8?q?=E4=BC=A0=E8=BE=93=E6=95=B0=E6=8D=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../TextToHex/textToDotMatrixFor7305.vue | 45 +++++++++----------
1 file changed, 21 insertions(+), 24 deletions(-)
diff --git a/components/TextToHex/textToDotMatrixFor7305.vue b/components/TextToHex/textToDotMatrixFor7305.vue
index 7160bf5..6fc362b 100644
--- a/components/TextToHex/textToDotMatrixFor7305.vue
+++ b/components/TextToHex/textToDotMatrixFor7305.vue
@@ -1,6 +1,6 @@
-
@@ -149,28 +149,26 @@
// 5. 异步绘制并获取像素数据(串行处理避免冲突)
await new Promise((resolve, reject) => {
ctx.draw(false, () => {
- setTimeout(() => {
- uni.canvasGetImageData({
- canvasId: 'reusableCanvas',
- x: 0,
- y: 0,
- width: this.currentCanvasWidth,
- height: this.currentCanvasHeight,
- success: res => {
- result = {
- line: textLine,
- pixelData: res.data,
- width: this.currentCanvasWidth,
- height: this.currentCanvasHeight
- };
- resolve();
- },
- fail: err => {
- // console.error(`处理第${i+1}行失败:`, err);
- reject(err)
- }
- });
- }, 100);
+ uni.canvasGetImageData({
+ canvasId: 'reusableCanvas',
+ x: 0,
+ y: 0,
+ width: this.currentCanvasWidth,
+ height: this.currentCanvasHeight,
+ success: res => {
+ result = {
+ line: textLine,
+ pixelData: res.data,
+ width: this.currentCanvasWidth,
+ height: this.currentCanvasHeight
+ };
+ resolve();
+ },
+ fail: err => {
+ // console.error(`处理第${i+1}行失败:`, err);
+ reject(err)
+ }
+ });
});
});
@@ -202,6 +200,5 @@
position: fixed;
left: -9999px;
top: -9999px;
- visibility: hidden;
}
\ No newline at end of file
From 500b461bdd86a7c352e11af1e4827f9f1bb33ebb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=AE=E5=BE=AE=E4=B8=80=E7=AC=91?= <709648985@qq.com>
Date: Sat, 1 Nov 2025 17:21:45 +0800
Subject: [PATCH 03/11] =?UTF-8?q?=E4=BF=AE=E5=A4=8D7305=E8=AE=BE=E5=A4=87?=
=?UTF-8?q?=E4=B8=8A=E6=8A=A5=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/7305/BJQ7305.vue | 94 ++++++++++++++++++++++++++++--------
utils/BleHelper.js | 107 ++++++++++++++++++++++++++++-------------
utils/BleReceive.js | 22 ++++++---
3 files changed, 162 insertions(+), 61 deletions(-)
diff --git a/pages/7305/BJQ7305.vue b/pages/7305/BJQ7305.vue
index dc872dd..45287c8 100644
--- a/pages/7305/BJQ7305.vue
+++ b/pages/7305/BJQ7305.vue
@@ -301,6 +301,17 @@
these.showBleUnConnect();
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;
if (form) {
let keys = Object.keys(form);
@@ -314,9 +325,23 @@
these.formData.img = device.devicePic;
these.formData.id = device.id;
these.formData.deviceId = f.deviceId;
+ // 更新缓存中的设备信息
+ ble.updateCache();
+
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
- console.log("连接成功")
+ console.log("连接成功");
these.formData.bleStatu = true;
+
+ // 确保订阅消息已开启
+ 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.getDetail();
@@ -386,6 +411,18 @@
}
if (res.deviceId == these.formData.deviceId) {
this.formData.bleStatu = true;
+
+ // 连接恢复后,确保重新订阅消息以接收设备上报的数据
+ let f = this.getDevice();
+ if (f && (f.notifyServiceid || f.notifyCharactId)) {
+ console.log("连接恢复,重新订阅消息");
+ ble.subScribe(res.deviceId, true).then(() => {
+ console.log("订阅消息成功,等待设备上报数据");
+ }).catch(err => {
+ console.error("订阅消息失败:", err);
+ });
+ }
+
setTimeout(() => {
hideLoading(these, 1000);
});
@@ -475,30 +512,49 @@
}
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;
}
+
+ console.log("收到7305解析数据:", json);
+ console.log("formData更新前 - battary:", these.formData.battary, "xuhang:", these.formData.xuhang, "statu:", these.formData.statu);
+
+ // 确保电量和续航时间正确更新(使用 $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 (json.xuhang !== undefined && json.xuhang !== null) {
+ this.$set(these.formData, 'xuhang', json.xuhang);
+ console.log("更新续航时间:", json.xuhang, "->", these.formData.xuhang);
+ }
+
+ // 更新充电状态
+ if (json.statu !== undefined && json.statu !== null) {
+ this.$set(these.formData, 'statu', json.statu);
+ console.log("更新充电状态:", json.statu, "->", these.formData.statu);
+ }
+
+ // 更新其他字段
let keys = Object.keys(json);
keys.forEach((key) => {
- if (key in these.formData) {
- these.formData[key] = json[key];
+ if (key in these.formData && key !== 'battary' && key !== 'xuhang' && key !== 'statu') {
+ this.$set(these.formData, key, json[key]);
}
});
- if ('statu' in json) {
- these.formData.statu = json.statu == '1' ? '充电中' : '未充电';
- }
- if ('xuhang' in json) {
- these.formData.xuhang = json.xuhang;
- }
-
- if ('battary' in json && this.formData.battary <= 20) {
- this.showPop({
- message: "设备电量低",
- iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
- borderColor: "#e034344d",
- buttonBgColor: "#E03434",
- });
- }
+
+ console.log("formData更新后 - battary:", these.formData.battary, "xuhang:", these.formData.xuhang, "statu:", these.formData.statu);
},
diff --git a/utils/BleHelper.js b/utils/BleHelper.js
index 7a861bd..bba40b3 100644
--- a/utils/BleHelper.js
+++ b/utils/BleHelper.js
@@ -752,30 +752,35 @@ class BleHelper {
}
try {
- let receivJson = JSON.parse(str);
- let key = "sta_address"; //HBY100以此方式上传mac地址
- if (key in receivJson) {
- this.data.LinkedList.find((v) => {
- if (v.deviceId == receive
- .deviceId) {
- let macStr = receivJson[
- key];
- if (macStr.includes(':')) {
- v.macAddress = macStr;
- } else {
- v.macAddress = macStr
- .replace(/(.{2})/g,
- '$1:').slice(0,
- -1)
+ let trimmedStr = str.trim();
+ if (trimmedStr && (trimmedStr.startsWith('{') || trimmedStr.startsWith('['))) {
+ let receivJson = JSON.parse(str);
+ let key = "sta_address"; //HBY100以此方式上传mac地址
+ if (key in receivJson) {
+ this.data.LinkedList.find((v) => {
+ if (v.deviceId == receive
+ .deviceId) {
+ let macStr = receivJson[
+ key];
+ if (macStr.includes(':')) {
+ v.macAddress = macStr;
+ } else {
+ v.macAddress = macStr
+ .replace(/(.{2})/g,
+ '$1:').slice(0,
+ -1)
+ }
+
+ isUpdate = true;
}
+ });
- isUpdate = true;
- }
- });
-
+ }
}
} catch (convertException) {
- console.error("文本无法转json", convertException)
+ if (str && (str.trim().startsWith('{') || str.trim().startsWith('['))) {
+ console.error("JSON解析失败(可能是格式错误的数据)", convertException);
+ }
}
if (isUpdate) {
@@ -1029,7 +1034,7 @@ class BleHelper {
//订阅消息
subScribe(deviceId, state) {
- // console.log("开始订阅消息", state);
+ console.log("开始订阅消息", deviceId, state);
return new Promise((resolve, reject) => {
setTimeout(() => {
@@ -1150,13 +1155,12 @@ class BleHelper {
results.forEach((result, index) => {
if (result.status === "fulfilled") {
- // console.log(`操作${index + 1}成功:`, result.value);
+ console.log(`订阅消息操作${index + 1}成功:`, result.value);
} else {
- // console.log(`操作${index + 1}失败:`, result.reason
- // .message);
+ console.error(`订阅消息操作${index + 1}失败:`, result.reason);
}
});
- // console.log("订阅消息成功");
+ console.log("订阅消息完成,deviceId:", deviceId);
resolve();
}).catch((ex) => {
console.error("异常,ex=", ex);
@@ -1547,9 +1551,19 @@ class BleHelper {
}
} else { //已连接过,直接订阅消息
// console.log("11111111");
- if (fIndex > -1 && f && !f.notifyState) {
-
- this.subScribe(deviceId, true);
+ if (fIndex > -1 && f) {
+ if (!f.notifyState) {
+ 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); //已连接过的设备无需获取服务
}
@@ -1698,8 +1712,32 @@ class BleHelper {
if (this.data.platform == 'web') {
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) {
ms = 50;
}
@@ -1743,13 +1781,14 @@ class BleHelper {
serviceId: device.writeServiceId,
characteristicId: device.wirteCharactId,
value: buffer,
+ writeType: 'write',
success: () => {
- // console.log("发送数据成功");
+ console.log("✓ 蓝牙指令发送成功 - deviceId:", device.deviceId);
succ();
},
fail: (ex) => {
ex = this.getError(ex);
- console.error("发送数据失败", ex);
+ console.error("✗ 蓝牙指令发送失败 - deviceId:", device.deviceId, "错误:", ex);
err(ex);
}
@@ -1787,10 +1826,10 @@ class BleHelper {
}
if (c.Linked) {
- // console.log("蓝牙已连接,直接发送");
+ console.log("蓝牙已连接,直接发送数据");
return sendBuffer();
} else {
- // console.log("先连接蓝牙再发送");
+ console.log("蓝牙未连接,先连接蓝牙再发送数据");
return new Promise((resolve, reject) => {
let f = this.data.LinkedList.find((v) => {
return v.deviceId == deviceid;
diff --git a/utils/BleReceive.js b/utils/BleReceive.js
index 3897d3f..5394ef8 100644
--- a/utils/BleReceive.js
+++ b/utils/BleReceive.js
@@ -44,24 +44,27 @@ class BleReceive {
if (f && f.macAddress && f.device && f.device.id) {
let handler = null;
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++) {
- let key = keys[index].replaceAll('/', '').toLowerCase();
- let devKey = f.device.detailPageUrl ? f.device.detailPageUrl.replaceAll('/', '').toLowerCase() : '';
+ let key = keys[index].replace(/\//g, '').toLowerCase();
if (key == devKey) {
handler = this.HandlerMap[keys[index]];
+ console.log("找到匹配的handler:", keys[index]);
break;
}
}
if (handler) {
let data = handler(receive, f, path, recArr);
+ console.log("handler返回的数据:", data);
return data;
} else {
- console.log("已收到消息,但无指定处理程序", receive);
+ console.log("已收到消息,但无指定处理程序, deviceUrl:", f.device.detailPageUrl, "可用handlers:", keys);
}
} else {
- console.log("已收到该消息,但无法处理", receive);
+ console.log("已收到该消息,但无法处理", receive, "f:", f);
}
return receive;
@@ -466,12 +469,13 @@ class BleReceive {
formData.battary = batteryLevel;
formData.statu = warn;
formData.xuhang = lightingTime;
-
+
+ console.log("7305解析结果 - 电量:", batteryLevel, "续航:", lightingTime, "完整数据:", formData);
let recCnt = recArr.find(v => {
- return v.key.replaceAll('/', '').toLowerCase() === f.device.detailPageUrl.replaceAll(
- '/', '').toLowerCase();
+ return v.key.replace(/\//g, '').toLowerCase() === f.device.detailPageUrl.replace(
+ /\//g, '').toLowerCase();
});
if (!recCnt) {
if (batteryLevel <= 20) {
@@ -487,9 +491,11 @@ class BleReceive {
this.setBleFormData(formData, f);
return formData;
} catch (error) {
- console.log('数据解析错误:', error);
+ console.log('7305数据解析错误:', error);
+ return null;
}
}
+ return null;
}
Receive_4877(receive,f,path,recArr){
From 2218ca06501de44ad9ffdb7fbbb09d0733a5ba9e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=AE=E5=BE=AE=E4=B8=80=E7=AC=91?= <709648985@qq.com>
Date: Sat, 1 Nov 2025 17:32:03 +0800
Subject: [PATCH 04/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=BE=93=E5=85=A5?=
=?UTF-8?q?=E6=A1=86=E6=96=87=E6=9C=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/7305/BJQ7305.vue | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pages/7305/BJQ7305.vue b/pages/7305/BJQ7305.vue
index 45287c8..087bd56 100644
--- a/pages/7305/BJQ7305.vue
+++ b/pages/7305/BJQ7305.vue
@@ -93,17 +93,17 @@
单位:
-
部门:
-
姓名:
-
From d06cd6cdfdf94321f5257891a85516b066ff8014 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=AE=E5=BE=AE=E4=B8=80=E7=AC=91?= <709648985@qq.com>
Date: Tue, 4 Nov 2025 19:30:47 +0800
Subject: [PATCH 05/11] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A4=8D=E6=9D=82?=
=?UTF-8?q?=E5=AD=97=E4=BD=93=E6=B8=B2=E6=9F=93=E8=AE=BE=E5=A4=87=E7=AB=AF?=
=?UTF-8?q?=E4=B9=B1=E5=BA=8F=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../TextToHex/textToDotMatrixFor7305.vue | 107 ++++++++++++------
pages/7305/BJQ7305.vue | 36 ++++--
2 files changed, 100 insertions(+), 43 deletions(-)
diff --git a/components/TextToHex/textToDotMatrixFor7305.vue b/components/TextToHex/textToDotMatrixFor7305.vue
index 6fc362b..86e2e95 100644
--- a/components/TextToHex/textToDotMatrixFor7305.vue
+++ b/components/TextToHex/textToDotMatrixFor7305.vue
@@ -59,6 +59,8 @@
* 清除Canvas内容
*/
clearCanvas() {
+ // 先清除,再用背景色填充,确保无残留
+ this.ctx.clearRect(0, 0, this.currentCanvasWidth, this.currentCanvasHeight);
this.ctx.setFillStyle(this.bgColor);
this.ctx.fillRect(0, 0, this.currentCanvasWidth, this.currentCanvasHeight);
},
@@ -67,6 +69,9 @@
* 复用单个Canvas处理所有文本行
*/
async drawAndGetPixels() {
+ // 超采样比例(提高分辨率再降采样,减少模糊)
+ const SCALE = 3;
+ const PADDING_X = 1 * SCALE; // 左侧预留像素,避免首字裁剪
let binaryToHex = (binaryArray) => {
if (!Array.isArray(binaryArray) || binaryArray.length !== 8) {
throw new Error("输入必须是包含8个元素的二进制数组");
@@ -90,25 +95,61 @@
return hexString;
}
- let convertCharToMatrix = (imageData, item) => {
+ let convertCharToMatrix = (drawResult, item) => {
const charWidth = 13;
const charHeight = 12;
- const pixels = [];
- for (let i = 0; i < imageData.length; i += 4) {
- const R = imageData[i];
- pixels.push(R < 128 ? 1 : 0);
+ const { pixelData, width, height } = drawResult;
+ // 将高分辨率像素降采样为13x12的布尔矩阵
+ const target = new Array(charWidth * charHeight).fill(0);
+ const threshold = 0.5; // 每个小块中超过50%深色判为1
+
+ // 确保采样区域严格对齐,从PADDING_X开始,但只采样13列
+ for (let y = 0; y < charHeight; y++) {
+ for (let x = 0; x < charWidth; x++) {
+ 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;
+ if (px < 0 || py < 0 || px >= width || py >= height) {
+ // 边界外视为背景(白色)
+ 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;
+ // 使用更严格的阈值,考虑alpha通道
+ const luminance = 0.299 * R + 0.587 * G + 0.114 * B;
+ const alpha = A / 255;
+ // 只有深色且不透明才计入
+ if (luminance < 128 && alpha > 0.5) onCount++;
+ total++;
+ }
+ }
+ // 当深色占比超过阈值时判为1(至少需要采样到一些像素)
+ target[y * charWidth + x] = (total > 0 && onCount / total >= threshold) ? 1 : 0;
+ }
}
const lowBytes = new Array(charWidth).fill(0);
const highBytes = new Array(charWidth).fill(0);
-
+ // 按列打包,每列12行分成上下两字节
for (let col = 0; col < charWidth; col++) {
for (let row = 0; row < charHeight; row++) {
- const pixel = pixels[row * charWidth + col];
+ const pixel = target[row * charWidth + col];
if (pixel === 1) {
if (row < 8) {
+ // 低字节:0-7行,从低位到高位
lowBytes[col] |= (1 << row);
} else {
+ // 高字节:8-11行,从低位到高位
highBytes[col] |= (1 << (row - 8));
}
}
@@ -121,30 +162,26 @@
let result = {};
let ctx = this.ctx;
- // 1. 动态调整Canvas尺寸
- this.currentCanvasWidth = 13;
- this.currentCanvasHeight = 12;
+ // 1. 动态调整Canvas尺寸(高分辨率)
+ this.currentCanvasWidth = 13 * SCALE + PADDING_X;
+ this.currentCanvasHeight = 12 * SCALE;
// 2. 清空Canvas(绘制背景)
this.clearCanvas();
- // 3. 设置文字样式
+ // 3. 设置文字样式(整数像素对齐,顶部基线,避免首字裁剪)
ctx.setFillStyle(this.color);
- ctx.setTextBaseline('middle');
- // ctx.setTextAlign('center')
- ctx.setFontSize(this.fontSize);
- ctx.font = `${this.fontSize}px "PingFangBold", "PingFang SC", Arial, sans-serif`;
+ ctx.setTextBaseline('top');
+ ctx.setTextAlign('left');
+ const fs = Math.max(1, Math.round(this.fontSize)) * SCALE;
+ ctx.setFontSize(fs);
+ ctx.font = `${fs}px "PingFangBold", "PingFang SC", Arial, sans-serif`;
- // 4. 绘制当前行文本
- let currentX = 0;
- let currentY = this.fontSize / 2 + 1;
- for (let j = 0; j < textLine.length; j++) {
- let char = textLine[j];
- ctx.fillText(char, currentX, currentY);
- // 按实际字符宽度计算间距
- let charWidth = ctx.measureText(char).width;
- currentX += charWidth;
- }
+ // 4. 绘制单个字符(每个字符独立绘制在固定位置)
+ // 确保字符始终从PADDING_X开始绘制,Y坐标为0,保证采样一致性
+ const charX = PADDING_X;
+ const charY = 0;
+ ctx.fillText(textLine, charX, charY);
// 5. 异步绘制并获取像素数据(串行处理避免冲突)
await new Promise((resolve, reject) => {
@@ -156,12 +193,12 @@
width: this.currentCanvasWidth,
height: this.currentCanvasHeight,
success: res => {
- result = {
- line: textLine,
- pixelData: res.data,
- width: this.currentCanvasWidth,
- height: this.currentCanvasHeight
- };
+ result = {
+ line: textLine,
+ pixelData: res.data,
+ width: this.currentCanvasWidth,
+ height: this.currentCanvasHeight
+ };
resolve();
},
fail: err => {
@@ -182,8 +219,12 @@
let item = this.validTxts[i];
// console.log("item=", item);
for (var j = 0; j < item.length; j++) {
- let result = await drawTxt(item[j]);
- linePixls.push(convertCharToMatrix(result.pixelData, item));
+ let char = item[j];
+ 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);
}
// console.log("hexs=", linePixls.join(","));
arr.push(linePixls);
diff --git a/pages/7305/BJQ7305.vue b/pages/7305/BJQ7305.vue
index 087bd56..2148a84 100644
--- a/pages/7305/BJQ7305.vue
+++ b/pages/7305/BJQ7305.vue
@@ -262,7 +262,8 @@
alarmStatus: null,
detailPageUrl: "/pages/6155/deviceDetail",
showConfirm: false
- }
+ },
+ sendSeq: 0
}
},
@@ -1083,6 +1084,8 @@
this.Status.Pop.showPop = true;
},
sendUsr() {
+ this.sendSeq++;
+ const currentSeq = this.sendSeq;
let f = this.getDevice();
if (!f) {
these.showBleUnConnect()
@@ -1111,7 +1114,7 @@
});
this.setBleFormData();
let task = async () => {
- var sendTxtPackge = (rgbdata, type, str) => {
+ var sendTxtPackge = (rgbdata, type, str, lineIndex) => {
var promise = new Promise((resolve, reject) => {
try {
@@ -1136,6 +1139,16 @@
dataView.setUint8(bufferSize - 1, 0xFF);
// 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 numChunks = Math.ceil(fullBuffer.byteLength / chunkSize);
let chunkIndex = 0;
@@ -1150,25 +1163,26 @@
const end = Math.min(start + chunkSize, fullBuffer.byteLength);
const chunk = fullBuffer.slice(start, end);
- const hexArray = Array.from(new Uint8Array(chunk)).map(b => b
- .toString(16).padStart(2, '0'));
- console.log(`发送数据块 ${chunkIndex + 1}/${numChunks}:`, hexArray
- .join(' '));
+ const hexArray = Array.from(new Uint8Array(chunk)).map(b => b.toString(16).padStart(2, '0'));
+ console.log(`[7305][SEQ ${currentSeq}][Line ${lineIndex}] 发送块 ${chunkIndex + 1}/${numChunks}: ${hexArray.join(' ')}`);
ble.sendData(f.deviceId, chunk, f.writeServiceId, f
.wirteCharactId, 100).then(() => {
chunkIndex++;
- setTimeout(sendNextChunk, 30); // 每个小包之间延时30ms
+ // 前3个小包放慢节奏,给设备解析时间
+ const gap = chunkIndex <= 3 ? 60 : 30;
+ setTimeout(sendNextChunk, gap);
}).catch(err => {
if (err.code == '10007') {
- setTimeout(sendNextChunk, 30);
+ setTimeout(sendNextChunk, 50);
} else {
reject(err);
}
});
}
- sendNextChunk();
+ // 初次发送前增加更长延迟,避免第一次发送异常
+ setTimeout(sendNextChunk, 100);
} catch (ex) {
console.log("ex=", ex);
@@ -1211,7 +1225,9 @@
try {
// console.log("1111");
- await sendTxtPackge(rgb, h3dic[i], str);
+ await sendTxtPackge(rgb, h3dic[i], str, i);
+ // 每行之间插入小延迟,避免行首解析异常
+ await new Promise(r => setTimeout(r, 120));
// console.log("222222");
} catch (ex) {
flag = false;
From ca6345ee3e8572415e1c3454f4fe9f696da8c303 Mon Sep 17 00:00:00 2001
From: fengerli <528575642@qq.com>
Date: Wed, 5 Nov 2025 08:48:13 +0800
Subject: [PATCH 06/11] =?UTF-8?q?6075=E9=A1=B5=E9=9D=A2=E5=BC=80=E5=8F=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/6075/BJQ6075.vue | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
create mode 100644 pages/6075/BJQ6075.vue
diff --git a/pages/6075/BJQ6075.vue b/pages/6075/BJQ6075.vue
new file mode 100644
index 0000000..79c7acd
--- /dev/null
+++ b/pages/6075/BJQ6075.vue
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
\ No newline at end of file
From a0c883f4e3dfafa6805090eaebaffec811f50aec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=AE=E5=BE=AE=E4=B8=80=E7=AC=91?= <709648985@qq.com>
Date: Wed, 5 Nov 2025 10:22:17 +0800
Subject: [PATCH 07/11] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=93=9D=E7=89=99?=
=?UTF-8?q?=E8=BF=9E=E6=8E=A57305=E5=90=8C=E6=AD=A5=E7=8A=B6=E6=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/7305/BJQ7305.vue | 52 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 51 insertions(+), 1 deletion(-)
diff --git a/pages/7305/BJQ7305.vue b/pages/7305/BJQ7305.vue
index 2148a84..ed98b1f 100644
--- a/pages/7305/BJQ7305.vue
+++ b/pages/7305/BJQ7305.vue
@@ -333,6 +333,13 @@
console.log("连接成功");
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) {
@@ -413,8 +420,15 @@
if (res.deviceId == these.formData.deviceId) {
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(() => {
@@ -474,6 +488,13 @@
});
ble.LinkBlue(these.formData.deviceId).then(() => {
these.formData.bleStatu = true;
+ // 连接成功后,同步BleHelper中的连接状态
+ let f = this.getDevice();
+ if (f) {
+ f.Linked = true;
+ ble.updateCache();
+ console.log("蓝牙状态恢复后连接成功,同步BleHelper连接状态为已连接");
+ }
updateLoading(these, {
text: '连接成功'
});
@@ -982,6 +1003,13 @@
return;
}
+ // 发送前确保连接状态同步:如果页面显示已连接,同步更新 BleHelper 中的 Linked 状态
+ if (this.formData.bleStatu && f) {
+ f.Linked = true;
+ ble.updateCache();
+ console.log("发送模式指令前同步连接状态为已连接");
+ }
+
showLoading(these, {
text: "请稍候..."
});
@@ -1113,6 +1141,14 @@
text: "请稍候..."
});
this.setBleFormData();
+
+ // 发送前确保连接状态同步:如果页面显示已连接,同步更新 BleHelper 中的 Linked 状态
+ if (this.formData.bleStatu && f) {
+ f.Linked = true;
+ ble.updateCache();
+ console.log("发送人员信息前同步连接状态为已连接");
+ }
+
let task = async () => {
var sendTxtPackge = (rgbdata, type, str, lineIndex) => {
@@ -1320,6 +1356,13 @@
let f = this.getDevice();
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 => {
@@ -1369,6 +1412,13 @@
dataView.setUint8(3, '9C41'); // 数据长度
let f = this.getDevice();
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 => {
From 77be45f1f3bf43dd7c5184a6ba196da7d5a92a02 Mon Sep 17 00:00:00 2001
From: fengerli <528575642@qq.com>
Date: Wed, 5 Nov 2025 11:13:32 +0800
Subject: [PATCH 08/11] 6075
---
pages.json | 36 +++++++++++++++++++-----------------
pages/6075/BJQ6075.vue | 1 +
2 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/pages.json b/pages.json
index 2382871..96309dc 100644
--- a/pages.json
+++ b/pages.json
@@ -164,6 +164,12 @@
"fullscreen": true
}
},
+ {
+ "path": "pages/6075/BJQ6075",
+ "style": {
+ "navigationStyle": "custom"
+ }
+ },
{
"path": "pages/common/map/index",
"style": {
@@ -252,34 +258,30 @@
}
},
{
- "path" : "pages/6331/BJQ6331",
- "style" :
- {
- "navigationBarTitleText" : "BJQ6331"
+ "path": "pages/6331/BJQ6331",
+ "style": {
+ "navigationBarTitleText": "BJQ6331"
}
},
{
- "path" : "pages/6331/AudioManager",
- "style" :
- {
- "navigationBarTitleText" : "语音管理"
+ "path": "pages/6331/AudioManager",
+ "style": {
+ "navigationBarTitleText": "语音管理"
}
},
{
- "path" : "pages/4877/BJQ4877",
- "style" :
- {
- "navigationBarTitleText" : "BJQ 4877"
+ "path": "pages/4877/BJQ4877",
+ "style": {
+ "navigationBarTitleText": "BJQ 4877"
}
},
{
- "path" : "pages/100/HBY100",
- "style" :
- {
- "navigationBarTitleText" : "HBY 100"
+ "path": "pages/100/HBY100",
+ "style": {
+ "navigationBarTitleText": "HBY 100"
}
}
-
+
],
"tabBar": {
diff --git a/pages/6075/BJQ6075.vue b/pages/6075/BJQ6075.vue
index 79c7acd..fa0976a 100644
--- a/pages/6075/BJQ6075.vue
+++ b/pages/6075/BJQ6075.vue
@@ -15,4 +15,5 @@
\ No newline at end of file
From a30a631ea647b0a0615e0c78d06de90f872d4990 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=AE=E5=BE=AE=E4=B8=80=E7=AC=91?= <709648985@qq.com>
Date: Wed, 5 Nov 2025 11:17:08 +0800
Subject: [PATCH 09/11] =?UTF-8?q?=E6=94=B9=E6=88=9013*13=E7=AC=A6=E5=90=88?=
=?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=AB=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../TextToHex/textToDotMatrixFor7305.vue | 38 +++++++++++++------
pages/7305/BJQ7305.vue | 2 +-
2 files changed, 27 insertions(+), 13 deletions(-)
diff --git a/components/TextToHex/textToDotMatrixFor7305.vue b/components/TextToHex/textToDotMatrixFor7305.vue
index 86e2e95..37f98a3 100644
--- a/components/TextToHex/textToDotMatrixFor7305.vue
+++ b/components/TextToHex/textToDotMatrixFor7305.vue
@@ -96,14 +96,19 @@
}
let convertCharToMatrix = (drawResult, item) => {
+ // 设备端使用13x13点阵渲染
const charWidth = 13;
- const charHeight = 12;
+ const charHeight = 13;
const { pixelData, width, height } = drawResult;
- // 将高分辨率像素降采样为13x12的布尔矩阵
+ // 将高分辨率像素降采样为13x13的布尔矩阵
const target = new Array(charWidth * charHeight).fill(0);
- const threshold = 0.5; // 每个小块中超过50%深色判为1
+ const threshold = 0.5; // 每个小块中超过50%亮色(文字)判为1
+
+ // 确保采样区域严格对齐,从PADDING_X开始,只采样13列
+ // 字符实际绘制区域:从PADDING_X开始,宽度为13*SCALE
+ const charStartX = PADDING_X;
+ const charEndX = PADDING_X + charWidth * SCALE;
- // 确保采样区域严格对齐,从PADDING_X开始,但只采样13列
for (let y = 0; y < charHeight; y++) {
for (let x = 0; x < charWidth; x++) {
let onCount = 0;
@@ -116,31 +121,39 @@
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;
- // 使用更严格的阈值,考虑alpha通道
+ // 计算亮度
const luminance = 0.299 * R + 0.587 * G + 0.114 * B;
const alpha = A / 255;
- // 只有深色且不透明才计入
- if (luminance < 128 && alpha > 0.5) onCount++;
+ // 背景是黑色,文字是白色,所以判断亮色(>=128)为文字点
+ if (luminance >= 128 && alpha > 0.5) onCount++;
total++;
}
}
- // 当深色占比超过阈值时判为1(至少需要采样到一些像素)
+ // 当亮色占比超过阈值时判为1(至少需要采样到一些像素)
target[y * charWidth + x] = (total > 0 && onCount / total >= threshold) ? 1 : 0;
}
}
const lowBytes = new Array(charWidth).fill(0);
const highBytes = new Array(charWidth).fill(0);
- // 按列打包,每列12行分成上下两字节
+ // 按列打包,每列13行分成上下两字节:低字节0-7行(8行),高字节8-12行(5行)
for (let col = 0; col < charWidth; col++) {
for (let row = 0; row < charHeight; row++) {
const pixel = target[row * charWidth + col];
@@ -149,7 +162,7 @@
// 低字节:0-7行,从低位到高位
lowBytes[col] |= (1 << row);
} else {
- // 高字节:8-11行,从低位到高位
+ // 高字节:8-12行,从低位到高位(使用5位,剩余3位未使用)
highBytes[col] |= (1 << (row - 8));
}
}
@@ -163,8 +176,9 @@
let ctx = this.ctx;
// 1. 动态调整Canvas尺寸(高分辨率)
+ // 设备端使用13x13点阵渲染
this.currentCanvasWidth = 13 * SCALE + PADDING_X;
- this.currentCanvasHeight = 12 * SCALE;
+ this.currentCanvasHeight = 13 * SCALE;
// 2. 清空Canvas(绘制背景)
this.clearCanvas();
diff --git a/pages/7305/BJQ7305.vue b/pages/7305/BJQ7305.vue
index ed98b1f..d8a3883 100644
--- a/pages/7305/BJQ7305.vue
+++ b/pages/7305/BJQ7305.vue
@@ -88,7 +88,7 @@
发送
+ :bgColor="'#000000'" :color="'#FFFFFF'" :fontSize="11" >
From 27d212e7dc9dcf61f361bd633482d5f26cde4886 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=AE=E5=BE=AE=E4=B8=80=E7=AC=91?= <709648985@qq.com>
Date: Wed, 5 Nov 2025 19:18:05 +0800
Subject: [PATCH 10/11] =?UTF-8?q?=E7=BB=A7=E7=BB=AD=E4=BC=98=E5=8C=967305?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../TextToHex/textToDotMatrixFor7305.vue | 124 +-
pages/7305/BJQ7305.vue | 3816 +++++++++--------
2 files changed, 2042 insertions(+), 1898 deletions(-)
diff --git a/components/TextToHex/textToDotMatrixFor7305.vue b/components/TextToHex/textToDotMatrixFor7305.vue
index 37f98a3..307b03b 100644
--- a/components/TextToHex/textToDotMatrixFor7305.vue
+++ b/components/TextToHex/textToDotMatrixFor7305.vue
@@ -27,6 +27,16 @@
color: {
type: String,
default: "#000000"
+ },
+ // 二值化阈值(0~1),越大越细;默认偏清晰
+ threshold: {
+ type: Number,
+ default: 0.45
+ },
+ // 是否启用轻度笔画修复(3x3 膨胀);默认关闭以避免变粗
+ sharpen: {
+ type: Boolean,
+ default: false
}
},
data() {
@@ -48,6 +58,16 @@
this.ctx = uni.createCanvasContext('reusableCanvas', this);
},
methods: {
+ /**
+ * 外部可调用:复位画布为纯背景并立即提交
+ */
+ async resetCanvas() {
+ if (!this.ctx) return;
+ this.clearCanvas();
+ await new Promise((resolve) => {
+ this.ctx.draw(true, () => setTimeout(resolve, 30));
+ });
+ },
/**
* 估算单行文本所需的Canvas宽度
*/
@@ -69,6 +89,8 @@
* 复用单个Canvas处理所有文本行
*/
async drawAndGetPixels() {
+ // 发送前:确保画布处于干净背景态
+ await this.resetCanvas();
// 超采样比例(提高分辨率再降采样,减少模糊)
const SCALE = 3;
const PADDING_X = 1 * SCALE; // 左侧预留像素,避免首字裁剪
@@ -96,21 +118,28 @@
}
let convertCharToMatrix = (drawResult, item) => {
- // 设备端使用13x13点阵渲染
+ // 设备端使用13x13点阵渲染(保持输出13列×13行),但只在内部采样12×12,保留右侧与底部1像素缓冲
const charWidth = 13;
const charHeight = 13;
+ const effectiveWidth = 12; // 仅采样前12列
+ const effectiveHeight = 12; // 仅采样前12行
const { pixelData, width, height } = drawResult;
// 将高分辨率像素降采样为13x13的布尔矩阵
const target = new Array(charWidth * charHeight).fill(0);
- const threshold = 0.5; // 每个小块中超过50%亮色(文字)判为1
+ const threshold = Math.max(0.2, Math.min(0.8, this.threshold || 0.45));
- // 确保采样区域严格对齐,从PADDING_X开始,只采样13列
- // 字符实际绘制区域:从PADDING_X开始,宽度为13*SCALE
+ // 确保采样区域严格对齐,从PADDING_X开始,只采样12列(右侧预留1px),12行(底部预留1px)
+ // 字符实际绘制区域:从PADDING_X开始,宽度为12*SCALE
const charStartX = PADDING_X;
- const charEndX = PADDING_X + charWidth * SCALE;
+ 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
@@ -151,6 +180,32 @@
}
}
+ // 轻度笔画修复:可选 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 highBytes = new Array(charWidth).fill(0);
// 按列打包,每列13行分成上下两字节:低字节0-7行(8行),高字节8-12行(5行)
@@ -198,30 +253,41 @@
ctx.fillText(textLine, charX, charY);
// 5. 异步绘制并获取像素数据(串行处理避免冲突)
- await new Promise((resolve, reject) => {
- ctx.draw(false, () => {
- uni.canvasGetImageData({
- canvasId: 'reusableCanvas',
- x: 0,
- y: 0,
- width: this.currentCanvasWidth,
- height: this.currentCanvasHeight,
- success: res => {
- result = {
- line: textLine,
- pixelData: res.data,
+ const grabPixels = () => new Promise((resolve, reject) => {
+ // 立即绘制并给一点缓冲时间,避免取像素过早
+ ctx.draw(true, () => {
+ setTimeout(() => {
+ uni.canvasGetImageData({
+ canvasId: 'reusableCanvas',
+ x: 0,
+ y: 0,
width: this.currentCanvasWidth,
- height: this.currentCanvasHeight
- };
- resolve();
- },
- fail: err => {
- // console.error(`处理第${i+1}行失败:`, err);
- reject(err)
- }
- });
+ height: this.currentCanvasHeight,
+ success: res => {
+ result = {
+ line: textLine,
+ pixelData: res.data,
+ width: this.currentCanvasWidth,
+ height: this.currentCanvasHeight
+ };
+ resolve();
+ },
+ fail: err => reject(err)
+ });
+ }, 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;
}
@@ -239,11 +305,17 @@
// 调试:打印每个字符的点阵数据
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(","));
arr.push(linePixls);
+ // 每行结束再等一会,提高末字符稳定性
+ await new Promise(r => setTimeout(r, 40));
}
+ // 发送后:再次清空画布,避免残留影响下一次
+ await this.resetCanvas();
return arr;
}
}
diff --git a/pages/7305/BJQ7305.vue b/pages/7305/BJQ7305.vue
index d8a3883..47c2e16 100644
--- a/pages/7305/BJQ7305.vue
+++ b/pages/7305/BJQ7305.vue
@@ -1,1873 +1,1945 @@
-
-
-
-
-
-
-
-
-
-
- {{formData.battary}}%
- 电量
-
-
-
-
-
- {{formData.xuhang}}
- 续航时间
-
-
-
-
-
-
- 蓝牙名称
- {{formData.blename}}
-
-
- 设备名称
- {{formData.deviceName}}
-
-
- 充电状态
- {{formData.statu}}
-
-
- 蓝牙状态
- {{formData.bleStatu?'已连接':'未连接'}}
-
-
-
-
- 灯光亮度
- {{formData.liangDu}}%
-
-
-
-
-
-
-
-
-
-
-
-
-
- 主灯模式
- {{getMode}}
-
-
-
-
-
-
-
-
- 开机画面
- 上传
-
-
-
-
-
-
- 人员信息登记
- 发送
-
-
-
-
-
- 单位:
-
-
-
- 部门:
-
-
-
- 姓名:
-
-
-
-
-
- 产品信息
-
-
-
- 产品参数
-
-
-
- 操作说明
-
-
-
- 操作视频
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
From c81a4d1903eb32ed784b97e33d29076e46fb1531 Mon Sep 17 00:00:00 2001
From: fengerli <528575642@qq.com>
Date: Thu, 6 Nov 2025 08:46:27 +0800
Subject: [PATCH 11/11] =?UTF-8?q?6075=E8=AE=BE=E5=A4=87=E6=8E=A7=E5=88=B6?=
=?UTF-8?q?=E9=A1=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/100/HBY100.vue | 1 -
pages/6075/BJQ6075.vue | 1384 +++++++++++++++++++++++++++-
pages/6170/deviceControl/index.vue | 9 -
pages/7305/BJQ7305.vue | 2 +-
pages/common/login/index.vue | 2 +-
static/images/6075/cq.png | Bin 0 -> 1013 bytes
static/images/6075/fg.png | Bin 0 -> 874 bytes
static/images/6075/gz.png | Bin 0 -> 586 bytes
static/images/6075/jn.png | Bin 0 -> 616 bytes
static/images/6075/jsg.png | Bin 0 -> 997 bytes
static/images/6075/sos.png | Bin 0 -> 745 bytes
11 files changed, 1380 insertions(+), 18 deletions(-)
create mode 100644 static/images/6075/cq.png
create mode 100644 static/images/6075/fg.png
create mode 100644 static/images/6075/gz.png
create mode 100644 static/images/6075/jn.png
create mode 100644 static/images/6075/jsg.png
create mode 100644 static/images/6075/sos.png
diff --git a/pages/100/HBY100.vue b/pages/100/HBY100.vue
index ea5a481..7744731 100644
--- a/pages/100/HBY100.vue
+++ b/pages/100/HBY100.vue
@@ -147,7 +147,6 @@
-
diff --git a/pages/6075/BJQ6075.vue b/pages/6075/BJQ6075.vue
index fa0976a..121307b 100644
--- a/pages/6075/BJQ6075.vue
+++ b/pages/6075/BJQ6075.vue
@@ -1,19 +1,1391 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{deviceInfo.batteryPercentage}}%
+ 电量
+
+
+
+
+
+ {{deviceInfo.batteryRemainingTime}}分钟
+ 续航时间
+
+
+
+
+
+
+
+
+
+
+ IMEI号
+ 123488756
+
+
+ 设备状态
+ 运行中
+
+
+ 定位信息
+
+ 114.72 30.28
+
+
+ 深圳市龙华区富源晟
+
+
+
+
+
+
+ 海拔高度 2666m
+ 相对高度123m
+
+
+
+
+
+
+
+
+
+ 主灯模式
+ {{ currentMainMode }}
+
+
+
+
+
+
+
+ 辅灯模式
+ {{ currentSubMode }}
+
+
+
+
+
+
+
+ 激光模式
+ {{ currentlaserMode }}
+
+
+
+
+
+
+
+ 声光报警
+ {{ currentMainMode }}
+
+
+
+
+
+
+
+
+ 开机画面
+ 上传
+
+
+
+
+
+
+
+
+
+
+ 人员信息登记
+
+
+
+
+
+
+
+ 单位:
+
+
+
+ 姓名:
+
+
+
+ 职位:
+
+
+
+ ID:
+
+
+
+
+
+
+
+ 发送信息
+
+
+
+
+
+
+
+
+
+ 产品信息
+
+
+
+ 产品参数
+
+
+
+ 操作说明
+
+
+
+ 操作视频
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
\ No newline at end of file
diff --git a/pages/6170/deviceControl/index.vue b/pages/6170/deviceControl/index.vue
index a5e8c61..4e84187 100644
--- a/pages/6170/deviceControl/index.vue
+++ b/pages/6170/deviceControl/index.vue
@@ -297,11 +297,8 @@
export default {
data() {
return {
- lastBrightnessTime: 0,
isCardSliding: false,
cardRect: null,
- touchStartX: 0,
- touchStartY: 0,
pageLoading: true,
navBarHeight: 70 + uni.getSystemInfoSync().statusBarHeight,
navTitle: "",
@@ -338,7 +335,6 @@
isLaserOn: false,
isSending: false,
isProcessing: false,
- isLoading: false, // 主加载状态
isPolling: false // 轮询状态
}
},
@@ -557,7 +553,6 @@
};
lightModeSettings(data).then((res) => {
if (res.code == 200) {
- // 只有确认成功才更新实际模式,选中模式
this.currentMainMode = this.pendingMainMode;
this.selectedItemIndex = selectedItem;
uni.showToast({
@@ -566,15 +561,11 @@
})
uni.hideLoading();
this.lightModeA = false;
- //this.isProcessing = false
- //loadingShown = false
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
- //this.isProcessing = false
- //loadingShown = false
uni.hideLoading();
}
})
diff --git a/pages/7305/BJQ7305.vue b/pages/7305/BJQ7305.vue
index d8a3883..86de260 100644
--- a/pages/7305/BJQ7305.vue
+++ b/pages/7305/BJQ7305.vue
@@ -1378,7 +1378,7 @@
},
//获取当前设备状态
- GetDeviceStatu: function() {
+ GetDeviceStatu: function() {
//数据头 命令码 数据 校验码
//JQOC 0B 00 9C41
diff --git a/pages/common/login/index.vue b/pages/common/login/index.vue
index 1bafbc8..aa2ee4b 100644
--- a/pages/common/login/index.vue
+++ b/pages/common/login/index.vue
@@ -252,7 +252,7 @@
uni.showToast({
title: res.msg || '服务器异常,请稍后重试',
icon: 'none'
- })
+ })
}
} catch (error) {
console.log('捕获错误:', error);
diff --git a/static/images/6075/cq.png b/static/images/6075/cq.png
new file mode 100644
index 0000000000000000000000000000000000000000..53e3da8a2e4bd85e8ed06951cda21c950e8966c5
GIT binary patch
literal 1013
zcmeAS@N?(olHy`uVBq!ia0vp^6(G#P3?%t>9eV(z7>k44ofvPP)Tsw@I14-?iy0WW
zg+Z8+Vb&Z8px~tdpAc6d?d|RDg$;Omdb+u}0cC*7c*zh?C`ujEszX
z_wH%tY&{3`m0L-WUoeC5jB7vs|Gqolf_vJ`@s
z4l)cM-haQ98)Y*=U|x&(d1V)lf2EvF9C9`udpg*aloU56oH@7kb?IjLz4Dh|tK8R*
z-2M8k-QIQA@5#CfGzK=z?pX0XgHzzqa^(=Wr9agkT=-q^hN-7^zhcksb@?Jwr543E
za6eG~%++Z7B|_1_`F^PNFWHWzPBDtYJ_ZL_pu~n`3yF0f%Cjw8o;1Y#arnahk!e!t
zM49OaCQnaMJtdsa@GXm%eW~Ix$sdz;n*O$)cPQn3wY|pcsn@p6722Qvbq$xc|GJq=
zPF+0Mx^C`^n%QfPyYHGh*EU6LO_RF14!_ww&26h^U5+uD^W-Gok@To=FZV@0hps&)BN>{>!$JV
zS@&nzM+^Rn(BxfTU)!)(_$FVQEc=upzi#zsn|lJF5QskXFOl!Vqcv9k&cFYqFoYl9
zKV|9DqVk~AZ0i#FQ>;JpFHl>Td0pMxtf=>QOmnL7^*x)n8)huXdlvP@==P@fwM+II
z{4Go2Jsh@pYtB5UtvRo69kBj-&1jd+sns_-3pH7UZMrsO_-TK-?3Y+EhwsVTQ@VEq
zfx*5(bkFVI>&p(#Y3*mHf5)dN!D9&M($@!{
zGEQDpxjQ0LjLGzopr0F8m~mH+?%
literal 0
HcmV?d00001
diff --git a/static/images/6075/fg.png b/static/images/6075/fg.png
new file mode 100644
index 0000000000000000000000000000000000000000..d98249b81c42e647d38fcb9b7e0ef82d510f45be
GIT binary patch
literal 874
zcmeAS@N?(olHy`uVBq!ia0vp^6(G#P3?%t>9eV(z7>k44ofvPP)Tsw@I14-?iy0WW
zg+Z8+Vb&Z8pkP9PPlzj!_V)Jn!UjA&J>A^gfU-aaP(Cg$uD`#3?b@}cPMx}P<;uN#
z_YNF5uz2y}>gwwB^z_2Q!WS=Iw6?a+oH;WjBqSpvW81cEYu2o>%Da6TXoo^ckY6x^
z@r-Lf{{Ox^--3JE%;WztKm%h|A_D_cxu=U`NX4ADx2q@5G7w<+5PQ#Y{o9u@Z@>R9
zn7cFX_UpsJ_e8XmJg)FQITW+|cYpec53^gm@3=ayV0z7992orjm#DBLY=C`)`C6
zWVpA*HYnUz)bZ)x&R5_4;>-gki;SC_518G$rn8~7Z)NEfewT8w?UN+aW+b*jhf4XhV`nsR1#Q6><&i=ae
zciz-r3*`SroQT>izkL7uV*W3Oi^LUtXL0ZC?7tdcFQsXKKZT$1Bb`twL
z|A=L-#&_6dv01pn2wjyxsIRWe?R{SI(w=6$WK3;xlXT~
zC%jx2bgncwtl;XTz0#YyR?oN>H+5>v)jhwu);!Zv{}OB2=(kULx7WHV)xt@uRjZ@!
zJo#!ZwT}C^^Ofq5-ShXZxR(2>V0Oaw&K&N^d4`5S>%<@Y@({_nMOIe!GJW%g`a&+q-(EvwgpGmgLhsdzh=d5`WhIN+4CV?ZV^7
b&GihkM6T|QDl85ICRYYeS3j3^P69eV(z7>k44ofvPP)Tsw@I14-?iy0WW
zg+Z8+Vb&Z8pkPRVPlzj!_V)Jn!UjA&J>A^gfU-aaP`F_PFJ8Qei;FvO;K26n
z+pk=?a_ZEnkdTmj_wKD(v!<}Hu(h={Jw5&N0-I`}xiTd|e!&dJGp_yk|NHKI3+`z%
zkN-yj>X)sa03Dj{>EaktG3V{=Lhlv>3APX4OE1rzS1RLr|NrMufr*uGy{;ci4DdZv
zdiz7gy!t7MzZdSYD(yMh7OUYaQ(6$csI9;Af@anm-8&uIkLX=Ydogp{%JbJ4GS-W&OaI?4S=_;C{`o(@PyNJ#
zZQix}*08#Tsy7E-<$O5J-G8;j?i(MzKFHOJOFDde=C^R5cKz1%HRt)2e#%Ja9c@1^
zyU2d$imC7S-}0)9y5)O7VWYYIQwH;ll36LPRyTNM#PaV<*=!ZG)cLN%k868#Z#doC
z>69(!w2NU6+YPbl3uQJeEmiv=a$q|D_5PO+Y+tYc`_%cPeZsEGmtQ+X-ev!~VP3x(
zvWtOEw@`|iX``q8U&i^3$exe>LC5+Y+%n%TXg_J?)q44|Z!7d3Uoy(-y7Igx$|pTo
gdbZ1pEj1s6E8dpw{cHcT0~j?7p00i_>zopr00w#o?*IS*
literal 0
HcmV?d00001
diff --git a/static/images/6075/jn.png b/static/images/6075/jn.png
new file mode 100644
index 0000000000000000000000000000000000000000..4122b8ecb18f602f9a708528a71931d737839e0f
GIT binary patch
literal 616
zcmeAS@N?(olHy`uVBq!ia0vp^6(G#P3?%t>9eV(z7>k44ofvPP)Tsw@I14-?iy0WW
zg+Z8+Vb&Z8pkR1_Plzj!_V)Jn!UjA&J>A^gfU-aaP(Cg$?!bWq_wL<$@#4kWwQCnI
zUOaQ=%+}V{ZQHh0S63Gn7KVg`^!N9lI(6#Gl`GNnBt?Nn%a#QB1v41Wxc1}!@4NFY
zxTnoL{vQ=YIDCx;I=0c%#WAE}&fD9G{>=sgY!7xbB_Fsl^UVMM%)Nffn_jYsF3ORZ
zQgn5j;lB6N-#Q=OY^J$WcFIcLaz*=>D`LNUPWilAeT)CC5ZyWM)#vptZdx~k>;C7r
zlct?1WSFjzCd%5V+!rDcQTQfXzLu|8=tyqrfd)oqHXaFs1PJ4YdqG-;mub~=mUB~H
z+V9DGcADvjlXSbuRPG%H=DJ@tb61!q`*4Dk$EO~fdz!cArbN3-zh1(wRrTkmiZZc9
zKH}1z;2HVE%X>a&2qb@{0awe`QTZCdu3ZSpR$&}YAXd{n)8>FdF3TQ&24|J}30
z{x3(JQ2bG*cjDH2tq*?UWM;ErJcFdVIUt(9sqopq!
z7tVH>BYSqSj7nP6UY3H(Mh`9;otpaIa=-kt?8z_9=3V&r9eV(z7>k44ofvPP)Tsw@I14-?iy0WW
zg+Z8+Vb&Z8pkQ)A^gfU-aaP(Cg$?!bWq_wL<0b?Q`qe}70w
z$dxNsUc7iwU0pqM=FG*57Z(;5wzjseS+i#Q_U&ueu1!x*-?nXAMn;AsyU7)xHHsxc
ze!&dJGp_yk|NHKI3+`z%kN?L6M@<8kFfcH^^K@|xshIP2c4qNx1A#VGzh>E`?YEEp
z{a?R!a@i%bcG*c1&0R-$w?%H)lb81GZ-e@R7mS%(S5Ix&>=V=Z&|_iT75!wz`$~@9
zKQpH^I{y}(dHRM^^f%W7X4}_xH|V}g=v}4zQ?wkYm;Q82z}p^<2*6l}}zi=ns-DmoE9RJmkNPz>EXxjjYv8&CTM$
z2@lnLcI{7mpg-~Sn*C`9<_njWytitJklp>*V!v!dbYsKw%9(z-)wbamd2XNJ_^~Tu
z?Tal52W)4)dpe6Lek!-KbM5r+ovXgy+XDvJ9<8y
zx&7Y7)5o1oWIo{EYy59n;K3O#St2{`A3a%hZ$-kl&pr>Ht}8yYSNQB*<^R`b9;j@J
z@N_+JZ7;*JsLKa(7f*Ybn{3y{e$M&fcJrJ9L-h!g?=FT1ti9V?rsXC!Z1
zfqDC!WLs6oO|O)Ay0*MZQz>|-z`TAQmtte7M@G@c16r!_u4h-u^F=IuvU>To{f`?q
zcPyAD`{CfpU#osQvGUFMe9uSxo0f*~K3n_FrHMIBa)IV^KCu6Ub9eV(z7>k44ofvPP)Tsw@I14-?iy0WW
zg+Z8+Vb&Z8pkP#hPlzj!_V)Jn!UjA&J>A^gfU-aaP`FSZ*SlBJ8Zzi_F%``YnP8C_#F6cFPqLbrT6f)
zi(I}I;)46zr*oy;&k0&omnC{U^VX!-O}`2X7cCF_yS`X-ue($E#OeBxeag{O%Jv;@%{%7iY&gg!jY^z;AY}C@NOs-A
zSnjH@_Wr0P;h&c9O}}vN$~RZpd3g-X0`P*hqlTOhG3&ajY9hj@xlY}SSf1S!>G|U)yY6#<_ip#VkjU`!H-ayoOtq;v-}&_W2J?*vZZ2V{7UrJg
z%k@EW^_dE@haXI~Oq;bim0{PBDF-HB(CXvQvYDN*!z*Ti#|KTB^J)^u@@^ckcIE65
zJu0@_eA)qV-b>uCRGJqq(uibQ^g*W5*3DpBLIv9%dF808MIZXFT1cBNn)>|yjXa|p
z3C+A_NW_ExT>aY*@0j9jo&IWK0Hf{I!2T&-PbAyxQl6-tNS1wjVm70_ZgHs4?>YPJ
kmc3qdr%aIZZmr!9&gs%+dt;V(ff6-?r>mdKI;Vst0IC2|=>Px#
literal 0
HcmV?d00001