diff --git a/pages/008A/HBY008A.vue b/pages/008A/HBY008A.vue
index 62dd1e5..341942d 100644
--- a/pages/008A/HBY008A.vue
+++ b/pages/008A/HBY008A.vue
@@ -379,6 +379,12 @@
these.formData.deviceId = v.deviceId;
return true;
}
+ if(v.device){
+ if(v.device.id==device.id){
+ these.formData.deviceId = v.deviceId;
+ return true;
+ }
+ }
return false;
});
if (!f) {
@@ -603,14 +609,24 @@
},
getDevice: function() {
+
let f = ble.data.LinkedList.find((v) => {
- return v.macAddress == these.device.deviceMac;
+ let flag=v.macAddress == these.device.deviceMac ;
+ if(!flag && v.device){
+ flag= v.device.id==these.device.id;
+ }
+ if(flag){
+ these.formData.deviceId = v.deviceId;
+ }
+ return flag;
});
+
// #ifdef WEB
f = {
deviceId: '123'
}
// #endif
+
return f;
},
showBleUnConnect() {
diff --git a/pages/018A/HBY018A.vue b/pages/018A/HBY018A.vue
index 21fcd0e..250495e 100644
--- a/pages/018A/HBY018A.vue
+++ b/pages/018A/HBY018A.vue
@@ -1160,15 +1160,24 @@
},
getDevice: function() {
- // console.log("LinkedList=", ble.data.LinkedList);
- // console.log("formData=", these.formData);
- let f = ble.data.LinkedList.find((v) => {
- return v.macAddress == these.device.deviceMac;
- });
- if (f) {
- this.formData.deviceId = f.deviceId;
+ let f = ble.data.LinkedList.find((v) => {
+ let flag=v.macAddress == these.device.deviceMac ;
+ if(!flag && v.device){
+ flag= v.device.id==these.device.id;
}
- return f;
+ if(flag){
+ these.formData.deviceId = v.deviceId;
+ }
+ return flag;
+ });
+
+ // #ifdef WEB
+ f = {
+ deviceId: '123'
+ }
+ // #endif
+
+ return f;
},
diff --git a/pages/100/HBY100.vue b/pages/100/HBY100.vue
index da4a35d..afab1ee 100644
--- a/pages/100/HBY100.vue
+++ b/pages/100/HBY100.vue
@@ -509,14 +509,7 @@
}
});
}
- let f = ble.data.LinkedList.find((v) => {
- if (v.macAddress == device.deviceMac) {
- // console.log("找到设备了", v);
- these.formData.deviceId = v.deviceId;
- return true;
- }
- return false;
- });
+ let f =this.getDevice();
if (!f) {
@@ -1300,12 +1293,23 @@ onFreqChanging(e){
},
getDevice: function() {
- // console.log("LinkedList=", ble.data.LinkedList);
- // console.log("formData=", these.formData);
let f = ble.data.LinkedList.find((v) => {
- return v.macAddress == these.device.deviceMac;
+ let flag=v.macAddress == these.device.deviceMac ;
+ if(!flag && v.device){
+ flag= v.device.id==these.device.id;
+ }
+ if(flag){
+ these.formData.deviceId = v.deviceId;
+ }
+ return flag;
});
-
+
+ // #ifdef WEB
+ f = {
+ deviceId: '123'
+ }
+ // #endif
+
return f;
},
diff --git a/pages/100Y/HBY100Y.vue b/pages/100Y/HBY100Y.vue
index ac9ca0f..7eb7eac 100644
--- a/pages/100Y/HBY100Y.vue
+++ b/pages/100Y/HBY100Y.vue
@@ -43,7 +43,7 @@
设备名称
{{device.deviceName}}
-
+
Mac地址
@@ -62,9 +62,9 @@
{{formData.sta_system}}
-
+
-
+
@@ -97,7 +97,7 @@
var ble = null;
var recei = null;
var mq = null;
- var pagePath=null;
+ var pagePath = null;
export default {
data() {
@@ -193,11 +193,11 @@
onUnload() {
console.log("页面卸载,释放资源");
let statusTopic = `A/${this.formData.imei?this.formData.imei:this.device.deviceImei}`;
- if(ble){
- ble.removeAllCallback(pagePath);
- ble.removeReceiveCallback(pagePath);
+ if (ble) {
+ ble.removeAllCallback(pagePath);
+ ble.removeReceiveCallback(pagePath);
}
-
+
if (mq) {
mq.unsubscribe(statusTopic);
mq.disconnect();
@@ -213,7 +213,7 @@
},
onLoad() {
-
+
these = this;
recei = BleReceive.getBleReceive();
ble = BleTool.getBleTool();
@@ -248,14 +248,7 @@
if (these.device.deviceImei) {
these.initMQ();
}
- let f = ble.data.LinkedList.find((v) => {
- if (v.macAddress == device.deviceMac) {
- console.log("找到设备了", v);
- these.formData.deviceId = v.deviceId;
- return true;
- }
- return false;
- });
+ let f =these.getDevice();
if (!f) {
these.showBleUnConnect();
these.getDetail();
@@ -282,7 +275,7 @@
these.formData.bleStatu = true;
}).catch(ex => {
these.formData.bleStatu = 'err';
- MsgError("连接错误:" + ex.msg, "确定", these);
+ MsgError("连接错误:" + ex.msg, "确定", these);
});
});
@@ -309,7 +302,7 @@
these.formData.bleStatu = true;
}).catch(ex => {
these.formData.bleStatu = 'err';
- MsgError("连接错误:" + ex.msg, "确定", these);
+ MsgError("连接错误:" + ex.msg, "确定", these);
});
return;
}
@@ -377,7 +370,7 @@
}
if (res.deviceId == these.formData.deviceId) {
this.formData.bleStatu = true;
-
+
}
},
@@ -433,8 +426,8 @@
updateLoading(these, {
text: ex.msg
})
- these.formData.bleStatu = 'err';
- MsgError("连接错误:" + ex.msg, "确定", these);
+ these.formData.bleStatu = 'err';
+ MsgError("连接错误:" + ex.msg, "确定", these);
}).finally(() => {
setTimeout(() => {
hideLoading(these);
@@ -442,7 +435,7 @@
});
},
-
+
prevPage() {
uni.navigateBack({
@@ -472,7 +465,27 @@
})
}
},
+ getDevice: function() {
+ let f = ble.data.LinkedList.find((v) => {
+ let flag = v.macAddress == these.device.deviceMac;
+ if (!flag && v.device) {
+ flag = v.device.id == these.device.id;
+ }
+ if (flag) {
+ these.formData.deviceId = v.deviceId;
+ }
+ return flag;
+ });
+
+ // #ifdef WEB
+ f = {
+ deviceId: '123'
+ }
+ // #endif
+
+ return f;
+ }
}
}
diff --git a/pages/102/HBY102.vue b/pages/102/HBY102.vue
index 67bc673..2a1623c 100644
--- a/pages/102/HBY102.vue
+++ b/pages/102/HBY102.vue
@@ -459,14 +459,7 @@ created() {
}
these.device = device;
these.getWarns();
- let f = ble.data.LinkedList.find((v) => {
- if (v.macAddress == device.deviceMac) {
- // console.log("找到设备了", v);
- these.formData.deviceId = v.deviceId;
- return true;
- }
- return false;
- });
+ let f = these.getDevice();
if (!f) {
@@ -1304,13 +1297,27 @@ created() {
},
getDevice: function() {
- // console.log("LinkedList=", ble.data.LinkedList);
- // console.log("formData=", these.formData);
- let f = ble.data.LinkedList.find((v) => {
- return v.macAddress == these.device.deviceMac;
- });
-
- return f;
+
+
+ let f = ble.data.LinkedList.find((v) => {
+ let flag=v.macAddress == these.device.deviceMac ;
+ if(!flag && v.device){
+ flag= v.device.id==these.device.id;
+ }
+ if(flag){
+ these.formData.deviceId = v.deviceId;
+ }
+ return flag;
+ });
+
+ // #ifdef WEB
+ f = {
+ deviceId: '123'
+ }
+ // #endif
+
+ return f;
+
},
bleStatuToggle() {
diff --git a/pages/102J/HBY102J.vue b/pages/102J/HBY102J.vue
index d0f4b75..8688bf7 100644
--- a/pages/102J/HBY102J.vue
+++ b/pages/102J/HBY102J.vue
@@ -465,14 +465,7 @@
}
these.device = device;
these.getWarns();
- let f = ble.data.LinkedList.find((v) => {
- if (v.macAddress == device.deviceMac) {
- // console.log("找到设备了", v);
- these.formData.deviceId = v.deviceId;
- return true;
- }
- return false;
- });
+ let f = these.getDevice();
if (!f) {
@@ -1328,12 +1321,23 @@
},
getDevice: function() {
- // console.log("LinkedList=", ble.data.LinkedList);
- // console.log("formData=", these.formData);
let f = ble.data.LinkedList.find((v) => {
- return v.macAddress == these.device.deviceMac;
+ let flag=v.macAddress == these.device.deviceMac ;
+ if(!flag && v.device){
+ flag= v.device.id==these.device.id;
+ }
+ if(flag){
+ these.formData.deviceId = v.deviceId;
+ }
+ return flag;
});
-
+
+ // #ifdef WEB
+ f = {
+ deviceId: '123'
+ }
+ // #endif
+
return f;
},
diff --git a/pages/210/HBY210.vue b/pages/210/HBY210.vue
index 1218b02..2c5ae28 100644
--- a/pages/210/HBY210.vue
+++ b/pages/210/HBY210.vue
@@ -96,7 +96,7 @@
M
-
+
S
@@ -562,14 +562,7 @@
if (these.device.deviceImei) {
these.initMQ();
}
- let f = ble.data.LinkedList.find((v) => {
- if (v.macAddress == device.deviceMac) {
- console.log("找到设备了", v);
- these.formData.deviceId = v.deviceId;
- return true;
- }
- return false;
- });
+ let f = these.getDevice();
if (!f) {
these.showBleUnConnect();
these.getDetail();
@@ -1277,9 +1270,9 @@
if (!batchTool) {
batchTool = new SendBatchData(these, f, ble);
}
- console.log("batch",batchTool);
+ console.log("batch", batchTool);
// batchTool.SendUsr(4);
- let txts=[these.formData.company, these.formData.name, these.formData.job,this.formData.id]
+ let txts = [these.formData.company, these.formData.name, these.formData.job, this.formData.id]
batchTool.sendUsrByGBK(txts);
return;
@@ -1382,15 +1375,15 @@
let json = {
ins_Ms: newVal
};
-
-
+
+
console.log("new=", this.formData.sta_Ms);
these.setBleFormData();
console.log("these.formData.sta_Ms=" + these.formData.sta_Ms);
if (ble && f) {
- ble.sendString(f.deviceId, json).then(res=>{
+ ble.sendString(f.deviceId, json).then(res => {
these.formData.sta_Ms = newVal;
}).catch(ex => {
these.mqSend(json);
@@ -1467,19 +1460,23 @@
});
},
getDevice: function() {
-
- let f ={deviceId:'123'};
- // #ifdef APP
- f= ble.data.LinkedList.find((v) => {
- if (v.macAddress == these.device.deviceMac) {
- if (!this.formData.deviceId) {
- this.formData.deviceId = v.deviceId
- };
- return true;
+
+ let f = ble.data.LinkedList.find((v) => {
+ let flag = v.macAddress == these.device.deviceMac;
+ if (!flag && v.device) {
+ flag = v.device.id == these.device.id;
}
+ if (flag) {
+ these.formData.deviceId = v.deviceId;
+ }
+ return flag;
});
- // #endif
-
+
+ // #ifdef WEB
+ f = {
+ deviceId: '123'
+ }
+ // #endif
return f;
},
@@ -1526,25 +1523,25 @@
if (!batchTool) {
batchTool = new SendBatchData(these, f, ble);
}
-
- batchTool.SendMsgByGBK(this.formData.textLines,mq);
+
+ batchTool.SendMsgByGBK(this.formData.textLines, mq);
return;
-
-
+
+
showLoading(this, {
text: "发送中"
});
//握手
let holdHand = (hexs, time) => {
return new Promise((resolve, reject) => {
-
-
+
+
setTimeout(() => {
resolve(true)
}, time);
});
}
-
+
//发送3个分包的数据
let task = (allPixels) => {
try {
@@ -1641,7 +1638,7 @@
}, 500);
return;
}
-
+
console.log("开始发送数据包");
task(results[1].value);
})
@@ -1756,7 +1753,7 @@
}
if (res.deviceId == these.formData.deviceId) {
this.formData.bleStatu = true;
-
+
}
},
diff --git a/pages/4877/BJQ4877.vue b/pages/4877/BJQ4877.vue
index 02cc5fa..464a58c 100644
--- a/pages/4877/BJQ4877.vue
+++ b/pages/4877/BJQ4877.vue
@@ -109,7 +109,7 @@
-
+
@@ -324,7 +324,7 @@
apiType: 'listA'
}],
title: 'BJQ4877',
- height:90
+ height: 90
},
ShowEditChannel: false,
@@ -448,8 +448,8 @@
},
}
},
- created() {
- this.Status.navbar.height = uni.getSystemInfoSync().statusBarHeight + 44;
+ created() {
+ this.Status.navbar.height = uni.getSystemInfoSync().statusBarHeight + 44;
},
onUnload() {
console.log("页面卸载,释放资源");
@@ -531,14 +531,7 @@
});
})
- let f = ble.data.LinkedList.find((v) => {
- if (v.macAddress == device.deviceMac) {
- // console.log("找到设备了", v);
- these.formData.deviceId = v.deviceId;
- return true;
- }
- return false;
- });
+ let f = these.getDevice();
if (!f) {
@@ -1014,21 +1007,21 @@
this.Status.sendDisc = true;
let sendNextPacket = () => {
- if(index>total){
+ if (index > total) {
this.Status.sendDisc = false;
-
+
return;
}
ble.sendString(f.deviceId, json, f.writeServiceId, f.wirteCharactId, 30).then(res => {
index++;
- setTimeout(sendNextPacket,300);
+ setTimeout(sendNextPacket, 300);
}).catch(err => {
if (err.code == '10007') {
setTimeout(sendNextPacket, 800);
return;
}
- if(index==0){
- MsgError(err.msg,'',these);
+ if (index == 0) {
+ MsgError(err.msg, '', these);
}
this.Status.sendDisc = false;
});
@@ -1122,7 +1115,7 @@
}
if (res.deviceId == these.formData.deviceId) {
this.formData.bleStatu = true;
-
+
}
},
@@ -1271,12 +1264,23 @@
},
getDevice: function() {
- console.log("LinkedList=", ble.data.LinkedList);
- console.log("formData=", these.device);
let f = ble.data.LinkedList.find((v) => {
- return v.macAddress == these.device.deviceMac;
+ let flag = v.macAddress == these.device.deviceMac;
+ if (!flag && v.device) {
+ flag = v.device.id == these.device.id;
+ }
+ if (flag) {
+ these.formData.deviceId = v.deviceId;
+ }
+ return flag;
});
+ // #ifdef WEB
+ f = {
+ deviceId: '123'
+ }
+ // #endif
+
return f;
},
@@ -1614,7 +1618,8 @@
border-color: #aed600 !important;
}
- .lampMode .mode.active .bigTxt,.lampMode .mode.active .smallTxt {
+ .lampMode .mode.active .bigTxt,
+ .lampMode .mode.active .smallTxt {
color: #aed600 !important;
}
diff --git a/pages/6075J/BJQ6075J.vue b/pages/6075J/BJQ6075J.vue
index c530287..7ba3a54 100644
--- a/pages/6075J/BJQ6075J.vue
+++ b/pages/6075J/BJQ6075J.vue
@@ -260,7 +260,7 @@
baseURL
} from '@/utils/request.js';
import {
- showLoading,
+ showLoading,
hideLoading,
updateLoading
} from '@/utils/loading.js';
@@ -295,7 +295,7 @@
},
data() {
return {
- Status: {
+ Status: {
pageHide: false,
@@ -502,7 +502,7 @@
these = this;
this.initActionData();
-
+
@@ -1110,13 +1110,13 @@
if (combinedData.length === curr - 1) {
- Common.saveDeviceLog({
- deviceId: this.device.id,
- name: '发送紧急通知',
- sendMsg: this.formData.sendMsg.trim()
- }).catch(ex => {
+ Common.saveDeviceLog({
+ deviceId: this.device.id,
+ name: '发送紧急通知',
+ sendMsg: this.formData.sendMsg.trim()
+ }).catch(ex => {
- });
+ });
holdHand('transmit complete', 200).then(res => {
MsgSuccess("消息发送成功", "确定", these);
@@ -1137,7 +1137,7 @@
console.log("发送成功", curr);
setTimeout(sendPacket, 1000);
-
+
}).catch(err => {
if (err.code == '10007') {
@@ -1282,17 +1282,23 @@
},
getDevice: function() {
- console.log("LinkedList=", ble.data.LinkedList);
- console.log("this.device=", this.device);
let f = ble.data.LinkedList.find((v) => {
- if (v.macAddress == these.device.deviceMac) {
- if (!this.formData.deviceId) {
- this.formData.deviceId = v.deviceId
- };
- return true;
+ let flag = v.macAddress == these.device.deviceMac;
+ if (!flag && v.device) {
+ flag = v.device.id == these.device.id;
}
+ if (flag) {
+ these.formData.deviceId = v.deviceId;
+ }
+ return flag;
});
+ // #ifdef WEB
+ f = {
+ deviceId: '123'
+ }
+ // #endif
+
return f;
},
showBleUnConnect() {
@@ -1430,7 +1436,7 @@
this.formData.bleStatu = true;
batchTool = new SendBatchData(this, res, ble);
-
+
}
},
@@ -1524,7 +1530,8 @@
},
gotoMap() {
let promise = Promise.resolve([this.formData.sta_longitude, this.formData
- .sta_latitude]); //lnglatConvert.wgs84_to_gcj02(this.formData.sta_longitude, this.formData.sta_latitude);
+ .sta_latitude
+ ]); //lnglatConvert.wgs84_to_gcj02(this.formData.sta_longitude, this.formData.sta_latitude);
promise.then(lnglat => {
this.detailData.longitude = lnglat[0];
diff --git a/pages/6107/BJQ6107.vue b/pages/6107/BJQ6107.vue
index 90b2e27..1d371ee 100644
--- a/pages/6107/BJQ6107.vue
+++ b/pages/6107/BJQ6107.vue
@@ -75,12 +75,12 @@
+ :class="{'active':formData.sta_highSpeed && formData.sta_LedType===item.key}">
强光
+ :class="{'active':formData.sta_highSpeed===false && formData.sta_LedType===item.key}">
工作光
@@ -94,7 +94,7 @@
+ mode="aspectFit">
@@ -115,9 +115,9 @@
+ mode="aspectFit">
+ src="/static/images/common/playingActive.png" mode="aspectFit">
{{formData.isPlay?'正在播放':'播放语音'}}
@@ -184,14 +184,14 @@
-
+
+ :borderColor="item.borderColor" :textColor="item.textColor" :buttonBgColor="item.buttonBgColor"
+ :buttonTextColor="item.buttonTextColor" :iconUrl="item.iconUrl" :message="item.message"
+ :buttonText="item.buttonText" @buttonClick="item.okCallback(item)" :visiblePrompt="item.visiblePrompt"
+ :promptTitle="item.promptTitle" v-model="item.modelValue" @closePop="closePop(item)"
+ :buttonCancelText="item.buttonCancelText" :showCancel="item.showCancel" @cancelPop="closePop(item)" />
@@ -205,7 +205,7 @@
@@ -218,8 +218,8 @@
+ backgroundColor="#686767" block-size="20" block-color="#ffffffde" @change="volumechange"
+ @changing="volumechange" class="custom-slider" />
@@ -245,13 +245,13 @@
} from '@/utils/request.js'
import Common from '@/utils/Common.js';
- import {
- MsgSuccess,
- MsgError,
- MsgClose,
- MsgWarning,
- showPop,
- MsgInfo
+ import {
+ MsgSuccess,
+ MsgError,
+ MsgClose,
+ MsgWarning,
+ showPop,
+ MsgInfo
} from '@/utils/MsgPops.js'
const pagePath = "/pages/018A/HBY018A";
@@ -377,14 +377,7 @@
// console.log("收到父页面的参数:" + JSON.stringify(data));
var device = data.data;
these.device = device;
- let f = ble.data.LinkedList.find((v) => {
- if (v.macAddress == device.deviceMac) {
- // console.log("找到设备了", v);
- these.formData.deviceId = v.deviceId;
- return true;
- }
- return false;
- });
+ let f = these.getDevice();
if (!f) {
@@ -407,10 +400,10 @@
these.formData.deviceId = f.deviceId;
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
these.formData.bleStatu = true;
- }).catch(ex => {
- these.formData.bleStatu = 'err';
- MsgError("连接错误:" + ex.msg, "确定", these);
- });;
+ }).catch(ex => {
+ these.formData.bleStatu = 'err';
+ MsgError("连接错误:" + ex.msg, "确定", these);
+ });;
these.setBleFormData();
@@ -424,17 +417,17 @@
},
onShow() {
this.Status.pageHide = false;
- let f = this.getDevice();
- if (f) {
- these.formData.bleStatu = 'connecting';
- ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
- console.log("连接成功")
- these.formData.bleStatu = true;
- }).catch(ex => {
- these.formData.bleStatu = 'err';
- MsgError("连接错误:" + ex.msg, "确定", these);
- });;
- }
+ let f = this.getDevice();
+ if (f) {
+ these.formData.bleStatu = 'connecting';
+ ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
+ console.log("连接成功")
+ these.formData.bleStatu = true;
+ }).catch(ex => {
+ these.formData.bleStatu = 'err';
+ MsgError("连接错误:" + ex.msg, "确定", these);
+ });;
+ }
},
computed: {
@@ -555,7 +548,7 @@
buttonText: '确定',
buttonCancelText: '取消',
showCancel: true
- },these);
+ }, these);
} else {
exec();
}
@@ -582,7 +575,7 @@
this.formData.sta_highSpeed = flag;
},
LighSetting(item, index) { //灯光模式切换
-
+
let val = item.key;
if (item.key === this.formData.sta_LedType) {
val = 'led_off';
@@ -671,7 +664,7 @@
buttonText: '确定',
buttonCancelText: '取消',
showCancel: true
- },these);
+ }, these);
},
deviceRecovry(res) {
@@ -680,7 +673,7 @@
}
if (res.deviceId == these.formData.deviceId) {
this.formData.bleStatu = true;
-
+
}
},
@@ -731,7 +724,7 @@
updateLoading(these, {
text: ex.msg
});
- these.formData.bleStatu = 'err';
+ these.formData.bleStatu = 'err';
}).finally(() => {
setTimeout(() => {
hideLoading(these);
@@ -803,12 +796,23 @@
getDevice: function() {
- // console.log("LinkedList=", ble.data.LinkedList);
- // console.log("formData=", these.formData);
let f = ble.data.LinkedList.find((v) => {
- return v.macAddress == these.device.deviceMac;
+ let flag = v.macAddress == these.device.deviceMac;
+ if (!flag && v.device) {
+ flag = v.device.id == these.device.id;
+ }
+ if (flag) {
+ these.formData.deviceId = v.deviceId;
+ }
+ return flag;
});
+ // #ifdef WEB
+ f = {
+ deviceId: '123'
+ }
+ // #endif
+
return f;
},
@@ -834,7 +838,7 @@
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
- buttonTextColor: '#FFFFFFde',
+ buttonTextColor: '#FFFFFFde',
okCallback: function() {
uni.navigateTo({
@@ -856,10 +860,10 @@
}
})
}
- },these);
+ }, these);
},
-
+
//关闭某个弹窗,并执行关闭的回调函数
@@ -883,7 +887,7 @@
}
},
-
+
showMsg(msg, type) {
let cfg = {
@@ -922,7 +926,7 @@
buttonText: '确定',
okCallback: this.closePop
};
- showPop(options,these);
+ showPop(options, these);
}
}
}
@@ -1401,7 +1405,7 @@
text-align: left;
}
-
+
.slider-container {
@@ -1846,6 +1850,4 @@
.volMath {
color: rgba(174, 214, 0, 1);
}
-
-
\ No newline at end of file
diff --git a/pages/6155/BJQ6155.vue b/pages/6155/BJQ6155.vue
index a29102e..39de813 100644
--- a/pages/6155/BJQ6155.vue
+++ b/pages/6155/BJQ6155.vue
@@ -37,7 +37,8 @@
- {{formData.xuhang}}
+ {{formData.xuhang}}
+
续航时间
@@ -209,7 +210,7 @@
apiType: 'listA'
}],
title: 'BJQ6155',
- height:90
+ height: 90
},
lightMode: {
@@ -340,8 +341,8 @@
}
},
created() {
- this.Status.navbar.height = uni.getSystemInfoSync().statusBarHeight + 44;
- },
+ this.Status.navbar.height = uni.getSystemInfoSync().statusBarHeight + 44;
+ },
onUnload() {
ble.removeAllCallback(pagePath);
},
@@ -375,14 +376,7 @@
}
});
}
- let f = ble.data.LinkedList.find((v) => {
- if (v.macAddress == device.deviceMac) {
- // console.log("找到设备了", v);
- these.formData.deviceId = v.deviceId;
- return true;
- }
- return false;
- });
+ let f = these.getDevice();
if (!f) {
these.getDetail();
@@ -591,7 +585,7 @@
}
if (res.deviceId == these.formData.deviceId) {
this.formData.bleStatu = true;
-
+
}
},
@@ -665,12 +659,23 @@
})
},
getDevice: function() {
- // console.log("LinkedList=", ble.data.LinkedList);
- // console.log("formData=", these.formData);
let f = ble.data.LinkedList.find((v) => {
- return v.macAddress == these.device.deviceMac;
+ let flag = v.macAddress == these.device.deviceMac;
+ if (!flag && v.device) {
+ flag = v.device.id == these.device.id;
+ }
+ if (flag) {
+ these.formData.deviceId = v.deviceId;
+ }
+ return flag;
});
+ // #ifdef WEB
+ f = {
+ deviceId: '123'
+ }
+ // #endif
+
return f;
},
bleValueNotify: function(receive, device, path, recArr) {
@@ -1658,8 +1663,8 @@
unitName: these.formData.textLines[2],
code: ""
};
- usrApi.sendUsr(json).catch(ex=>{
- console.error("ex=",ex);
+ usrApi.sendUsr(json).catch(ex => {
+ console.error("ex=", ex);
});
hideLoading(these);
@@ -1743,12 +1748,14 @@
getDetail() {
var these = this;
usrApi.getDetail(this.device.id).then(res => {
-
+
if (res && res.code == 200) {
res = res.data;
let personnelInfo = res.personnelInfo;
- if (personnelInfo) {
- these.formData.textLines=[personnelInfo.position, personnelInfo.name,personnelInfo.unitName];
+ if (personnelInfo) {
+ these.formData.textLines = [personnelInfo.position, personnelInfo.name, personnelInfo
+ .unitName
+ ];
}
}
});
diff --git a/pages/6155/deviceDetail.vue b/pages/6155/deviceDetail.vue
index e8346b3..cca8eab 100644
--- a/pages/6155/deviceDetail.vue
+++ b/pages/6155/deviceDetail.vue
@@ -11,7 +11,7 @@
+ @click.stop="handleRightClick(item,index)" v-for="item,index in Status.navbar.icons">
{{item.math>9?'9+':item.math}}
@@ -75,8 +75,8 @@
+ backgroundColor="#00000000" block-size="20" block-color="#ffffffde" @change="sliderChange"
+ @changing="sliderChange" class="custom-slider" />
@@ -125,33 +125,33 @@
发送
+ :color="'#000000'" :fontSize="14" />
单位:
+ placeholder-class="usrplace" />
部门:
+ placeholder-class="usrplace" />
姓名:
+ placeholder-class="usrplace" />
-
+
+ @btnClick="btnClick">
@@ -181,14 +181,14 @@
} from '@/utils/request.js';
var pagePath = "/pages/6155/deviceDetail";
- import {
- MsgSuccess,
- MsgError,
- MsgClose,
- MsgWarning,
- showPop,
- MsgInfo
- } from '@/utils/MsgPops.js'
+ import {
+ MsgSuccess,
+ MsgError,
+ MsgClose,
+ MsgWarning,
+ showPop,
+ MsgInfo
+ } from '@/utils/MsgPops.js'
var ble = null;
var these = null;
@@ -212,7 +212,7 @@
apiType: 'listA'
}],
title: 'BJQ6155',
- height:90
+ height: 90
},
Pop: {
@@ -310,8 +310,8 @@
}
},
created() {
- this.Status.navbar.height = uni.getSystemInfoSync().statusBarHeight + 44;
- },
+ this.Status.navbar.height = uni.getSystemInfoSync().statusBarHeight + 44;
+ },
onUnload() {
ble.removeAllCallback(pagePath);
},
@@ -344,14 +344,7 @@
}
});
}
- let f = ble.data.LinkedList.find((v) => {
- if (v.macAddress == device.deviceMac) {
- console.log("找到设备了", v);
- these.formData.deviceId = v.deviceId;
- return true;
- }
- return false;
- });
+ let f = these.getDevice();
if (!f) {
these.getDetail();
@@ -374,10 +367,10 @@
these.formData.bleStatu = 'connecting';
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
these.formData.bleStatu = true;
- }).catch(ex => {
- these.formData.bleStatu = 'err';
- MsgError("连接错误:" + ex.msg, "确定", these);
- });
+ }).catch(ex => {
+ these.formData.bleStatu = 'err';
+ MsgError("连接错误:" + ex.msg, "确定", these);
+ });
these.setBleFormData();
these.getDetail();
@@ -390,18 +383,18 @@
},
onShow() {
this.Status.pageHide = false;
-
- let f=this.getDevice();
- if(f){
- these.formData.bleStatu = 'connecting';
- ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
- console.log("连接成功")
- these.formData.bleStatu = true;
- }).catch(ex => {
- these.formData.bleStatu = 'err';
- MsgError("连接错误:" + ex.msg, "确定", these);
- });;
- }
+
+ let f = this.getDevice();
+ if (f) {
+ these.formData.bleStatu = 'connecting';
+ ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
+ console.log("连接成功")
+ these.formData.bleStatu = true;
+ }).catch(ex => {
+ these.formData.bleStatu = 'err';
+ MsgError("连接错误:" + ex.msg, "确定", these);
+ });;
+ }
},
onBackPress(e) {
@@ -447,7 +440,7 @@
these.formData.bleStatu = true;
}).catch(ex => {
these.formData.bleStatu = 'err';
- MsgError("连接错误:" + ex.msg, "确定", these);
+ MsgError("连接错误:" + ex.msg, "确定", these);
});
return;
}
@@ -558,7 +551,7 @@
}
if (res.deviceId == these.formData.deviceId) {
this.formData.bleStatu = true;
-
+
}
},
@@ -567,9 +560,9 @@
// return;
// }
if (res.deviceId == these.formData.deviceId) {
- if(res.device){
+ if (res.device) {
these.formData.bleStatu = 'connecting';
- }else{
+ } else {
this.formData.bleStatu = false;
}
setTimeout(() => {
@@ -614,7 +607,7 @@
updateLoading(these, {
text: ex.msg
});
- these.formData.bleStatu = 'err';
+ these.formData.bleStatu = 'err';
}).finally(() => {
setTimeout(() => {
hideLoading(these);
@@ -632,12 +625,23 @@
})
},
getDevice: function() {
- // console.log("LinkedList=", ble.data.LinkedList);
- // console.log("formData=", these.formData);
let f = ble.data.LinkedList.find((v) => {
- return v.macAddress == these.device.deviceMac;
+ let flag = v.macAddress == these.device.deviceMac;
+ if (!flag && v.device) {
+ flag = v.device.id == these.device.id;
+ }
+ if (flag) {
+ these.formData.deviceId = v.deviceId;
+ }
+ return flag;
});
+ // #ifdef WEB
+ f = {
+ deviceId: '123'
+ }
+ // #endif
+
return f;
},
bleValueNotify: function(receive, device, path, recArr) {
@@ -678,7 +682,7 @@
}
},
-
+
showBleUnConnect() {
this.showPop({
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
@@ -686,7 +690,7 @@
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
- buttonTextColor: '#FFFFFFde',
+ buttonTextColor: '#FFFFFFde',
okCallback: function() {
// console.log("1111");
uni.navigateTo({
@@ -901,7 +905,7 @@
uni.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
- sourceType: ['album','camera'],
+ sourceType: ['album', 'camera'],
success: function(res) {
uni.navigateTo({
url: "/pages/common/ImgCrop/ImgCrop",
@@ -1594,7 +1598,7 @@
option.buttonBgColor = '#BBE600';
}
these.Status.Pop.showPop = true;
- showPop(option,this);
+ showPop(option, this);
},
sendUsr() {
@@ -2162,7 +2166,7 @@
text-align: left;
}
-
+
.slider-container {
diff --git a/pages/6170/deviceControl/index.vue b/pages/6170/deviceControl/index.vue
index cc3299e..9421884 100644
--- a/pages/6170/deviceControl/index.vue
+++ b/pages/6170/deviceControl/index.vue
@@ -557,14 +557,22 @@
if (ble) {
let f = ble.data.LinkedList.find((v) => {
- if (v.macAddress == this.itemInfo.deviceMac) {
- if (!this.formData.deviceId) {
- this.formData.deviceId = v.deviceId
- };
- return true;
+ let flag = v.macAddress == these.device.deviceMac;
+ if (!flag && v.device) {
+ flag = v.device.id == these.device.id;
}
+ if (flag) {
+ these.formData.deviceId = v.deviceId;
+ }
+ return flag;
});
+ // #ifdef WEB
+ f = {
+ deviceId: '123'
+ }
+ // #endif
+
return f;
}
return null;
@@ -692,7 +700,7 @@
deviceRecovry(res) {
console.log('蓝牙连接成功');
if (res.deviceId == this.formData.deviceId) {
- this.formData.bleStatu = true;
+ this.formData.bleStatu = true;
}
},
@@ -2117,14 +2125,7 @@
this.initBle();
console.log("ble=", ble);
- let f = ble.data.LinkedList.find((v) => {
- if (v.macAddress == this.itemInfo.deviceMac) {
- console.log("找到设备了", v);
- these.formData.deviceId = v.deviceId;
- return true;
- }
- return false;
- });
+ let f = these.getDevice();
if (f) {
these.formData.bleStatu = 'connecting';
diff --git a/pages/6331/BJQ6331.vue b/pages/6331/BJQ6331.vue
index ed94335..77ba10f 100644
--- a/pages/6331/BJQ6331.vue
+++ b/pages/6331/BJQ6331.vue
@@ -45,34 +45,34 @@
照明模式
亮度
+ :class="formData.lightCurr=='shuxie'?'active':'noActive'">亮度
+ :class="formData.lightCurr=='shuxie'?'active':''">
+ :src="formData.lightCurr=='shuxie'?'/static/images/6331/shuxieActive.png':'/static/images/6331/shuXie.png'"
+ mode="aspectFit">
书写
+ :src="formData.lightCurr=='work'?'/static/images/6331/workActive.png':'/static/images/6331/work.png'"
+ mode="aspectFit">
工作光
+ :src="formData.lightCurr=='jieN'?'/static/images/lightImg/jieNActive.png':'/static/images/lightImg/jieN.png'"
+ mode="aspectFit">
节能光
@@ -130,7 +130,7 @@
+ v-on:click.stop="audioManage()">
@@ -153,15 +153,15 @@
-
+
+ :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" :visiblePrompt="Status.Pop.visiblePrompt" :promptTitle="Status.Pop.promptTitle"
+ v-model="Status.Pop.modelValue" @closePop="closePop" :showSlot="Status.Pop.showSlot">
@@ -170,8 +170,8 @@
+ backgroundColor="#00000000" block-size="20" block-color="#ffffffde" @change="sliderChange"
+ @changing="sliderChange" class="custom-slider" />
@@ -183,8 +183,8 @@
+ backgroundColor="#00000000" block-size="20" block-color="#ffffffde" @change="sliderChange"
+ @changing="sliderChange" class="custom-slider" />
@@ -193,7 +193,7 @@
+ @btnClick="btnClick">
@@ -218,17 +218,19 @@
hideLoading,
updateLoading
} from '@/utils/loading.js'
-import request, { baseURL } from '@/utils/request.js';
+ import request, {
+ baseURL
+ } from '@/utils/request.js';
import usrApi from '@/api/670/HBY670.js';
- import {
- MsgSuccess,
- MsgError,
- MsgClose,
- MsgWarning,
- showPop,
- MsgInfo
- } from '@/utils/MsgPops.js'
+ import {
+ MsgSuccess,
+ MsgError,
+ MsgClose,
+ MsgWarning,
+ showPop,
+ MsgInfo
+ } from '@/utils/MsgPops.js'
const pagePath = "pages/6331/BJQ6331";
var ble = null;
@@ -360,14 +362,7 @@ import request, { baseURL } from '@/utils/request.js';
// console.log("收到父页面的参数:" + JSON.stringify(data));
var device = data.data;
these.device = device;
- let f = ble.data.LinkedList.find((v) => {
- if (v.macAddress == device.deviceMac) {
- // console.log("找到设备了", v);
- these.formData.deviceId = v.deviceId;
- return true;
- }
- return false;
- });
+ let f = these.getDevice();
if (!f) {
@@ -388,15 +383,15 @@ import request, { baseURL } from '@/utils/request.js';
}
these.formData.blename = f.name ? f.name : "Unname";
these.formData.deviceName = device.deviceName;
-
+
these.formData.deviceId = f.deviceId;
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
these.formData.bleStatu = true;
- }).catch(ex => {
- these.formData.bleStatu = 'err';
- MsgError("连接错误:" + ex.msg, "确定", these);
- });;
+ }).catch(ex => {
+ these.formData.bleStatu = 'err';
+ MsgError("连接错误:" + ex.msg, "确定", these);
+ });;
these.setBleFormData();
these.getDetail();
@@ -409,17 +404,17 @@ import request, { baseURL } from '@/utils/request.js';
},
onShow() {
this.Status.pageHide = false;
- let f = this.getDevice();
- if (f) {
- these.formData.bleStatu = 'connecting';
- ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
- console.log("连接成功")
- these.formData.bleStatu = true;
- }).catch(ex => {
- these.formData.bleStatu = 'err';
- MsgError("连接错误:" + ex.msg, "确定", these);
- });;
- }
+ let f = this.getDevice();
+ if (f) {
+ these.formData.bleStatu = 'connecting';
+ ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
+ console.log("连接成功")
+ these.formData.bleStatu = true;
+ }).catch(ex => {
+ these.formData.bleStatu = 'err';
+ MsgError("连接错误:" + ex.msg, "确定", these);
+ });;
+ }
},
computed: {
@@ -467,7 +462,7 @@ import request, { baseURL } from '@/utils/request.js';
modelValue: '',
visibleClose: true,
okCallback: play
- },these);
+ }, these);
},
audioManage() { //语音管理
uni.navigateTo({
@@ -597,7 +592,7 @@ import request, { baseURL } from '@/utils/request.js';
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
- },these);
+ }, these);
});
},
@@ -608,7 +603,7 @@ import request, { baseURL } from '@/utils/request.js';
}
if (res.deviceId == these.formData.deviceId) {
this.formData.bleStatu = true;
-
+
}
},
@@ -617,9 +612,9 @@ import request, { baseURL } from '@/utils/request.js';
// return;
//}
if (res.deviceId == these.formData.deviceId) {
- if(res.device){
+ if (res.device) {
these.formData.bleStatu = 'connecting';
- }else{
+ } else {
this.formData.bleStatu = false;
}
setTimeout(() => {
@@ -663,7 +658,7 @@ import request, { baseURL } from '@/utils/request.js';
updateLoading(these, {
text: ex.msg
});
- these.formData.bleStatu = 'err';
+ these.formData.bleStatu = 'err';
}).finally(() => {
setTimeout(() => {
hideLoading(these);
@@ -693,12 +688,23 @@ import request, { baseURL } from '@/utils/request.js';
},
getDevice: function() {
- // console.log("LinkedList=", ble.data.LinkedList);
- // console.log("formData=", these.formData);
let f = ble.data.LinkedList.find((v) => {
- return v.macAddress == these.device.deviceMac;
+ let flag = v.macAddress == these.device.deviceMac;
+ if (!flag && v.device) {
+ flag = v.device.id == these.device.id;
+ }
+ if (flag) {
+ these.formData.deviceId = v.deviceId;
+ }
+ return flag;
});
+ // #ifdef WEB
+ f = {
+ deviceId: '123'
+ }
+ // #endif
+
return f;
},
getDetail() {
@@ -733,7 +739,7 @@ import request, { baseURL } from '@/utils/request.js';
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
- buttonTextColor: '#FFFFFFde',
+ buttonTextColor: '#FFFFFFde',
okCallback: function() {
uni.navigateTo({
@@ -755,7 +761,7 @@ import request, { baseURL } from '@/utils/request.js';
}
})
}
- },these);
+ }, these);
@@ -763,7 +769,7 @@ import request, { baseURL } from '@/utils/request.js';
},
-
+
closePop: function() {
this.Status.Pop.showPop = false;
@@ -1155,7 +1161,7 @@ import request, { baseURL } from '@/utils/request.js';
text-align: left;
}
-
+
.slider-container {
diff --git a/pages/650/HBY650.vue b/pages/650/HBY650.vue
index 73b7edc..f3cd574 100644
--- a/pages/650/HBY650.vue
+++ b/pages/650/HBY650.vue
@@ -10,7 +10,7 @@
+ @click.stop="handleRightClick(item,index)" v-for="item,index in Status.navbar.icons">
{{item.math>9?'9+':item.math}}
@@ -78,19 +78,19 @@
+ @click="MainModeSetting('smalllow','staticBattery')">
前置
+ @click="MainModeSetting('low','staticBattery')">
低档
+ @click="MainModeSetting('center','staticBattery')">
中档
+ @click="MainModeSetting('hight','staticBattery')">
高档
@@ -113,8 +113,7 @@
-
+
@@ -161,11 +160,11 @@
-
+
+ @btnClick="btnClick">
@@ -183,20 +182,22 @@
hideLoading,
updateLoading
} from '@/utils/loading.js'
-import request, { baseURL } from '@/utils/request.js';
+ import request, {
+ baseURL
+ } from '@/utils/request.js';
import usrApi from '@/api/670/HBY670.js';
- import {
- MsgSuccess,
- MsgError,
- MsgClose,
- MsgWarning,
- showPop,
- MsgInfo
- } from '@/utils/MsgPops.js'
+ import {
+ MsgSuccess,
+ MsgError,
+ MsgClose,
+ MsgWarning,
+ showPop,
+ MsgInfo
+ } from '@/utils/MsgPops.js'
const pagePath = "/pages/650/HBY650";
import SendBatchData from '@/utils/SendBatchData.js';
- var batchTool=null;
+ var batchTool = null;
var ble = null;
var these = null;
var recei = null;
@@ -212,20 +213,20 @@ import request, { baseURL } from '@/utils/request.js';
apiType: 'listA'
}],
title: 'HBY650'
-
+
},
pageHide: false,
-
+
BottomMenu: {
show: false,
showHeader: true,
menuItems: [{
- text: '照片',
- value:'img'
+ text: '照片',
+ value: 'img'
},
{
- text: '动画',
- value:'flash'
+ text: '动画',
+ value: 'flash'
}
],
activeIndex: -1,
@@ -296,8 +297,8 @@ import request, { baseURL } from '@/utils/request.js';
},
}
},
-created() {
- this.Status.navbar.height = uni.getSystemInfoSync().statusBarHeight + 44;
+ created() {
+ this.Status.navbar.height = uni.getSystemInfoSync().statusBarHeight + 44;
},
onUnload() {
console.log("页面卸载,释放资源");
@@ -334,14 +335,7 @@ created() {
}
});
}
- let f = ble.data.LinkedList.find((v) => {
- if (v.macAddress == device.deviceMac) {
- // console.log("找到设备了", v);
- these.formData.deviceId = v.deviceId;
- return true;
- }
- return false;
- });
+ let f = these.getDevice();
if (!f) {
@@ -363,13 +357,13 @@ created() {
these.formData.bleStatu = false;
these.formData.deviceId = f.deviceId;
- these.formData.bleStatu='connecting';
+ these.formData.bleStatu = 'connecting';
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
these.formData.bleStatu = true;
- }).catch(ex => {
- these.formData.bleStatu = 'err';
- MsgError("连接错误:" + ex.msg, "确定", these);
- });;
+ }).catch(ex => {
+ these.formData.bleStatu = 'err';
+ MsgError("连接错误:" + ex.msg, "确定", these);
+ });;
these.setBleFormData();
console.error("222222");
these.getDetail();
@@ -383,64 +377,64 @@ created() {
},
onShow() {
this.Status.pageHide = false;
-
- let f=this.getDevice();
- if(f){
- these.formData.bleStatu = 'connecting';
- ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
- console.log("连接成功")
- these.formData.bleStatu = true;
- }).catch(ex => {
- these.formData.bleStatu = 'err';
- MsgError("连接错误:" + ex.msg, "确定", these);
- });;
- }
+
+ let f = this.getDevice();
+ if (f) {
+ these.formData.bleStatu = 'connecting';
+ ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
+ console.log("连接成功")
+ these.formData.bleStatu = true;
+ }).catch(ex => {
+ these.formData.bleStatu = 'err';
+ MsgError("连接错误:" + ex.msg, "确定", these);
+ });;
+ }
},
computed: {
- getbleStatu(){
- if(this.formData.bleStatu===true){
- return '已连接';
- }
- if(this.formData.bleStatu==='connecting'){
- return '连接中';
- }
- if(this.formData.bleStatu==='dicconnect'){
- return '正在断开';
- }
- if(this.formData.bleStatu==='err'){
- return '连接异常';
- }
- return '未连接';
- }
+ getbleStatu() {
+ if (this.formData.bleStatu === true) {
+ return '已连接';
+ }
+ if (this.formData.bleStatu === 'connecting') {
+ return '连接中';
+ }
+ if (this.formData.bleStatu === 'dicconnect') {
+ return '正在断开';
+ }
+ if (this.formData.bleStatu === 'err') {
+ return '连接异常';
+ }
+ return '未连接';
+ }
},
methods: {
- bleStatuToggle(){
- let f=this.getDevice();
- if(!f){
- this.showBleUnConnect();
- return;
- }
- if(this.formData.bleStatu===true){
- this.formData.bleStatu='dicconnect';
- ble.disconnectDevice(f.deviceId).finally(r=>{
- this.formData.bleStatu=false;
- });
- return;
- }
-
- if(this.formData.bleStatu===false || this.formData.bleStatu==='err'){
- this.formData.bleStatu='connecting';
- ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
- these.formData.bleStatu = true;
- }).catch(ex=>{
- these.formData.bleStatu = 'err';
- MsgError("连接错误:" + ex.msg, "确定", these);
- });
- return;
- }
-
-
- },
+ bleStatuToggle() {
+ let f = this.getDevice();
+ if (!f) {
+ this.showBleUnConnect();
+ return;
+ }
+ if (this.formData.bleStatu === true) {
+ this.formData.bleStatu = 'dicconnect';
+ ble.disconnectDevice(f.deviceId).finally(r => {
+ this.formData.bleStatu = false;
+ });
+ return;
+ }
+
+ if (this.formData.bleStatu === false || this.formData.bleStatu === 'err') {
+ this.formData.bleStatu = 'connecting';
+ ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
+ these.formData.bleStatu = true;
+ }).catch(ex => {
+ these.formData.bleStatu = 'err';
+ MsgError("连接错误:" + ex.msg, "确定", these);
+ });
+ return;
+ }
+
+
+ },
handleRightClick(item, s) {
if (item && item.callback) {
item.callback(item, s);
@@ -448,7 +442,7 @@ created() {
uni.showModal({
content: '敬请期待'
})
-
+
}
},
navigatorBack() {
@@ -477,7 +471,7 @@ created() {
}
if (res.deviceId == these.formData.deviceId) {
this.formData.bleStatu = true;
-
+
}
},
@@ -486,9 +480,9 @@ created() {
// return;
// }
if (res.deviceId == these.formData.deviceId) {
- if(res.device){
+ if (res.device) {
these.formData.bleStatu = 'connecting';
- }else{
+ } else {
this.formData.bleStatu = false;
}
setTimeout(() => {
@@ -523,7 +517,7 @@ created() {
showLoading(this, {
text: "蓝牙恢复可用,正在连接设备"
});
- this.formData.bleStatu='connecting';
+ this.formData.bleStatu = 'connecting';
ble.LinkBlue(these.formData.deviceId).then(() => {
these.formData.bleStatu = true;
updateLoading(these, {
@@ -533,7 +527,7 @@ created() {
updateLoading(these, {
text: ex.msg
});
- MsgError("连接错误:" + ex.msg, "确定", these);
+ MsgError("连接错误:" + ex.msg, "确定", these);
}).finally(() => {
setTimeout(() => {
hideLoading(these);
@@ -624,7 +618,7 @@ created() {
iconUrl: "/static/images/6155/DeviceDetail/warnning.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
- },these);
+ }, these);
}
these.setBleFormData();
@@ -640,12 +634,23 @@ created() {
},
getDevice: function() {
- // console.log("LinkedList=", ble.data.LinkedList);
- // console.log("formData=", these.formData);
let f = ble.data.LinkedList.find((v) => {
- return v.macAddress == these.device.deviceMac;
+ let flag = v.macAddress == these.device.deviceMac;
+ if (!flag && v.device) {
+ flag = v.device.id == these.device.id;
+ }
+ if (flag) {
+ these.formData.deviceId = v.deviceId;
+ }
+ return flag;
});
+ // #ifdef WEB
+ f = {
+ deviceId: '123'
+ }
+ // #endif
+
return f;
},
getDetail() {
@@ -663,7 +668,7 @@ created() {
return;
}
}
-
+
});
},
@@ -681,9 +686,9 @@ created() {
uni.setStorageSync(ble.StorageKey, ble.data.LinkedList);
},
MainModeSetting: function(type, byteType) {
-
+
if (!this.permissions.includes('41') && this.Status.apiType !== 'listA') {
-
+
showPop({
message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png",
@@ -691,10 +696,10 @@ created() {
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
- },these)
+ }, these)
return;
}
-
+
if (this.formData.modeCurr == type) {
type = 'close';
}
@@ -769,7 +774,7 @@ created() {
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
- },these);
+ }, these);
}).finally(() => {
@@ -795,7 +800,7 @@ created() {
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
- buttonTextColor: '#FFFFFFde',
+ buttonTextColor: '#FFFFFFde',
okCallback: function() {
uni.navigateTo({
@@ -817,7 +822,7 @@ created() {
}
})
}
- },these);
+ }, these);
},
LampToggle: function() {
if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
@@ -829,39 +834,39 @@ created() {
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
- },these)
+ }, these)
return;
}
this.formData.cMode = !this.formData.cMode;
this.MainModeSetting(this.formData.cMode, "lamp");
},
-
+
checkImgUpload: function(type, index) {
let f = these.getDevice();
- if(!f){
+ if (!f) {
this.showBleUnConnect();
return;
}
-
- if(!batchTool){
- batchTool=new SendBatchData(these,f,ble);
+
+ if (!batchTool) {
+ batchTool = new SendBatchData(these, f, ble);
}
-
-
-
+
+
+
if (type) {
if (type == 'img') {
// sendImagePackets(index);
batchTool.SendImg();
- } else{
+ } else {
// sendVideoPackets(index);
batchTool.SendVideo(506);
}
-
+
}
return;
console.log("123213213213");
-
+
// 分包发送图片数据
var sendImagePackets = function(ReSendNo) {
@@ -886,7 +891,7 @@ created() {
showPop: true,
message: "上传成功",
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png",
- },these);
+ }, these);
if (!ReSendNo) {
setTimeout(() => {
these.HoldYouHand("transmit complete", 0, f
@@ -928,7 +933,7 @@ created() {
dataView.setUint8(2, currentPacket); // 包序号
- dataView.setUint16(3, packetData.length*2,false); // 包t长度
+ dataView.setUint16(3, packetData.length * 2, false); // 包t长度
// 填充数据(每个RGB565值占2字节)
for (let i = 0; i < packetData.length; i++) {
@@ -971,7 +976,7 @@ created() {
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
- },these);
+ }, these);
hideLoading(these);
reject(err);
});
@@ -992,7 +997,7 @@ created() {
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
- },these);
+ }, these);
hideLoading(these);
reject(err);
});
@@ -1068,7 +1073,7 @@ created() {
showPop: true,
message: "上传成功",
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png"
- },these);
+ }, these);
@@ -1145,7 +1150,7 @@ created() {
buttonBgColor: "#E03434",
buttonText: "确定",
iconUrl: "/static/images/common/uploadErr.png"
- },these);
+ }, these);
reject(err);
return;
}
@@ -1245,7 +1250,7 @@ created() {
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
- },these);
+ }, these);
}
}).catch((ex) => {
@@ -1256,7 +1261,7 @@ created() {
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
- },these);
+ }, these);
})
}
let f = these.getDevice();
@@ -1320,9 +1325,9 @@ created() {
},
ShowUpload: function() {
-
+
if (!this.permissions.includes('3') && this.Status.apiType !== 'listA') {
-
+
showPop({
message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png",
@@ -1330,14 +1335,14 @@ created() {
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
- },these)
+ }, these)
return;
}
//上传开机画面
this.Status.BottomMenu.title = "上传开机画面";
this.Status.BottomMenu.type = "checkImg";
this.Status.BottomMenu.show = true;
- this.Status.BottomMenu.activeIndex=0;
+ this.Status.BottomMenu.activeIndex = 0;
},
showMenu(flag) {
@@ -1348,7 +1353,7 @@ created() {
},
btnClick(item, index) {
this.Status.BottomMenu.show = false;
- this.checkImgUpload(item.value,index);
+ this.checkImgUpload(item.value, index);
},
@@ -1360,11 +1365,11 @@ created() {
},
handleItemClick(item, index) {
-
+
this.Status.BottomMenu.activeIndex = index;
},
-
+
sendUsr: function(ReSendNo) {
if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') {
@@ -1376,7 +1381,7 @@ created() {
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
- },these)
+ }, these)
return;
}
@@ -1436,7 +1441,7 @@ created() {
promptTitle: '',
modelValue: '',
visibleClose: true
- },these);
+ }, these);
these.setBleFormData();
@@ -1499,7 +1504,7 @@ created() {
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
- },these);
+ }, these);
}).finally(() => {
hideLoading(these);
});
@@ -1533,7 +1538,7 @@ created() {
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
- },these);
+ }, these);
});
}, 0);
@@ -1909,7 +1914,7 @@ created() {
text-align: left;
}
-
+
.slider-container {
padding: 0px;
@@ -2104,27 +2109,27 @@ created() {
.net.active {
background: #FFFFFF !important;
}
-
-
+
+
.navbarRight {
width: 40px;
height: 100%;
-
+
}
-
+
.navbarRight .imgContent {
width: 36rpx;
height: 36rpx;
position: relative;
}
-
+
.navbarRight .imgContent:first-child {
-
+
width: 38rpx !important;
height: 38rpx !important;
margin-top: -2rpx;
}
-
+
.navbarRight .imgContent .baber {
position: absolute;
z-index: 100;
@@ -2140,33 +2145,33 @@ created() {
font-style: Regular;
font-size: 20rpx;
font-weight: 400;
-
+
text-align: center;
overflow: hidden;
white-space: nowrap;
-
+
}
-
+
.navbarRight .imgContent .img {
width: 100%;
height: 100%;
-
+
box-sizing: border-box;
position: relative;
}
-
+
.navbarRight .imgContent .img:last-child {
padding: 1rpx;
}
-
+
.nvbar {
top: 0px;
}
-
+
/deep/ .uni-navbar--fixed {
top: 0px;
}
-
+
.uninavebartext {
width: 100%;
font-size: 32rpx;
diff --git a/pages/670/HBY670.vue b/pages/670/HBY670.vue
index 363b117..6b206fd 100644
--- a/pages/670/HBY670.vue
+++ b/pages/670/HBY670.vue
@@ -1,7 +1,7 @@
-
+
@@ -9,7 +9,8 @@
-
+
@@ -18,7 +19,7 @@
-
+
@@ -82,7 +83,7 @@
+ style="vertical-align: bottom;" />
{{formData.address}}
@@ -116,19 +117,19 @@
+ @click="GearSetting('low','staticBattery')">
低档
+ @click="GearSetting('center','staticBattery')">
中档
+ @click="GearSetting('hight','staticBattery')">
高档
+ @click="GearSetting('close','staticBattery')">
关闭
@@ -140,8 +141,8 @@
+ :src="formData.SOS=='sg'?'/static/images/670/sgActive.png':'/static/images/670/sg.png'"
+ mode="aspectFit">
报警中{{Status.staticWarn.time}}
@@ -151,8 +152,8 @@
+ :src="formData.SOS=='rb'?'/static/images/670/rbActive.png':'/static/images/670/rb.png'"
+ mode="aspectFit">
红蓝闪烁
@@ -164,24 +165,24 @@
+ :src="formData.lightCurr=='qiang'?'/static/images/670/qiangActive.png':'/static/images/670/qiang.png'"
+ mode="aspectFit">
强光
+ :src="formData.lightCurr=='ruo'?'/static/images/670/ruoActive.png':'/static/images/670/ruo.png'"
+ mode="aspectFit">
弱光
+ :src="formData.lightCurr=='close'?'/static/images/lightImg/closeLightActive.png':'/static/images/lightImg/closeLight.png'"
+ mode="aspectFit">
关闭
@@ -233,7 +234,7 @@
+ placeholder="请输入文字" placeholder-class="usrplace" />
@@ -257,18 +258,18 @@
-
+ @btnClick="btnClick">
+
+ :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" @cancelPop="closePop" :visiblePrompt="Status.Pop.visiblePrompt"
+ :promptTitle="Status.Pop.promptTitle" v-model="Status.Pop.modelValue" :showCancel="Status.Pop.showCancel"
+ :buttonCancelText="Status.Pop.buttonCancelText" />
@@ -287,19 +288,21 @@
hideLoading,
updateLoading
} from '@/utils/loading.js'
- import request, { baseURL } from '@/utils/request.js';
+ import request, {
+ baseURL
+ } from '@/utils/request.js';
import lnglatConvert from '@/utils/wgs84_to_gcj02.js';
- import {
- MsgSuccess,
- MsgError,
- MsgClose,
- MsgWarning,
- showPop,
- MsgInfo
- } from '@/utils/MsgPops.js'
+ import {
+ MsgSuccess,
+ MsgError,
+ MsgClose,
+ MsgWarning,
+ showPop,
+ MsgInfo
+ } from '@/utils/MsgPops.js'
const pagePath = "/pages/670/HBY670";
import SendBatchData from '@/utils/SendBatchData.js';
- var batchTool=null;
+ var batchTool = null;
var ble = null;
var these = null;
var recei = null;
@@ -328,38 +331,38 @@
time: 0,
inteval: null
},
- Pop: {
- showPop: false, //是否显示弹窗
+ Pop: {
+ showPop: false, //是否显示弹窗
- popType: 'custom',
- bgColor: '#383934bd',
- borderColor: '#BBE600',
- textColor: '#ffffffde',
- buttonBgColor: '#BBE600',
- buttonTextColor: '#FFFFFFDE',
+ popType: 'custom',
+ bgColor: '#383934bd',
+ borderColor: '#BBE600',
+ textColor: '#ffffffde',
+ buttonBgColor: '#BBE600',
+ buttonTextColor: '#FFFFFFDE',
- iconUrl: '',
- message: '您确定要这样做吗?',
- buttonText: '确定',
- showCancel: false,
- buttonCancelText: '取消',
- clickEvt: '',
- visiblePrompt: false,
- promptTitle: '设备名称',
- modelValue: '',
- visibleClose: false,
- okCallback: null
- },
+ iconUrl: '',
+ message: '您确定要这样做吗?',
+ buttonText: '确定',
+ showCancel: false,
+ buttonCancelText: '取消',
+ clickEvt: '',
+ visiblePrompt: false,
+ promptTitle: '设备名称',
+ modelValue: '',
+ visibleClose: false,
+ okCallback: null
+ },
BottomMenu: {
show: false,
showHeader: true,
menuItems: [{
- text: '照片',
- value:'img'
+ text: '照片',
+ value: 'img'
},
{
- text: '动画',
- value:'flash'
+ text: '动画',
+ value: 'flash'
}
],
activeIndex: -1,
@@ -479,7 +482,7 @@
ble = BleTool.getBleTool();
this.$watch("formData.battary", (newVal, oldVal) => {
if (newVal <= 20 && this.formData.sta_system == 2) {
- MsgError("设备电量低",'',these);
+ MsgError("设备电量低", '', these);
}
});
@@ -511,14 +514,7 @@
if (these.device.deviceImei) {
these.initMQ();
}
- let f = ble.data.LinkedList.find((v) => {
- if (v.macAddress == device.deviceMac) {
- console.log("找到设备了", v);
- these.formData.deviceId = v.deviceId;
- return true;
- }
- return false;
- });
+ let f = these.getDevice();
if (!f) {
these.showBleUnConnect();
these.getDetail();
@@ -539,31 +535,31 @@
these.formData['imei'] = these.device.deviceImei;
}
these.getDetail();
-
- these.formData.bleStatu='connecting';
+
+ these.formData.bleStatu = 'connecting';
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
these.formData.bleStatu = true;
- }).catch(ex => {
- these.formData.bleStatu = 'err';
- MsgError("连接错误:" + ex.msg, "确定", these);
- });;
+ }).catch(ex => {
+ these.formData.bleStatu = 'err';
+ MsgError("连接错误:" + ex.msg, "确定", these);
+ });;
});
},
onShow() {
this.Status.pageHide = false;
-
- let f=this.getDevice();
- if(f){
- these.formData.bleStatu = 'connecting';
- ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
- console.log("连接成功")
- these.formData.bleStatu = true;
- }).catch(ex => {
- these.formData.bleStatu = 'err';
- MsgError("连接错误:" + ex.msg, "确定", these);
- });;
- }
+
+ let f = this.getDevice();
+ if (f) {
+ these.formData.bleStatu = 'connecting';
+ ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
+ console.log("连接成功")
+ these.formData.bleStatu = true;
+ }).catch(ex => {
+ these.formData.bleStatu = 'err';
+ MsgError("连接错误:" + ex.msg, "确定", these);
+ });;
+ }
},
onHide: function() {
this.Status.pageHide = true;
@@ -572,50 +568,50 @@
ble.removeReceiveCallback(pagePath);
},
computed: {
- getbleStatu(){
- if(this.formData.bleStatu===true){
- return '已连接';
- }
- if(this.formData.bleStatu==='connecting'){
- return '连接中';
- }
- if(this.formData.bleStatu==='dicconnect'){
- return '正在断开';
- }
- if(this.formData.bleStatu==='err'){
- return '连接异常';
- }
- return '未连接';
+ getbleStatu() {
+ if (this.formData.bleStatu === true) {
+ return '已连接';
+ }
+ if (this.formData.bleStatu === 'connecting') {
+ return '连接中';
+ }
+ if (this.formData.bleStatu === 'dicconnect') {
+ return '正在断开';
+ }
+ if (this.formData.bleStatu === 'err') {
+ return '连接异常';
+ }
+ return '未连接';
}
},
methods: {
- bleStatuToggle(){
- let f=this.getDevice();
- if(!f){
- this.showBleUnConnect();
- return;
- }
- if(this.formData.bleStatu===true){
- this.formData.bleStatu='dicconnect';
- ble.disconnectDevice(f.deviceId).finally(r=>{
- this.formData.bleStatu=false;
- });
- return;
- }
-
- if(this.formData.bleStatu===false || this.formData.bleStatu==='err'){
- this.formData.bleStatu='connecting';
- ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
- these.formData.bleStatu = true;
- }).catch(ex=>{
- these.formData.bleStatu = 'err';
- MsgError("连接错误:" + ex.msg, "确定", these);
- });
- return;
- }
-
-
- },
+ bleStatuToggle() {
+ let f = this.getDevice();
+ if (!f) {
+ this.showBleUnConnect();
+ return;
+ }
+ if (this.formData.bleStatu === true) {
+ this.formData.bleStatu = 'dicconnect';
+ ble.disconnectDevice(f.deviceId).finally(r => {
+ this.formData.bleStatu = false;
+ });
+ return;
+ }
+
+ if (this.formData.bleStatu === false || this.formData.bleStatu === 'err') {
+ this.formData.bleStatu = 'connecting';
+ ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
+ these.formData.bleStatu = true;
+ }).catch(ex => {
+ these.formData.bleStatu = 'err';
+ MsgError("连接错误:" + ex.msg, "确定", these);
+ });
+ return;
+ }
+
+
+ },
prevPage() {
uni.navigateBack({
@@ -627,7 +623,7 @@
}
if (res.deviceId == these.formData.deviceId) {
this.formData.bleStatu = true;
-
+
}
},
@@ -636,9 +632,9 @@
// return;
// }
if (res.deviceId == these.formData.deviceId) {
- if(res.device){
+ if (res.device) {
these.formData.bleStatu = 'connecting';
- }else{
+ } else {
this.formData.bleStatu = false;
}
setTimeout(() => {
@@ -673,7 +669,7 @@
showLoading(this, {
text: "蓝牙恢复可用,正在连接设备"
});
- this.formData.bleStatu='connecting';
+ this.formData.bleStatu = 'connecting';
ble.LinkBlue(these.formData.deviceId).then(() => {
these.formData.bleStatu = true;
updateLoading(these, {
@@ -683,7 +679,7 @@
updateLoading(these, {
text: ex.msg
});
- these.formData.bleStatu = 'err';
+ these.formData.bleStatu = 'err';
}).finally(() => {
setTimeout(() => {
hideLoading(these);
@@ -711,7 +707,7 @@
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
- buttonTextColor: '#FFFFFFde',
+ buttonTextColor: '#FFFFFFde',
showCancel: true,
cancelCallback: () => {
// this.closePop();
@@ -737,7 +733,7 @@
}
})
}
- },these);
+ }, these);
},
gotoMap() {
let promise = lnglatConvert.wgs84_to_gcj02(this.formData.Lon, this.formData.Lat);
@@ -931,16 +927,17 @@
// console.log("收到文本回复", payload);
// // this.SendTxtMQ(json);
// }
- if (keys.indexOf('sta_BreakNews') > -1) { //紧急通知
- if(json.sta_BreakNews=='I get it'){
- showPop({
- showPop: true,
- message: "用户已确认收到紧急通知",
- iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png"
- },these);
- }
-
- }
+ if (keys.indexOf('sta_BreakNews') > -
+ 1) { //紧急通知
+ if (json.sta_BreakNews == 'I get it') {
+ showPop({
+ showPop: true,
+ message: "用户已确认收到紧急通知",
+ iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png"
+ }, these);
+ }
+
+ }
} catch (error) {
console.error("无法解析此消息", payload);
}
@@ -1126,7 +1123,7 @@
buttonBgColor: "#E03434",
buttonText: "确定",
clickEvt: "staticWarn"
- },these);
+ }, these);
}
@@ -1134,12 +1131,23 @@
},
getDevice: function() {
- console.log("LinkedList=", ble.data.LinkedList);
- console.log("this.device=", this.device);
let f = ble.data.LinkedList.find((v) => {
- return v.macAddress == these.device.deviceMac;
+ let flag = v.macAddress == these.device.deviceMac;
+ if (!flag && v.device) {
+ flag = v.device.id == these.device.id;
+ }
+ if (flag) {
+ these.formData.deviceId = v.deviceId;
+ }
+ return flag;
});
+ // #ifdef WEB
+ f = {
+ deviceId: '123'
+ }
+ // #endif
+
return f;
},
setBleFormData() {
@@ -1164,10 +1172,10 @@
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
- buttonTextColor: "#FFFFFFde",
+ buttonTextColor: "#FFFFFFde",
okCallback: null,
buttonText: "确定"
- },these)
+ }, these)
return;
}
if (this.formData.lightCurr == type) {
@@ -1208,8 +1216,8 @@
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
- buttonTextColor: "#FFFFFFde"
- },these);
+ buttonTextColor: "#FFFFFFde"
+ }, these);
}).finally(() => {
hideLoading(these);
@@ -1252,10 +1260,10 @@
CloseWarn: function(ispop) { //解除强制报警
let closeEvt = () => {
-
+
these.formData.qzwarn = false;
- these.Status.staticWarn.inteval=null
+ these.Status.staticWarn.inteval = null
clearInterval(these.Status.staticWarn.inteval);
let requestCloseSOS = () => {
@@ -1273,9 +1281,9 @@
message: "通信异常,请检查手机或设备网络",
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
- buttonBgColor: "#E03434",
- buttonTextColor: "#FFFFFFde"
- },these);
+ buttonBgColor: "#E03434",
+ buttonTextColor: "#FFFFFFde"
+ }, these);
}).finally(() => {
hideLoading(these);
@@ -1346,7 +1354,7 @@
this.Status.Pop.okCallback = null;
},
clickEvt: 'time'
- },these);
+ }, these);
},
sosSetting: function(type) {
debugger;
@@ -1356,11 +1364,11 @@
message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
- buttonBgColor: "#E03434",
- buttonTextColor: "#FFFFFFde",
+ buttonBgColor: "#E03434",
+ buttonTextColor: "#FFFFFFde",
okCallback: null,
buttonText: "确定"
- },these)
+ }, these)
return;
}
@@ -1369,7 +1377,7 @@
type = "close";
}
-
+
let task = () => {
let dic = {
@@ -1429,9 +1437,9 @@
message: "通信异常,请检查手机或设备网络",
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
- buttonBgColor: "#E03434",
- buttonTextColor: "#FFFFFFde"
- },these);
+ buttonBgColor: "#E03434",
+ buttonTextColor: "#FFFFFFde"
+ }, these);
}).finally(() => {
hideLoading(these);
@@ -1482,7 +1490,7 @@
text: "请稍候..."
});
let execSos = () => {
-
+
these.formData.qzwarn = true; //标记为强制报警了
these.Status.staticWarn.time = 180;
@@ -1553,14 +1561,14 @@
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
- buttonTextColor:"#FFFFFFde",
+ buttonTextColor: "#FFFFFFde",
okCallback: OpenSOS,
buttonText: "开启"
- },these);
+ }, these);
return;
} else if (type == 'close') {
- console.log("this.formData.SOS=",this.formData.SOS);
- console.log("inteval=",this.Status.staticWarn.inteval);
+ console.log("this.formData.SOS=", this.formData.SOS);
+ console.log("inteval=", this.Status.staticWarn.inteval);
if (this.formData.SOS = 'sg' && this.Status.staticWarn.inteval) { //解除声光报警
this.CloseWarn(true);
} else {
@@ -1583,10 +1591,10 @@
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
- buttonTextColor: "#FFFFFFde",
+ buttonTextColor: "#FFFFFFde",
okCallback: null,
buttonText: "确定"
- },these)
+ }, these)
return;
}
if (this.formData.modeCurr == type) {
@@ -1625,9 +1633,9 @@
message: "通信异常,请检查手机或设备网络",
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
- buttonBgColor: "#E03434",
- buttonTextColor: "#FFFFFFde"
- },these);
+ buttonBgColor: "#E03434",
+ buttonTextColor: "#FFFFFFde"
+ }, these);
}).finally(() => {
hideLoading(these);
@@ -1675,20 +1683,20 @@
setTimeout(task, 0);
},
-
+
checkImgUpload: function(type, index) {
console.log("123213213213");
let f = these.getDevice();
- if(!f){
+ if (!f) {
this.showBleUnConnect();
return;
}
-
- if(!batchTool){
- batchTool=new SendBatchData(these,f,ble);
+
+ if (!batchTool) {
+ batchTool = new SendBatchData(these, f, ble);
}
-
+
if (type) {
if (type == 'img') {
// sendImagePackets(index);
@@ -1697,7 +1705,7 @@
// sendVideoPackets(index);
batchTool.SendVideo(506);
}
-
+
}
return;
var sendImgByRequest = () => {
@@ -1712,7 +1720,7 @@
showPop: true,
message: "上传成功",
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png",
- },these);
+ }, these);
resolve();
return;
} else {
@@ -1722,7 +1730,7 @@
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
- },these);
+ }, these);
reject(res);
}
}).catch((ex) => {
@@ -1758,7 +1766,7 @@
showPop: true,
message: "上传成功",
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png",
- },these);
+ }, these);
if (!ReSendNo) {
setTimeout(() => {
these.HoldYouHand("transmit complete", 0, f
@@ -1801,7 +1809,7 @@
'0')); // 包序号
- dataView.setUint16(3, packetData.length*2,false); // 包t长度
+ dataView.setUint16(3, packetData.length * 2, false); // 包t长度
// 填充数据(每个RGB565值占2字节)
for (let i = 0; i < packetData.length; i++) {
@@ -1943,7 +1951,7 @@
showPop: true,
message: "上传成功",
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png"
- },these);
+ }, these);
@@ -2022,7 +2030,7 @@
buttonBgColor: "#E03434",
buttonText: "确定",
iconUrl: "/static/images/common/uploadErr.png"
- },these);
+ }, these);
reject(err);
return;
}
@@ -2124,7 +2132,7 @@
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
- },these);
+ }, these);
}
}).catch((ex) => {
@@ -2135,7 +2143,7 @@
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
- },these);
+ }, these);
})
}
@@ -2205,20 +2213,20 @@
message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
- buttonBgColor: "#E03434",
- buttonTextColor: "#FFFFFFde",
+ buttonBgColor: "#E03434",
+ buttonTextColor: "#FFFFFFde",
okCallback: null,
buttonText: "确定"
- },these)
+ }, these)
return;
}
//上传开机画面
-
+
this.Status.BottomMenu.title = "上传开机画面";
this.Status.BottomMenu.type = "checkImg";
this.Status.BottomMenu.show = true;
this.Status.BottomMenu.showBtn = true;
- this.Status.BottomMenu.activeIndex=0;
+ this.Status.BottomMenu.activeIndex = 0;
},
showMenu(flag) {
@@ -2229,7 +2237,7 @@
},
btnClick(item, index) {
this.Status.BottomMenu.show = false;
- this.checkImgUpload(item.value,index);
+ this.checkImgUpload(item.value, index);
},
setMode(mode) {
@@ -2250,74 +2258,74 @@
this.Status.BottomMenu.activeIndex = index;
},
- HidePop: function () {
- if (this.Status.Pop.clickEvt == 'staticWarn') {
- // this.Status.staticWarnTime=0;
- // clearInterval(this.Status.staticWarn.inteval);
- // this.formData.staticWarn=false;
- }
- if (this.Status.Pop.okCallback) {
- console.log("执行点击按钮回调");
- this.Status.Pop.okCallback();
- }
+ HidePop: function() {
+ if (this.Status.Pop.clickEvt == 'staticWarn') {
+ // this.Status.staticWarnTime=0;
+ // clearInterval(this.Status.staticWarn.inteval);
+ // this.formData.staticWarn=false;
+ }
+ if (this.Status.Pop.okCallback) {
+ console.log("执行点击按钮回调");
+ this.Status.Pop.okCallback();
+ }
- this.Status.Pop.showPop = false;
- },
- closePop: function () {
- this.Status.Pop.showPop = false;
+ this.Status.Pop.showPop = false;
+ },
+ closePop: function() {
+ this.Status.Pop.showPop = false;
- if (this.Status.Pop.cancelCallback) {
- this.Status.Pop.cancelCallback();
- }
- },
- 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 (this.Status.Pop.cancelCallback) {
+ this.Status.Pop.cancelCallback();
+ }
+ },
+ 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,
+ }
- let keys = Object.keys(def);
+ let keys = Object.keys(def);
- for (let i = 0; i < keys.length; i++) {
- let key = keys[i];
- 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];
+ for (let i = 0; i < keys.length; i++) {
+ let key = keys[i];
+ 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];
- }
- }
+ this.Status.Pop[key] = option[key];
+ }
+ }
- if (!option.borderColor) {
- option.borderColor = '#BBE600';
- option.buttonBgColor = '#BBE600';
- }
- these.Status.Pop.showPop = true;
- },
+ if (!option.borderColor) {
+ option.borderColor = '#BBE600';
+ option.buttonBgColor = '#BBE600';
+ }
+ these.Status.Pop.showPop = true;
+ },
sendUsr: function(ReSendNo) {
if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') {
@@ -2326,11 +2334,11 @@
message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
- buttonBgColor: "#E03434",
- buttonTextColor: "#FFFFFFde",
+ buttonBgColor: "#E03434",
+ buttonTextColor: "#FFFFFFde",
okCallback: null,
buttonText: "确定"
- },these)
+ }, these)
return;
}
@@ -2362,7 +2370,7 @@
promptTitle: '',
modelValue: '',
visibleClose: true
- },these);
+ }, these);
these.setBleFormData();
}).catch((ex) => {
showPop({
@@ -2370,7 +2378,7 @@
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
- },these);
+ }, these);
}).finally(() => {
hideLoading(these);
});
@@ -2434,7 +2442,7 @@
promptTitle: '',
modelValue: '',
visibleClose: true
- },these);
+ }, these);
these.setBleFormData();
hideLoading(these);
@@ -2545,11 +2553,11 @@
message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
- buttonBgColor: "#E03434",
- buttonTextColor: "#FFFFFFde",
+ buttonBgColor: "#E03434",
+ buttonTextColor: "#FFFFFFde",
okCallback: null,
buttonText: "确定"
- },these)
+ }, these)
return;
}
if (!this.formData.msgTxt) {
@@ -2593,7 +2601,7 @@
promptTitle: '',
modelValue: '',
visibleClose: true
- },these);
+ }, these);
// clearInterval(this.Status.msgOkIntval);
@@ -2614,7 +2622,7 @@
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
- },these);
+ }, these);
}
}).finally(() => {
hideLoading(this);
@@ -2936,16 +2944,16 @@
}
- .usrinfo .btnSend {
- background-color: rgb(187, 230, 0);
- color: rgba(35, 35, 35, 0.87);
- height: 50rpx;
- line-height: 50rpx;
- border-radius: 16rpx;
- font-size: 26rpx;
- width: 112rpx;
- white-space: nowrap;
- text-align: center;
+ .usrinfo .btnSend {
+ background-color: rgb(187, 230, 0);
+ color: rgba(35, 35, 35, 0.87);
+ height: 50rpx;
+ line-height: 50rpx;
+ border-radius: 16rpx;
+ font-size: 26rpx;
+ width: 112rpx;
+ white-space: nowrap;
+ text-align: center;
}
.usrinfo .item {
@@ -3009,7 +3017,7 @@
text-align: left;
}
-
+
.slider-container {
@@ -3339,16 +3347,17 @@
.net.active {
background: #FFFFFF !important;
}
-
- .navbarRight .img{
+
+ .navbarRight .img {
width: 35rpx;
height: 35rpx;
margin-right: 30rpx;
}
- .uni-navbar--fixed{
- top:0rpx;
+
+ .uni-navbar--fixed {
+ top: 0rpx;
}
-
+
/deep/ .uni-navbar--fixed {
top: 0px;
}
diff --git a/pages/7305/BJQ7305.vue b/pages/7305/BJQ7305.vue
index 9022c5d..3280879 100644
--- a/pages/7305/BJQ7305.vue
+++ b/pages/7305/BJQ7305.vue
@@ -10,7 +10,7 @@
+ @click.stop="handleRightClick(item,index)" v-for="item,index in Status.navbar.icons">
{{item.math>9?'9+':item.math}}
@@ -73,8 +73,8 @@
+ backgroundColor="#00000000" block-size="20" block-color="#ffffffde" @change="sliderChange"
+ @changing="sliderChanging" class="custom-slider" />
@@ -114,20 +114,23 @@
发送
+ :bgColor="'#FFFFFF'" :color="'#000000'" :fontSize="13" />
单位:
-
+
部门:
-
+
姓名:
-
+
@@ -135,7 +138,7 @@
+ @btnClick="btnClick">
@@ -160,14 +163,14 @@
} from '@/utils/loading.js'
import BleReceive from '@/utils/BleReceive';
import Common from '@/utils/Common.js';
- import {
- MsgSuccess,
- MsgError,
- MsgClose,
- MsgWarning,
- showPop,
- MsgInfo
- } from '@/utils/MsgPops.js'
+ import {
+ MsgSuccess,
+ MsgError,
+ MsgClose,
+ MsgWarning,
+ showPop,
+ MsgInfo
+ } from '@/utils/MsgPops.js'
var ble = null;
var these = null;
var BrighInteval = null;
@@ -188,7 +191,7 @@
apiType: 'listA'
}],
title: 'BJQ6155',
- height:90
+ height: 90
},
pageHide: false,
@@ -260,7 +263,7 @@
textLines: [],
mode: '',
bleStatu: '',
- inputLines:[]
+ inputLines: []
},
inteval: 500,
device: {
@@ -287,8 +290,8 @@
}
},
created() {
- this.Status.navbar.height = uni.getSystemInfoSync().statusBarHeight + 44;
- },
+ this.Status.navbar.height = uni.getSystemInfoSync().statusBarHeight + 44;
+ },
onUnload() {
ble.removeAllCallback(pagePath);
},
@@ -320,14 +323,7 @@
}
});
}
- let f = ble.data.LinkedList.find((v) => {
- if (v.macAddress == device.deviceMac) {
- console.log("找到设备了", v);
- these.formData.deviceId = v.deviceId;
- return true;
- }
- return false;
- });
+ let f = these.getDevice();
if (!f) {
these.getDetail();
@@ -351,10 +347,10 @@
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
console.log("连接成功")
these.formData.bleStatu = true;
- }).catch(ex => {
- these.formData.bleStatu = 'err';
- MsgError("连接错误:" + ex.msg, "确定", these);
- });;
+ }).catch(ex => {
+ these.formData.bleStatu = 'err';
+ MsgError("连接错误:" + ex.msg, "确定", these);
+ });;
these.setBleFormData();
these.getDetail();
@@ -368,17 +364,17 @@
},
onShow: function() {
this.Status.pageHide = false;
-
- let f=this.getDevice();
- if(f){
+
+ let f = this.getDevice();
+ if (f) {
these.formData.bleStatu = 'connecting';
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
console.log("连接成功")
these.formData.bleStatu = true;
- }).catch(ex => {
- these.formData.bleStatu = 'err';
- MsgError("连接错误:" + ex.msg, "确定", these);
- });;
+ }).catch(ex => {
+ these.formData.bleStatu = 'err';
+ MsgError("连接错误:" + ex.msg, "确定", these);
+ });;
}
},
computed: {
@@ -416,7 +412,7 @@
case 3:
txt = "爆闪模式";
break;
-
+
default:
txt = "关闭";
break;
@@ -446,7 +442,7 @@
these.formData.bleStatu = true;
}).catch(ex => {
these.formData.bleStatu = 'err';
- MsgError("连接错误:" + ex.msg, "确定", these);
+ MsgError("连接错误:" + ex.msg, "确定", these);
});
return;
}
@@ -490,7 +486,7 @@
if (res.deviceId == these.formData.deviceId) {
this.formData.bleStatu = true;
// 重新连接后状态以设备上报为准
-
+
}
},
@@ -550,7 +546,7 @@
updateLoading(these, {
text: ex.msg
});
- these.formData.bleStatu = 'err';
+ these.formData.bleStatu = 'err';
}).finally(() => {
setTimeout(() => {
hideLoading(these);
@@ -568,12 +564,23 @@
})
},
getDevice: function() {
- // console.log("LinkedList=", ble.data.LinkedList);
- // console.log("formData=", these.formData);
let f = ble.data.LinkedList.find((v) => {
- return v.macAddress == these.device.deviceMac;
+ let flag = v.macAddress == these.device.deviceMac;
+ if (!flag && v.device) {
+ flag = v.device.id == these.device.id;
+ }
+ if (flag) {
+ these.formData.deviceId = v.deviceId;
+ }
+ return flag;
});
+ // #ifdef WEB
+ f = {
+ deviceId: '123'
+ }
+ // #endif
+
return f;
},
bleValueNotify: function(receive, device, path, recArr) {
@@ -595,8 +602,8 @@
these.formData[key] = json[key];
}
});
- these.formData.mode=parseInt(receive.hexs[2],16);
- console.error("mode="+these.formData.mode);
+ these.formData.mode = parseInt(receive.hexs[2], 16);
+ console.error("mode=" + these.formData.mode);
if ('statu' in json) {
const chargingVal = json.statu;
const isCharging = chargingVal === 1 || chargingVal === '1' || chargingVal === true ||
@@ -618,7 +625,7 @@
},
-
+
showBleUnConnect() {
this.showPop({
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
@@ -626,7 +633,7 @@
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
- buttonTextColor: '#FFFFFFde',
+ buttonTextColor: '#FFFFFFde',
okCallback: function() {
console.log("1111");
uni.navigateTo({
@@ -756,7 +763,7 @@
uni.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
- sourceType: ['album','camera'],
+ sourceType: ['album', 'camera'],
success: function(res) {
uni.navigateTo({
url: "/pages/common/ImgCrop/ImgCrop",
@@ -999,16 +1006,16 @@
case 0:
-
- dataValue = 0x01;
-
+
+ dataValue = 0x01;
+
break;
case 1:
dataValue = 0x02;
break;
-
+
case 2:
dataValue = 0x03;
break;
@@ -1042,7 +1049,7 @@
});
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 100).then(() => {
- this.formData.mode = mode+1;
+ this.formData.mode = mode + 1;
this.setBleFormData();
}).catch((ex) => {
these.showPop({
@@ -1059,8 +1066,8 @@
},
handleItemClick(item, index) {
-debugger;
-
+ debugger;
+
this.Status.BottomMenu.activeIndex = index;
},
@@ -1143,7 +1150,7 @@ debugger;
option.buttonBgColor = '#BBE600';
}
these.Status.Pop.showPop = true;
- showPop(option,this);
+ showPop(option, this);
},
sendUsr() {
if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') {
@@ -1182,16 +1189,18 @@ debugger;
});
return;
}
-
-
- this.formData.textLines=[this.formData.inputLines[0],this.formData.inputLines[1],this.formData.inputLines[2]];
-
+
+
+ this.formData.textLines = [this.formData.inputLines[0], this.formData.inputLines[1], this.formData
+ .inputLines[2]
+ ];
+
showLoading(these, {
text: "发送中..."
});
this.setBleFormData();
let task = async () => {
- var sendTxtPackge = (rgbdata, type, str,index) => {
+ var sendTxtPackge = (rgbdata, type, str, index) => {
var promise = new Promise((resolve, reject) => {
try {
@@ -1234,7 +1243,10 @@ debugger;
.toString(16).padStart(2, '0'));
console.log(`发送数据块 ${chunkIndex + 1}/${numChunks}:`, hexArray
.join(' '));
- updateLoading(these,{text:'正在发送'+((index-1)*14+chunkIndex + 1)+'/42'})
+ updateLoading(these, {
+ text: '正在发送' + ((index - 1) * 14 + chunkIndex +
+ 1) + '/42'
+ })
ble.sendData(f.deviceId, chunk, f.writeServiceId, f
.wirteCharactId, 100).then(() => {
chunkIndex++;
@@ -1291,7 +1303,7 @@ debugger;
try {
// console.log("1111");
- await sendTxtPackge(rgb, h3dic[i], str,i+1);
+ await sendTxtPackge(rgb, h3dic[i], str, i + 1);
// console.log("222222");
} catch (ex) {
flag = false;
@@ -1344,7 +1356,9 @@ debugger;
res = res.data;
let personnelInfo = res.personnelInfo;
if (personnelInfo) {
- these.formData.inputLines=[personnelInfo.position,personnelInfo.name,personnelInfo.unitName];
+ these.formData.inputLines = [personnelInfo.position, personnelInfo.name, personnelInfo
+ .unitName
+ ];
}
}
});
@@ -1358,10 +1372,10 @@ debugger;
});
},
- sliderChanging(evt){
+ sliderChanging(evt) {
this.formData.liangDu = evt.detail.value;
},
-
+
sliderChange: function(evt) {
this.formData.liangDu = evt.detail.value;
clearTimeout(BrighInteval)
@@ -1820,7 +1834,7 @@ debugger;
text-align: left;
}
-
+
.slider-container {
padding: 0px;
diff --git a/pages/common/addBLE/addEquip.vue b/pages/common/addBLE/addEquip.vue
index 3575018..79febf2 100644
--- a/pages/common/addBLE/addEquip.vue
+++ b/pages/common/addBLE/addEquip.vue
@@ -58,7 +58,7 @@
+ v-show="item.name.toLowerCase().indexOf(search.toLowerCase())>-1">
@@ -131,7 +131,7 @@
var ble = null;
var these = null;
var eventChannel = null;
-
+ var sortTime=null;
export default {
data() {
return {
@@ -362,15 +362,18 @@
device.isTarget = true;
}
if (device.name) {
- device.name = device.name.replace(/^JQZM-/i, '').replace(/^HBY102J-/i, '');
+ device.name = device.name.replace(/^HBY102J-/i, '');
}
these.EquipMents.push(device);
}
}
-
- these.EquipMents.sort((a, b) => b.RSSI - a.RSSI); //信号好的排前面,一般信号好的是目标设备
+ clearTimeout(sortTime);
+ sortTime=setTimeout(()=>{
+ these.EquipMents.sort((a, b) => b.RSSI - a.RSSI);
+ },500);
+
}, pagePath);
@@ -632,9 +635,9 @@
}
hideLoading(these);
these.device.bleId=deviceId;
- eventChannel.emit('BindOver', these.device);
-
+
ble.updateCache();
+ eventChannel.emit('BindOver', these.device);
uni.navigateBack();
}
@@ -642,7 +645,8 @@
if (f && f.macAddress) {
if (!these.device || !these.device.deviceMac) { //走服务端验证
- console.error("走服务端验证")
+ console.error("理论上永远不会走这里,走服务端验证");
+ console.error("我TM太相信理论了");
request({
url: '/app/device/getDeviceInfoByDeviceMac',
method: 'GET',
@@ -650,8 +654,6 @@
deviceMac: f.macAddress
}
}).then(res => {
-
-
if (res && res.code == 200) {
let data = res.data;
@@ -701,17 +703,7 @@
clearInterval(this.Status.intval)
this.Status.intval = null;
this.Status.time = null;
- f = ble.data.LinkedList.find(v => {
- if (v.deviceId == deviceId) {
- v.device = these.device;
- return true;
- }
- return false;
- });
- if (!(f && f.macAddress)) {
- deviceInvalid()
- return;
- }
+ deviceInvalid();
return;
}
diff --git a/utils/BleHelper.js b/utils/BleHelper.js
index 447d504..00169f0 100644
--- a/utils/BleHelper.js
+++ b/utils/BleHelper.js
@@ -122,7 +122,7 @@ class BleHelper {
{
key: '10013',
remark: '连接 deviceId 为空或者是格式不正确'
- },
+ },
{
key: '10016',
remark: '定位服务已关闭'
@@ -164,7 +164,20 @@ class BleHelper {
//更新缓存
updateCache() {
- uni.setStorageSync(this.StorageKey, this.data.LinkedList);
+ let task =async () => {
+ await uni.setStorage({
+ key: this.StorageKey,
+ data: this.data.LinkedList,
+ success() {
+
+ },
+ fail(ex) {
+ console.error("更新蓝牙缓存失败");
+ }
+ });
+ }
+
+ task();
}
//连接所有已连接过的设备
@@ -1595,7 +1608,7 @@ class BleHelper {
LinkBlue(deviceId, targetServiceId, writeCharId, notifyCharId, maxRetries) {
//连接成功的回调
- let LinkedCallback=() => {
+ let LinkedCallback = () => {
if (this.cfg.recoveryCallback.length > 0) {
this.cfg.recoveryCallback.forEach((
c) => {
@@ -1667,7 +1680,7 @@ class BleHelper {
console.log("当前已连接,释放连接锁");
delete this.data.connectingDevices[deviceId];
resolve(false);
-
+
return;
}
@@ -1689,7 +1702,7 @@ class BleHelper {
delete this.data.connectingDevices[deviceId];
console.error("新连接成功释放连接锁", deviceId);
-
+
// 处理 MTU 设置
if (plus.os.name === 'Android') {
this.setMtu(deviceId).catch(ex => {
@@ -1703,7 +1716,7 @@ class BleHelper {
if (c.deviceId == deviceId) {
c.Linked = true;
c.linkId = linkId
-
+
return true;
}
return false;
@@ -1711,9 +1724,11 @@ class BleHelper {
if (fIndex > -1) {
this.data.LinkedList[fIndex].Linked = true;
- this.data.LinkedList[fIndex].linkId =linkId;
- this.data.LinkedList[fIndex].name =cr.name;
- this.data.LinkedList[fIndex].advertisData =cr.advertisData;
+ this.data.LinkedList[fIndex].linkId =
+ linkId;
+ this.data.LinkedList[fIndex].name = cr.name;
+ this.data.LinkedList[fIndex].advertisData =
+ cr.advertisData;
} else {
this.data.LinkedList.push(cr);
}
@@ -1727,7 +1742,7 @@ class BleHelper {
return true;
}
})
-
+
resolve(true);
}).catch((ex) => {
@@ -1735,7 +1750,7 @@ class BleHelper {
});
},
fail: (ex) => {
- if(ex.code===10010){
+ if (ex.code === 10010) {
console.log("设备已连接,无需重复连接");
delete this.data.connectingDevices[deviceId];
resolve(true);
@@ -1775,7 +1790,7 @@ class BleHelper {
console.log("2222222");
return linkDevice(deviceId);
}).then((res) => {
- LinkedCallback();
+ LinkedCallback();
if (res) { //新连接(含 createBLEConnection 刚成功)
// console.log("11111111");
if (fIndex == -1) {