1
0
forked from dyf/APP

Compare commits

..

8 Commits

3 changed files with 311 additions and 287 deletions

View File

@ -34,7 +34,9 @@
currentCanvasWidth: 0,
currentCanvasHeight: 0,
// Canvas上下文复用
ctx: null
ctx: null,
// 标记是否已经预热过画布
canvasWarmed: false
};
},
computed: {
@ -62,10 +64,67 @@
this.ctx.fillRect(0, 0, this.currentCanvasWidth, this.currentCanvasHeight);
},
/**
* 预热画布确保画布和字体完全准备好解决APP重新打开后第一次获取数据不完整的问题
*/
async warmupCanvas() {
if (this.canvasWarmed) {
return;
}
try {
// 设置画布尺寸
this.currentCanvasWidth = 16;
this.currentCanvasHeight = 16;
// 清空画布
this.clearCanvas();
// 绘制一个测试字符来预热字体和画布
this.ctx.setFillStyle(this.color);
this.ctx.setFontSize(this.fontSize);
this.ctx.font = `${this.fontSize}px "PingFangBold", "PingFang SC", Arial, sans-serif`;
this.ctx.setTextBaseline('middle');
this.ctx.fillText('测', 0, 8);
// 等待画布绘制完成
await new Promise((resolve) => {
this.ctx.draw(false, () => {
// 获取一次测试数据确保canvasGetImageData API已准备好
setTimeout(() => {
uni.canvasGetImageData({
canvasId: 'reusableCanvas',
x: 0,
y: 0,
width: 16,
height: 16,
success: () => {
this.canvasWarmed = true;
resolve();
},
fail: () => {
this.canvasWarmed = true;
resolve();
}
});
}, 100);
});
});
// 额外等待确保字体完全加载
await new Promise(resolve => setTimeout(resolve, 200));
} catch (ex) {
console.log("画布预热异常:", ex);
this.canvasWarmed = true; // 即使失败也标记为已预热,避免重复尝试
}
},
/**
* 复用单个Canvas处理所有文本行
*/
async drawAndGetPixels() {
// 第一次调用时先预热画布解决APP重新打开后第一次获取数据不完整的问题
await this.warmupCanvas();
let convertCharToMatrix=function(imageData) {
// console.log("imgData=",imageData)
@ -119,7 +178,7 @@
// 3. 设置文字样式
ctx.setFillStyle(this.color);
ctx.setTextBaseline('middle');
ctx.setTextBaseline('middle');
// ctx.setTextAlign('center')
ctx.setFontSize(this.fontSize);
ctx.font = `${this.fontSize}px "PingFangBold", "PingFang SC", Arial, sans-serif`;

View File

@ -77,7 +77,7 @@
<text class="smallTxt">泛光模式</text>
</view>
</view>
<!-- <view class="mode fleft" v-on:click.stop="UploadOpenImg()">
<view class="mode fleft" v-on:click.stop="UploadOpenImg()">
<view class="leftImg">
<image class="img" src="/static/images/6155/DeviceDetail/open.png" mode="aspectFit"></image>
</view>
@ -85,8 +85,8 @@
<text class="bigTxt">开机画面</text>
<text class="smallTxt">上传</text>
</view>
</view> -->
<view class="mode fleft" v-on:click.stop="UploadOpenVideo()">
</view>
<view class="mode marginLeft fleft" v-on:click.stop="UploadOpenVideo()">
<view class="leftImg">
<image class="img" src="/static/images/common/video.png" mode="aspectFit"></image>
</view>
@ -108,15 +108,15 @@
<view class="item">
<text class="lbl">单位</text>
<input class="value" v-model="formData.textLines[0]" placeholder="请输入单位" placeholder-class="usrplace" />
<input class="value" v-model.trim="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" />
<input class="value" v-model.trim="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" />
<input class="value" v-model.trim="formData.textLines[2]" placeholder="请输入职位" placeholder-class="usrplace" />
</view>
</view>
@ -422,15 +422,11 @@
}
switch (this.formData.mode) {
case 0:
txt = "强光模式";
break;
case 1:
txt = "弱光模式";
break;
case 2:
txt = "爆闪模式";
break;
@ -773,7 +769,7 @@
}
//FA 09 0C 84 FB 09 00 [01~08] + 3200字节 +FF 数据格式
//FA 09 0C 84 FE 09 00 [01~08] + 3200字节 +FF 数据格式
var buffer = new ArrayBuffer(bufferSize);
var dataView = new DataView(buffer);
if (childPacket == 1) {
@ -781,7 +777,7 @@
dataView.setUint8(1, 0x09); // 帧头
dataView.setUint8(2, 0x0C); // 帧头
dataView.setUint8(3, 0x84); // 帧头
dataView.setUint8(4, 0xFD); // 帧头
dataView.setUint8(4, 0xFE); // 帧头
dataView.setUint8(5, 0x09);
dataView.setUint8(6, 0x00); // 帧头
dataView.setUint8(7, currentPacket); //包序号
@ -923,7 +919,7 @@
fail: (ex) => {
updateLoading(these, {
text: '视频文件上传失败了,请检查网络连接'
text : '视频文件上传失败了,请检查网络连接'
});
reject(ex);
@ -1297,9 +1293,14 @@
case "fu":
title = '辅灯模式';
items = [{
text: '泛光',
icon: '/static/images/6155/DeviceDetail/fan.png'
}];
text: '泛光',
icon: '/static/images/6155/DeviceDetail/fan.png'
},
{
text: '强+泛光',
icon: '/static/images/6155/DeviceDetail/fan.png'
},
];
break;
}
@ -1334,29 +1335,22 @@
},
setMode(mode, type) {
let dataValue = 0;
switch (mode) {
case 0:
if (type == 'main') {
dataValue = 0x01;
} else if (type == 'fu') {
dataValue = 0x04;
}
break;
case 1:
dataValue = 0x02;
if (type == 'main') {
dataValue = 0x02;
} else if (type == 'fu') {
dataValue = 0x0A; //强泛光
}
break;
// case 2:
// dataValue = 0x02;
// break;
case 2:
dataValue = 0x03;
break;
@ -1365,7 +1359,7 @@
break;
}
// console.log("dataValue=", dataValue)
console.log("dataValue=", dataValue)
// 构建数据包
var buffer = new ArrayBuffer(6);
var dataView = new DataView(buffer);
@ -1528,151 +1522,73 @@
});
this.setBleFormData();
let task = async () => {
var sendTxtPackge = (rgbdata, type, str) => {
var promise = new Promise((resolve, reject) => {
try {
let packetSize = rgbdata.length; //每包均分的数量
let mode = rgbdata.length % packetSize; //最后一包的数量
let cnt =
1; // parseInt(rgbdata.length / packetSize) + (mode > 0 ? 1 :0); //总包数量
let curr = 1; //当前包序号
let sendNext = () => {
if (curr > cnt) {
resolve();
return;
}
let bufferSize = 261;
console.log("bufferSize=", bufferSize)
let buffer = new ArrayBuffer(bufferSize);
let dataView = new DataView(buffer);
let startIndex = (curr - 1) * packetSize;
let endIndex = Math.min(startIndex + packetSize, rgbdata
.length);
if (startIndex > endIndex) {
return;
}
let packetData = rgbdata.slice(startIndex,
endIndex); //取一片数据发送
console.log("packetData.length=", packetData.length);
let start = 0;
if (curr == 1) {
dataView.setUint8(0, 0xFA);
dataView.setUint8(1, type);
dataView.setUint8(2, 0x01);
dataView.setUint8(3, 0x00);
start = 4;
}
for (let i = 0; i < packetData.length; i++) {
dataView.setUint8(start + i, packetData[i]);
}
dataView.setUint8(bufferSize - 1, 0xFF);
let inteval = 100;
//parseInt(this.inteval ? this.inteval : 80);
//console.log("inteval=", inteval)
ble.sendData(f.deviceId, buffer, f.writeServiceId, f
.wirteCharactId, 30).then(() => {
curr++;
setTimeout(sendNext, inteval);
}).catch(err => {
if (err.code == '10007') {
setTimeout(sendNext, inteval);
} else {
reject(err);
}
});
}
sendNext();
} catch (ex) {
console.log("ex=", ex);
reject(ex);
}
});
return promise;
}
console.log("11111");
var result = null;
try {
console.log("this.$refs.textToHex=", this.$refs.textToHex);
result = await this.$refs.textToHex.drawAndGetPixels();
} catch (ex) {
console.log("ex=", ex);
}
if (!result) {
hideLoading(this);
return;
}
console.log("result=", result);
result = result.map(level1 => {
return level1.flat(Infinity);
});
console.log("result=", result);
// 预热画布确保画布和字体完全准备好解决APP重新打开后第一次获取数据不完整的问题
console.log("预热画布...");
await this.$refs.textToHex.drawAndGetPixels();
await new Promise(resolve => setTimeout(resolve, 200)); // 等待预热完成
// var str1="FA 06 01 00 FF FF F7 9F EF 6F EC F7 EA 09 CF FF AF FB EF EB EF EB EC 6B EF EB EC 6B EF EB EF FB EE 63 FF FF FF FF F7 9F EF 6F EC F7 EA 09 CF FF AF FB EF EB EF EB EC 6B EF EB EC 6B EF EB EF FB EE 63 FF FF FF FF F7 FF 81 03 ED BB DD B7 CB CF F3 C7 CD 39 BE FF FE FF C0 03 FE FB FD FB F3 F7 8F 87 FF FF FF FF FE FF FE FF FE FF C0 03 FF FB FD FB FD FB FD FB FD FB FB FB FB FF F7 F7 EF F7 9F 8F FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF"
// var str2="FA 07 01 00 FF FF EE DD EE DF EF 5B AB DF AA 03 AE FF AE FF EE 03 EE FF EE FF EE 03 EE FF EE FF EE E3 FF FF FF FF EE DD EE DF EF 5B AB DF AA 03 AE FF AE FF EE 03 EE FF EE FF EE 03 EE FF EE FF EE E3 FF FF FF FF EF 77 EF 73 EF 7F 80 01 EF 7F EF 7F EF 03 E7 3B 8E BB EE D7 EE EF ED E7 ED 9B 8B 7D FF FF FF FF FF FF F7 EF F7 F7 EF F7 DF FB FF FF FF FF FE FF 80 01 FE 7F FD BF FB DF F7 E7 9F F9 FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF"
// var str3="FA 08 01 00 FF FF EF DF EC 01 EF FF AB FF AA 03 AA FB AE FB EE 03 EF DF EF DF EE DB ED DF ED DD EF 1F FF FF FF FF EF BF EF 87 81 77 EE F7 EC 03 81 7F EF 7F EF 7F EF 03 81 7F EF 7F EF 7D EF 7D EF 03 FF FF FF FF F9 F1 CF BF DF FF DF FF C1 FF DD 81 DD F7 DD F7 C1 F7 DF 77 FF 77 BF 77 BF 77 FF F7 FF FF FF FF FD FF FD FF FB FF FB FF F0 07 E7 F7 EF F7 D8 07 BF F7 FF F7 F8 07 FF F7 FF F7 FF C7 FF FF FF FF FF FF FF FF FF FF FE FF FE 7F FE 7F FE FF FD BF FD FF FB DF F7 EF EF F7 DF FB BF FD FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF"
// let arr1=('0x'+(str1.split(' ').join(",0x"))).split(',');
// let arr2=('0x'+(str2.split(' ').join(",0x"))).split(',');
// let arr3=('0x'+(str3.split(' ').join(",0x"))).split(',');
// result=[arr1,arr2,arr3];
// console.log("result=",result);
let h3dic = [0x06, 0x07, 0x08];
let pros = [];
let flag = true;
for (var i = 0; i < result.length; i++) {
let str = this.formData.textLines[i];
if (str.length > 0) {
let width = str.length * 16;
var rgb = result[i];
try {
// console.log("1111");
await sendTxtPackge(rgb, h3dic[i], str);
// console.log("222222");
} catch (ex) {
flag = false;
console.log("33333");
break;
}
// 1. 获取所有文本行的像素数据
const allPixels = await this.$refs.textToHex.drawAndGetPixels();
if (!allPixels) {
throw new Error("无法生成像素数据");
}
// 2. 将所有像素数据合并到一个大数组中
let combinedData = [];
for (let i = 0; i < 3; i++) {
const linePixels = (allPixels[i] || []).flat(Infinity).map(item =>
typeof item === 'string' ? these.toByteValue(item) : item
);
// 补齐到256字节
while (linePixels.length < 256) {
linePixels.push(0x00);
}
combinedData = combinedData.concat(linePixels.slice(0, 256));
}
}
// 3. 构建完整的逻辑大包
const logicalPacketSize = 4 + combinedData.length + 1; // Header + Data + Footer
const logicalBuffer = new ArrayBuffer(logicalPacketSize);
const logicalDataView = new DataView(logicalBuffer);
hideLoading(these);
if (flag) {
console.log("发送成功");
// 写入头部
logicalDataView.setUint8(0, 0xFA);
logicalDataView.setUint8(1, 0x06);
logicalDataView.setUint8(2, 0x03);
logicalDataView.setUint8(3, 0x00);
// 写入数据
for (let i = 0; i < combinedData.length; i++) {
logicalDataView.setUint8(4 + i, combinedData[i]);
}
// 写入尾部
logicalDataView.setUint8(logicalPacketSize - 1, 0xFF);
// 4. 将逻辑大包分包发送
const CHUNK_SIZE = 20; // 每个物理包的大小
const totalChunks = Math.ceil(logicalPacketSize / CHUNK_SIZE);
updateLoading(these, {
text: `准备发送,共 ${totalChunks} 个数据包...`
});
for (let i = 0; i < totalChunks; i++) {
const start = i * CHUNK_SIZE;
const end = Math.min(start + CHUNK_SIZE, logicalPacketSize);
const chunk = logicalBuffer.slice(start, end);
updateLoading(these, {
text: `正在发送 ${i + 1} / ${totalChunks}`
});
await ble.sendData(f.deviceId, chunk, f.writeServiceId, f.wirteCharactId, 50);
await new Promise(resolve => setTimeout(resolve, 50)); // 包之间延迟
}
// 5. 发送成功处理
hideLoading(these);
this.showPop({
message: "发送成功",
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png",
@ -1680,9 +1596,6 @@
buttonBgColor: '#BBE600'
});
let json = {
deviceId: these.device.id,
name: these.formData.textLines[1],
@ -1690,17 +1603,18 @@
unitName: these.formData.textLines[2],
code: ""
};
usrApi.sendUsr(json)
} else {
usrApi.sendUsr(json);
} catch (ex) {
hideLoading(these);
this.showPop({
message: "出现异常发送失败",
message: "发送失败: " + (ex.msg || ex.message),
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
});
}
}
};
setTimeout(task, 0);
},
getDetail() {

View File

@ -165,15 +165,19 @@
},
onUnload() {
ble.StopSearch();
ble.removeAllCallback(pagePath);
if (ble) {
ble.StopSearch();
ble.removeAllCallback(pagePath);
}
},
onLoad(option) {
let search = option.search;
these = this;
eventChannel = this.getOpenerEventChannel();
const systemInfo = uni.getSystemInfoSync();
ble = bleTool.getBleTool(); // Ensure ble is initialized
if (systemInfo.uniPlatform == 'web') {
@ -216,7 +220,9 @@
}
let StartSubsrib = () => {
these.EquipMents = [];
ble = bleTool.getBleTool();
if (!ble) {
ble = bleTool.getBleTool();
}
//蓝牙不可用的回调
ble.addStateBreakCallback(res => {
if (these.Status.isPageHidden) {
@ -233,19 +239,6 @@
these.showOpenSetting();
}, pagePath);
//蓝牙再次可用的回调
ble.addStateRecoveryCallback(res => {
if (these.Status.isPageHidden) {
return;
}
uni.showToast({
icon: 'success',
title: '蓝牙恢复可用'
});
these.Status.BottomMenu.show = false;
these.EquipMents = [];
these.refreshBleList();
}, pagePath);
//蓝牙断开连接的回调
ble.addDisposeCallback(res => {
@ -262,107 +255,114 @@
}, pagePath);
//蓝牙连接已恢复的回调
ble.addRecoveryCallback(res => {
// --- Start: Logic for Pairing Mode Only ---
if (these.device) {
console.log("进入配对模式,启用连接恢复和验证逻辑。");
//蓝牙连接已恢复的回调
ble.addRecoveryCallback(res => {
if (these.Status.isPageHidden) {
return;
}
// hideLoading(these);
these.EquipMents.find(function(v, ind) {
if (v.deviceId == res.deviceId) {
these.PairEquip.push(v);
return true;
}
return false;
});
if (these.device) {
clearInterval(this.Status.intval);
showLoading(these, {
text: '蓝牙连接已恢复,正在验证设备'
});
setTimeout(() => {
these.DeviceVerdict(res.deviceId);
}, 0);
} else {
hideLoading(these);
}
}, pagePath);
//收到设备的消息回调
ble.addReceiveCallback((receivData, f, path, arr) => {
if (these.Status.isPageHidden) {
return;
}
if (f.macAddress && these.device) {
clearInterval(this.Status.intval);
this.Status.intval = null;
this.Status.time = null;
showLoading(these, {
text: '正在验证设备'
});
setTimeout(() => {
these.DeviceVerdict(f.deviceId);
}, 0);
}
}, pagePath);
}
// --- End: Logic for Pairing Mode Only ---
//搜索到新设备的回调 (Always active)
ble.addDeviceFound((arr) => {
console.log("--- 收到原始扫描数据 ---", JSON.stringify(arr));
if (these.Status.isPageHidden) {
return;
}
// hideLoading(these);
these.EquipMents.find(function(v, ind) {
if (v.deviceId == res.deviceId) {
these.PairEquip.push(v);
return true;
}
return false;
});
if (these.device) {
clearInterval(this.Status.intval);
showLoading(these, {
text: '蓝牙连接已恢复,正在验证设备'
});
setTimeout(() => {
these.DeviceVerdict(res.deviceId);
}, 0);
} else {
hideLoading(these);
}
}, pagePath);
//搜索到新设备的回调
ble.addDeviceFound((arr) => {
if (these.Status.isPageHidden) {
if (!arr || !arr.devices) {
return;
}
arr = arr.devices;
for (var i = 0; i < arr.length; i++) {
console.log(`本次扫描批次发现 ${arr.length} 个设备`);
arr[i].linkStatu = false;
if (!arr[i].name) {
continue;
}
for (var i = 0; i < arr.length; i++) {
let device = arr[i];
device.linkStatu = false;
let f = these.EquipMents.find((v, index) => {
if (v.deviceId == arr[i].deviceId) {
these.$set(these.EquipMents[index], 'RSSI', arr[i].RSSI);
if (v.deviceId == device.deviceId) {
console.log(`更新设备信号: ${device.name || device.deviceId}, RSSI: ${device.RSSI}`);
these.$set(these.EquipMents[index], 'RSSI', device.RSSI);
return true;
}
return false;
});
if (!f) {
console.log("发现新设备,", arr[i]);
console.log("+++ 发现新设备,准备添加到列表:", JSON.stringify(device));
if (these.device && these.device.bluetoothName) {
if (these.device.bluetoothName === arr[i].name || arr[i].name.indexOf(these
.device.bluetoothName) > -1 || these.device.bluetoothName.indexOf(arr[
i].name) > -1) {
arr[i].isTarget = true;
if (these.device && these.device.bluetoothName && device.name) {
if (these.device.bluetoothName === device.name || (device.name && device.name.indexOf(these
.device.bluetoothName) > -1) || (device.name && this.device.bluetoothName.indexOf(
device.name) > -1)) {
device.isTarget = true;
}
}
arr[i].name = arr[i].name.replace('JQZM-', '');
these.EquipMents.push(arr[i]);
if (device.name) {
device.name = device.name.replace('JQZM-', '');
}
these.EquipMents.push(device);
}
}
// console.log("EquipMents=", these.EquipMents)
}, pagePath);
//收到设备的消息回调
ble.addReceiveCallback((receivData, f, path, arr) => {
if (these.Status.isPageHidden) {
return;
}
if (f.macAddress && these.device) {
clearInterval(this.Status.intval);
this.Status.intval = null;
this.Status.time = null;
showLoading(these, {
text: '正在验证设备'
});
setTimeout(() => {
these.DeviceVerdict(f.deviceId);
}, 0);
}
}, pagePath);
}
if (search) {
StartSubsrib();
}
StartSubsrib();
eventChannel.on('detailData', function(rec) {
console.log("接收到父页面的参数:", rec);
these.device = rec.data;
StartSubsrib();
these.refreshBleList();
});
@ -373,41 +373,92 @@
this.refreshBleList();
},
methods: {
refreshBleList() {
if (!ble) {
checkAndRequestLocationPermission() {
return new Promise((resolve) => {
if (uni.getSystemInfoSync().platform !== 'android') {
return resolve(true);
}
plus.android.requestPermissions(
['android.permission.ACCESS_FINE_LOCATION'],
(result) => {
if (result.granted.length > 0) {
console.log('定位权限已授予');
resolve(true);
} else {
console.warn('定位权限被拒绝');
uni.showModal({
title: '权限提醒',
content: '为了正常扫描蓝牙设备,需要您开启定位权限',
showCancel: false,
success: () => {
uni.openSetting(); // 引导用户去设置页
}
});
resolve(false);
}
},
(error) => {
console.error('请求定位权限失败:', error);
uni.showToast({
title: '权限请求异常',
icon: 'none'
});
resolve(false);
}
);
resolve(true);
});
},
async refreshBleList() {
const hasPermission = await this.checkAndRequestLocationPermission();
if (!hasPermission) {
console.log("缺少定位权限,已中止蓝牙扫描。");
return;
}
let promis = [];
for (let index = 0; index < this.PairEquip.length; index++) {
let item = this.PairEquip[index];
promis.push(ble.disconnectDevice(item.deviceId));
if (!ble) {
ble = bleTool.getBleTool();
if (!ble) {
console.error("BLE helper not initialized!");
return;
}
}
Promise.allSettled(promis).finally(() => {
ble.StopSearch().finally(res => {
console.log("停止搜索成功");
ble.StopSearch().finally(() => {
let disconnectPromises = [];
if (ble.data && ble.data.LinkedList) {
ble.data.LinkedList.forEach(device => {
console.log(`Requesting disconnect for ${device.deviceId}`);
disconnectPromises.push(ble.disconnectDevice(device.deviceId));
});
}
Promise.allSettled(disconnectPromises).finally(() => {
these.EquipMents = [];
these.PairEquip = [];
ble.StartSearch().then(result => {
console.log("开始搜索成功");
console.log("Fresh scan started successfully.");
}).catch(err => {
console.error("开始搜索失败,err=", err);
if (err.code === 10001) {
console.error("Failed to start fresh scan:", err);
if (err.code === 10001) {
these.showOpenSetting();
} else {
uni.showModal({
title: '提示',
content: '出现异常:' + err.msg
content: '开始搜索失败:' + err.msg
});
}
});
}).catch(ex => {
console.error("ex=", ex);
});
});
},
isItemLink: function(item, index) {
let src = '/static/images/BLEAdd/noLink.png';