蓝牙模块添加在web平台默认成功方便调试功能,4877功能完成

This commit is contained in:
liub
2025-10-27 10:52:17 +08:00
parent d37ccfeabc
commit 61ed91695f
13 changed files with 575 additions and 318 deletions

View File

@ -192,7 +192,7 @@
data() {
return {
Status: {
pageHide: false,
Pop: {
showPop: false, //是否显示弹窗
popType: 'custom',
@ -345,10 +345,10 @@
these.formData.blename = f.name ? f.name : "Unname";
these.formData.deviceName = device.deviceName;
these.formData.img = device.devicePic;
these.formData.bleStatu=false;
these.formData.bleStatu = false;
these.formData.deviceId = f.deviceId;
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res=>{
these.formData.bleStatu=true;
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
these.formData.bleStatu = true;
});
these.setBleFormData();
these.getDetail();
@ -490,9 +490,12 @@
return className;
},
bleValueNotify: function(receive, device, path,recArr) { //订阅消息
bleValueNotify: function(receive, device, path, recArr) { //订阅消息
if (receive.deviceId !== this.formData.deviceId) {
return;
}
console.log("收到设备的数据", receive)
let data = recei.ReceiveData(receive, device, pagePath,recArr);
let data = recei.ReceiveData(receive, device, pagePath, recArr);
if (data) {
if ("staBlue_picture" in data) {
@ -559,7 +562,7 @@
getDetail() {
var that = this;
usrApi.getDetail(this.device.id).then(res => {
console.log("res=",res);
console.log("res=", res);
if (res && res.code == 200) {
res = res.data;
let personnelInfo = res.personnelInfo;
@ -684,7 +687,7 @@ console.log("res=",res);
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#FFFFFFde',
buttonTextColor: '#232323de',
okCallback: function() {
uni.navigateTo({
@ -692,7 +695,7 @@ console.log("res=",res);
events: {
BindOver: function(data) {
console.log(data)
these.formData.bleStatu=true;
these.formData.bleStatu = true;
}
},
success: function(res) {
@ -1261,17 +1264,47 @@ console.log("res=",res);
}
},
showPop: function(option) {
hideLoading(this);
let def = {
showPop: true, //是否显示弹窗
popType: 'custom',
bgColor: '#383934bd',
borderColor: '#BBE600',
textColor: '#ffffffde',
buttonBgColor: '#BBE600',
buttonTextColor: '#232323DE',
iconUrl: '',
message: '',
buttonText: '确定',
clickEvt: '',
visiblePrompt: false,
promptTitle: '',
modelValue: '',
visibleClose: false,
okCallback: null,
showSlot: false,
buttonCancelText: '',
showCancel: false,
}
if (!option) {
option = {
a: 1
};
}
let keys = Object.keys(option);
for (var i = 0; i < keys.length; i++) {
let keys = Object.keys(def);
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
these.Status.Pop[key] = option[key];
if (key in option) {
continue;
}
this.Status.Pop[key] = def[key];
}
if (option) {
keys = Object.keys(option);
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
this.Status.Pop[key] = option[key];
}
}
if (!option.borderColor) {
option.borderColor = '#BBE600';
option.buttonBgColor = '#BBE600';