Compare commits
7 Commits
8f53a45280
...
new-202508
| Author | SHA1 | Date | |
|---|---|---|---|
| 6ec6003d3c | |||
| 958aa1374a | |||
| 7f56e46ace | |||
| 7ed3813e7c | |||
| 736f24839f | |||
| c6a33832d4 | |||
| 899078534d |
159
api/102J/hby102jBleProtocol.js
Normal file
159
api/102J/hby102jBleProtocol.js
Normal file
@ -0,0 +1,159 @@
|
|||||||
|
/**
|
||||||
|
* HBY102J 晶全应用层协议:下行 FA … FF,上行 FB/FC … FF。
|
||||||
|
* 与 HBY100-J 使用同一颗蓝牙模组 / 同一套 GATT(AE30 + AE03 写 + AE02 通知),
|
||||||
|
* 见 `api/100J/HBY100-J.js` 中 SERVICE_UUID / WRITE / NOTIFY;仅帧语义与 100J 不同。
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const HBY102J_SERVICE = '0000AE30-0000-1000-8000-00805F9B34FB'
|
||||||
|
export const HBY102J_WRITE = '0000AE03-0000-1000-8000-00805F9B34FB'
|
||||||
|
export const HBY102J_NOTIFY = '0000AE02-0000-1000-8000-00805F9B34FB'
|
||||||
|
|
||||||
|
function buildFaFrame(func, dataBytes = []) {
|
||||||
|
return [0xfa, func & 0xff, ...dataBytes.map((b) => b & 0xff), 0xff]
|
||||||
|
}
|
||||||
|
|
||||||
|
const BYTE_TO_RADAR = {
|
||||||
|
0: 'status_off',
|
||||||
|
1: 'status_2M',
|
||||||
|
2: 'status_4M',
|
||||||
|
3: 'status_7M',
|
||||||
|
4: 'status_10M'
|
||||||
|
}
|
||||||
|
|
||||||
|
const BYTE_TO_LED = {
|
||||||
|
0: 'led_off',
|
||||||
|
1: 'led_flash',
|
||||||
|
2: 'led_low_flash',
|
||||||
|
3: 'led_steady',
|
||||||
|
4: 'led_alarm'
|
||||||
|
}
|
||||||
|
|
||||||
|
const RADAR_KEY_TO_BYTE = {
|
||||||
|
status_off: 0,
|
||||||
|
status_2M: 1,
|
||||||
|
status_4M: 2,
|
||||||
|
status_7M: 3,
|
||||||
|
status_10M: 4,
|
||||||
|
status_on: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
const LED_KEY_TO_BYTE = {
|
||||||
|
led_off: 0,
|
||||||
|
led_flash: 1,
|
||||||
|
led_low_flash: 2,
|
||||||
|
led_steady: 3,
|
||||||
|
led_alarm: 4
|
||||||
|
}
|
||||||
|
|
||||||
|
export function encodeChannelSet(channelDecimal1to80) {
|
||||||
|
const ch = Math.max(1, Math.min(80, Number(channelDecimal1to80) || 1))
|
||||||
|
return buildFaFrame(0x21, [ch])
|
||||||
|
}
|
||||||
|
|
||||||
|
export function encodeOnline(on) {
|
||||||
|
return buildFaFrame(0x22, [on ? 1 : 0])
|
||||||
|
}
|
||||||
|
|
||||||
|
export function encodeRadarFromUiKey(sta_RadarType) {
|
||||||
|
const b = RADAR_KEY_TO_BYTE[sta_RadarType] !== undefined ? RADAR_KEY_TO_BYTE[sta_RadarType] : 0
|
||||||
|
return buildFaFrame(0x23, [b])
|
||||||
|
}
|
||||||
|
|
||||||
|
export function encodeWarningLightFromLedKey(ledKey) {
|
||||||
|
const m = LED_KEY_TO_BYTE[ledKey] !== undefined ? LED_KEY_TO_BYTE[ledKey] : 0
|
||||||
|
return buildFaFrame(0x24, [m])
|
||||||
|
}
|
||||||
|
|
||||||
|
export function encodeQueryOnlineCount() {
|
||||||
|
return buildFaFrame(0x25, [0])
|
||||||
|
}
|
||||||
|
|
||||||
|
export function encodeQueryPower() {
|
||||||
|
return buildFaFrame(0x26, [])
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatMacFromBytes(u8, start, len) {
|
||||||
|
const hex = []
|
||||||
|
for (let i = 0; i < len; i++) {
|
||||||
|
hex.push(u8[start + i].toString(16).padStart(2, '0'))
|
||||||
|
}
|
||||||
|
return hex.join(':').toUpperCase()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解析设备上行一帧(Notify),输出与 HBY102 页 formData 对齐的字段
|
||||||
|
*/
|
||||||
|
export function parseHby102jUplink(u8) {
|
||||||
|
const out = {}
|
||||||
|
if (!u8 || u8.length < 3) return out
|
||||||
|
|
||||||
|
const h = u8[0]
|
||||||
|
const func = u8[1]
|
||||||
|
const tail = u8[u8.length - 1]
|
||||||
|
|
||||||
|
if (tail !== 0xff && u8.length >= 4) {
|
||||||
|
// 非标准结尾时仍尽量解析
|
||||||
|
}
|
||||||
|
|
||||||
|
if (h === 0xfc && u8.length >= 8 && u8[7] === 0xff) {
|
||||||
|
out.sta_address = formatMacFromBytes(u8, 1, 6)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
if (h !== 0xfb) return out
|
||||||
|
|
||||||
|
switch (func) {
|
||||||
|
case 0x21:
|
||||||
|
if (u8.length >= 4) {
|
||||||
|
out.sta_Channel = u8[2]
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 0x22:
|
||||||
|
out.sta_Online = u8[2] === 1 ? 'E49_on' : 'E49_off'
|
||||||
|
break
|
||||||
|
case 0x23:
|
||||||
|
out.sta_RadarType = BYTE_TO_RADAR[u8[2]] !== undefined ? BYTE_TO_RADAR[u8[2]] : 'status_off'
|
||||||
|
break
|
||||||
|
case 0x24:
|
||||||
|
out.sta_LedType = BYTE_TO_LED[u8[2]] !== undefined ? BYTE_TO_LED[u8[2]] : 'led_off'
|
||||||
|
break
|
||||||
|
case 0x25:
|
||||||
|
if (u8.length >= 4) {
|
||||||
|
out.sta_onlineQuantity = u8[2]
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 0x26:
|
||||||
|
if (u8.length >= 5) {
|
||||||
|
out.sta_PowerPercent = u8[2]
|
||||||
|
out.sta_charge = u8[3]
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 0x27:
|
||||||
|
if (u8.length >= 9) {
|
||||||
|
out.sta_PowerPercent = u8[2]
|
||||||
|
out.sta_charge = u8[3]
|
||||||
|
out.sta_Channel = u8[4]
|
||||||
|
out.sta_LedType = BYTE_TO_LED[u8[5]] !== undefined ? BYTE_TO_LED[u8[5]] : 'led_off'
|
||||||
|
out.sta_RadarType = BYTE_TO_RADAR[u8[6]] !== undefined ? BYTE_TO_RADAR[u8[6]] : 'status_off'
|
||||||
|
out.sta_Online = u8[7] === 1 ? 'E49_on' : 'E49_off'
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 0x28:
|
||||||
|
if (u8.length >= 10) {
|
||||||
|
const peerMac = formatMacFromBytes(u8, 2, 6)
|
||||||
|
const ev = u8[8]
|
||||||
|
if (ev === 0x01) {
|
||||||
|
out.sta_sosadd = peerMac
|
||||||
|
out.sta_Intrusion = 1
|
||||||
|
} else if (ev === 0x02) {
|
||||||
|
out.sta_sosadd_off = peerMac
|
||||||
|
} else if (ev === 0x03) {
|
||||||
|
out.sta_tomac = peerMac
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
return out
|
||||||
|
}
|
||||||
@ -347,6 +347,14 @@
|
|||||||
"navigationBarTitleText" : "HBY102"
|
"navigationBarTitleText" : "HBY102"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path" : "pages/102J/HBY102J",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationStyle": "custom",
|
||||||
|
"navigationBarTitleText" : "HBY102"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path" : "pages/common/user/logOff",
|
"path" : "pages/common/user/logOff",
|
||||||
"style" :
|
"style" :
|
||||||
|
|||||||
@ -215,7 +215,7 @@
|
|||||||
sta_leftFan: null,
|
sta_leftFan: null,
|
||||||
sta_rightFan: null,
|
sta_rightFan: null,
|
||||||
sta_channel: null,
|
sta_channel: null,
|
||||||
sta_Ms: null,
|
sta_Ms: 'S',
|
||||||
sta_PowerPercent: null,
|
sta_PowerPercent: null,
|
||||||
sta_PowerTime: null,
|
sta_PowerTime: null,
|
||||||
sta_system: null,
|
sta_system: null,
|
||||||
@ -379,6 +379,12 @@
|
|||||||
these.formData.deviceId = v.deviceId;
|
these.formData.deviceId = v.deviceId;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if(v.device){
|
||||||
|
if(v.device.id==device.id){
|
||||||
|
these.formData.deviceId = v.deviceId;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
if (!f) {
|
if (!f) {
|
||||||
@ -603,14 +609,24 @@
|
|||||||
|
|
||||||
},
|
},
|
||||||
getDevice: function() {
|
getDevice: function() {
|
||||||
|
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
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
|
// #ifdef WEB
|
||||||
f = {
|
f = {
|
||||||
deviceId: '123'
|
deviceId: '123'
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
return f;
|
return f;
|
||||||
},
|
},
|
||||||
showBleUnConnect() {
|
showBleUnConnect() {
|
||||||
@ -994,10 +1010,11 @@
|
|||||||
border-width: 5rpx;
|
border-width: 5rpx;
|
||||||
border-color: #00000000;
|
border-color: #00000000;
|
||||||
padding: 5rpx;
|
padding: 5rpx;
|
||||||
|
height:130rpx !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.lampMode .type .txt {
|
.lampMode .type .txt {
|
||||||
color: rgba(255, 255, 255, 0.2);
|
color: rgba(255, 255, 255, 0.5);
|
||||||
background-color: #00000000;
|
background-color: #00000000;
|
||||||
font-family: "PingFang SC";
|
font-family: "PingFang SC";
|
||||||
font-size: 50rpx;
|
font-size: 50rpx;
|
||||||
|
|||||||
@ -1160,15 +1160,24 @@
|
|||||||
},
|
},
|
||||||
getDevice: function() {
|
getDevice: function() {
|
||||||
|
|
||||||
// console.log("LinkedList=", ble.data.LinkedList);
|
let f = ble.data.LinkedList.find((v) => {
|
||||||
// console.log("formData=", these.formData);
|
let flag=v.macAddress == these.device.deviceMac ;
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
if(!flag && v.device){
|
||||||
return v.macAddress == these.device.deviceMac;
|
flag= v.device.id==these.device.id;
|
||||||
});
|
|
||||||
if (f) {
|
|
||||||
this.formData.deviceId = f.deviceId;
|
|
||||||
}
|
}
|
||||||
return f;
|
if(flag){
|
||||||
|
these.formData.deviceId = v.deviceId;
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
});
|
||||||
|
|
||||||
|
// #ifdef WEB
|
||||||
|
f = {
|
||||||
|
deviceId: '123'
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
return f;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -509,14 +509,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
let f =this.getDevice();
|
||||||
if (v.macAddress == device.deviceMac) {
|
|
||||||
// console.log("找到设备了", v);
|
|
||||||
these.formData.deviceId = v.deviceId;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
if (!f) {
|
if (!f) {
|
||||||
|
|
||||||
|
|
||||||
@ -1300,12 +1293,23 @@ onFreqChanging(e){
|
|||||||
},
|
},
|
||||||
getDevice: function() {
|
getDevice: function() {
|
||||||
|
|
||||||
// console.log("LinkedList=", ble.data.LinkedList);
|
|
||||||
// console.log("formData=", these.formData);
|
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
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;
|
return f;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -43,7 +43,7 @@
|
|||||||
<text class="lbl">设备名称</text>
|
<text class="lbl">设备名称</text>
|
||||||
<text class="value valueFont">{{device.deviceName}}</text>
|
<text class="value valueFont">{{device.deviceName}}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<text class="lbl">Mac地址</text>
|
<text class="lbl">Mac地址</text>
|
||||||
@ -62,9 +62,9 @@
|
|||||||
<text class="value valueFont">{{formData.sta_system}}</text>
|
<text class="value valueFont">{{formData.sta_system}}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<ProParams :id="device.id"></ProParams>
|
<ProParams :id="device.id"></ProParams>
|
||||||
<MsgBox ref="msgPop" />
|
<MsgBox ref="msgPop" />
|
||||||
<global-loading ref="loading" />
|
<global-loading ref="loading" />
|
||||||
@ -97,7 +97,7 @@
|
|||||||
var ble = null;
|
var ble = null;
|
||||||
var recei = null;
|
var recei = null;
|
||||||
var mq = null;
|
var mq = null;
|
||||||
var pagePath=null;
|
var pagePath = null;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@ -193,11 +193,11 @@
|
|||||||
onUnload() {
|
onUnload() {
|
||||||
console.log("页面卸载,释放资源");
|
console.log("页面卸载,释放资源");
|
||||||
let statusTopic = `A/${this.formData.imei?this.formData.imei:this.device.deviceImei}`;
|
let statusTopic = `A/${this.formData.imei?this.formData.imei:this.device.deviceImei}`;
|
||||||
if(ble){
|
if (ble) {
|
||||||
ble.removeAllCallback(pagePath);
|
ble.removeAllCallback(pagePath);
|
||||||
ble.removeReceiveCallback(pagePath);
|
ble.removeReceiveCallback(pagePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mq) {
|
if (mq) {
|
||||||
mq.unsubscribe(statusTopic);
|
mq.unsubscribe(statusTopic);
|
||||||
mq.disconnect();
|
mq.disconnect();
|
||||||
@ -213,7 +213,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
onLoad() {
|
onLoad() {
|
||||||
|
|
||||||
these = this;
|
these = this;
|
||||||
recei = BleReceive.getBleReceive();
|
recei = BleReceive.getBleReceive();
|
||||||
ble = BleTool.getBleTool();
|
ble = BleTool.getBleTool();
|
||||||
@ -248,14 +248,7 @@
|
|||||||
if (these.device.deviceImei) {
|
if (these.device.deviceImei) {
|
||||||
these.initMQ();
|
these.initMQ();
|
||||||
}
|
}
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
let f =these.getDevice();
|
||||||
if (v.macAddress == device.deviceMac) {
|
|
||||||
console.log("找到设备了", v);
|
|
||||||
these.formData.deviceId = v.deviceId;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
if (!f) {
|
if (!f) {
|
||||||
these.showBleUnConnect();
|
these.showBleUnConnect();
|
||||||
these.getDetail();
|
these.getDetail();
|
||||||
@ -282,7 +275,7 @@
|
|||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
}).catch(ex => {
|
}).catch(ex => {
|
||||||
these.formData.bleStatu = 'err';
|
these.formData.bleStatu = 'err';
|
||||||
MsgError("连接错误:" + ex.msg, "确定", these);
|
MsgError("连接错误:" + ex.msg, "确定", these);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -309,7 +302,7 @@
|
|||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
}).catch(ex => {
|
}).catch(ex => {
|
||||||
these.formData.bleStatu = 'err';
|
these.formData.bleStatu = 'err';
|
||||||
MsgError("连接错误:" + ex.msg, "确定", these);
|
MsgError("连接错误:" + ex.msg, "确定", these);
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -377,7 +370,7 @@
|
|||||||
}
|
}
|
||||||
if (res.deviceId == these.formData.deviceId) {
|
if (res.deviceId == these.formData.deviceId) {
|
||||||
this.formData.bleStatu = true;
|
this.formData.bleStatu = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -433,8 +426,8 @@
|
|||||||
updateLoading(these, {
|
updateLoading(these, {
|
||||||
text: ex.msg
|
text: ex.msg
|
||||||
})
|
})
|
||||||
these.formData.bleStatu = 'err';
|
these.formData.bleStatu = 'err';
|
||||||
MsgError("连接错误:" + ex.msg, "确定", these);
|
MsgError("连接错误:" + ex.msg, "确定", these);
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
hideLoading(these);
|
hideLoading(these);
|
||||||
@ -442,7 +435,7 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
prevPage() {
|
prevPage() {
|
||||||
uni.navigateBack({
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -459,14 +459,7 @@ created() {
|
|||||||
}
|
}
|
||||||
these.device = device;
|
these.device = device;
|
||||||
these.getWarns();
|
these.getWarns();
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
let f = these.getDevice();
|
||||||
if (v.macAddress == device.deviceMac) {
|
|
||||||
// console.log("找到设备了", v);
|
|
||||||
these.formData.deviceId = v.deviceId;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
if (!f) {
|
if (!f) {
|
||||||
|
|
||||||
|
|
||||||
@ -1304,13 +1297,27 @@ created() {
|
|||||||
},
|
},
|
||||||
getDevice: function() {
|
getDevice: function() {
|
||||||
|
|
||||||
// console.log("LinkedList=", ble.data.LinkedList);
|
|
||||||
// console.log("formData=", these.formData);
|
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
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;
|
||||||
return f;
|
}
|
||||||
|
if(flag){
|
||||||
|
these.formData.deviceId = v.deviceId;
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
});
|
||||||
|
|
||||||
|
// #ifdef WEB
|
||||||
|
f = {
|
||||||
|
deviceId: '123'
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
return f;
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
bleStatuToggle() {
|
bleStatuToggle() {
|
||||||
|
|||||||
2306
pages/102J/HBY102J.vue
Normal file
2306
pages/102J/HBY102J.vue
Normal file
File diff suppressed because it is too large
Load Diff
@ -96,7 +96,7 @@
|
|||||||
<view class="mode type " :class="{'active':formData.sta_Ms=='M'}" @click.stop="modeToggle('M')">
|
<view class="mode type " :class="{'active':formData.sta_Ms=='M'}" @click.stop="modeToggle('M')">
|
||||||
<view class="txt center">M</view>
|
<view class="txt center">M</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="mode type" :class="{'active':formData.sta_Ms=='S'}" @click.stop="modeToggle('S')">
|
<view class="mode type" :class="{'active':formData.sta_Ms=='S'}" @click.stop="modeToggle('S')">
|
||||||
<view class="txt center">S</view>
|
<view class="txt center">S</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -562,14 +562,7 @@
|
|||||||
if (these.device.deviceImei) {
|
if (these.device.deviceImei) {
|
||||||
these.initMQ();
|
these.initMQ();
|
||||||
}
|
}
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
let f = these.getDevice();
|
||||||
if (v.macAddress == device.deviceMac) {
|
|
||||||
console.log("找到设备了", v);
|
|
||||||
these.formData.deviceId = v.deviceId;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
if (!f) {
|
if (!f) {
|
||||||
these.showBleUnConnect();
|
these.showBleUnConnect();
|
||||||
these.getDetail();
|
these.getDetail();
|
||||||
@ -1277,9 +1270,9 @@
|
|||||||
if (!batchTool) {
|
if (!batchTool) {
|
||||||
batchTool = new SendBatchData(these, f, ble);
|
batchTool = new SendBatchData(these, f, ble);
|
||||||
}
|
}
|
||||||
console.log("batch",batchTool);
|
console.log("batch", batchTool);
|
||||||
// batchTool.SendUsr(4);
|
// 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);
|
batchTool.sendUsrByGBK(txts);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1382,15 +1375,15 @@
|
|||||||
let json = {
|
let json = {
|
||||||
ins_Ms: newVal
|
ins_Ms: newVal
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
console.log("new=", this.formData.sta_Ms);
|
console.log("new=", this.formData.sta_Ms);
|
||||||
these.setBleFormData();
|
these.setBleFormData();
|
||||||
console.log("these.formData.sta_Ms=" + these.formData.sta_Ms);
|
console.log("these.formData.sta_Ms=" + these.formData.sta_Ms);
|
||||||
|
|
||||||
if (ble && f) {
|
if (ble && f) {
|
||||||
ble.sendString(f.deviceId, json).then(res=>{
|
ble.sendString(f.deviceId, json).then(res => {
|
||||||
these.formData.sta_Ms = newVal;
|
these.formData.sta_Ms = newVal;
|
||||||
}).catch(ex => {
|
}).catch(ex => {
|
||||||
these.mqSend(json);
|
these.mqSend(json);
|
||||||
@ -1467,19 +1460,23 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
getDevice: function() {
|
getDevice: function() {
|
||||||
|
|
||||||
let f ={deviceId:'123'};
|
let f = ble.data.LinkedList.find((v) => {
|
||||||
// #ifdef APP
|
let flag = v.macAddress == these.device.deviceMac;
|
||||||
f= ble.data.LinkedList.find((v) => {
|
if (!flag && v.device) {
|
||||||
if (v.macAddress == these.device.deviceMac) {
|
flag = v.device.id == these.device.id;
|
||||||
if (!this.formData.deviceId) {
|
|
||||||
this.formData.deviceId = v.deviceId
|
|
||||||
};
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
if (flag) {
|
||||||
|
these.formData.deviceId = v.deviceId;
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
});
|
});
|
||||||
// #endif
|
|
||||||
|
// #ifdef WEB
|
||||||
|
f = {
|
||||||
|
deviceId: '123'
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
|
||||||
return f;
|
return f;
|
||||||
},
|
},
|
||||||
@ -1526,25 +1523,25 @@
|
|||||||
if (!batchTool) {
|
if (!batchTool) {
|
||||||
batchTool = new SendBatchData(these, f, ble);
|
batchTool = new SendBatchData(these, f, ble);
|
||||||
}
|
}
|
||||||
|
|
||||||
batchTool.SendMsgByGBK(this.formData.textLines,mq);
|
batchTool.SendMsgByGBK(this.formData.textLines, mq);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
showLoading(this, {
|
showLoading(this, {
|
||||||
text: "发送中"
|
text: "发送中"
|
||||||
});
|
});
|
||||||
//握手
|
//握手
|
||||||
let holdHand = (hexs, time) => {
|
let holdHand = (hexs, time) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
resolve(true)
|
resolve(true)
|
||||||
}, time);
|
}, time);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//发送3个分包的数据
|
//发送3个分包的数据
|
||||||
let task = (allPixels) => {
|
let task = (allPixels) => {
|
||||||
try {
|
try {
|
||||||
@ -1641,7 +1638,7 @@
|
|||||||
}, 500);
|
}, 500);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("开始发送数据包");
|
console.log("开始发送数据包");
|
||||||
task(results[1].value);
|
task(results[1].value);
|
||||||
})
|
})
|
||||||
@ -1756,7 +1753,7 @@
|
|||||||
}
|
}
|
||||||
if (res.deviceId == these.formData.deviceId) {
|
if (res.deviceId == these.formData.deviceId) {
|
||||||
this.formData.bleStatu = true;
|
this.formData.bleStatu = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|||||||
@ -109,7 +109,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="mode fleft " :class="{active:Status.sendDisc}" v-on:click.stop="discern()">
|
<view class="mode fleft " :class="{active:Status.sendDisc}" v-on:click.stop="discern()">
|
||||||
<view class="leftImg">
|
<view class="leftImg">
|
||||||
<image class="img" src="/static/images/common/svg.png" mode="aspectFit"></image>
|
<image class="img" src="/static/images/common/svg.png" mode="aspectFit"></image>
|
||||||
|
|
||||||
@ -324,7 +324,7 @@
|
|||||||
apiType: 'listA'
|
apiType: 'listA'
|
||||||
}],
|
}],
|
||||||
title: 'BJQ4877',
|
title: 'BJQ4877',
|
||||||
height:90
|
height: 90
|
||||||
|
|
||||||
},
|
},
|
||||||
ShowEditChannel: false,
|
ShowEditChannel: false,
|
||||||
@ -448,8 +448,8 @@
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.Status.navbar.height = uni.getSystemInfoSync().statusBarHeight + 44;
|
this.Status.navbar.height = uni.getSystemInfoSync().statusBarHeight + 44;
|
||||||
},
|
},
|
||||||
onUnload() {
|
onUnload() {
|
||||||
console.log("页面卸载,释放资源");
|
console.log("页面卸载,释放资源");
|
||||||
@ -531,14 +531,7 @@
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
let f = these.getDevice();
|
||||||
if (v.macAddress == device.deviceMac) {
|
|
||||||
// console.log("找到设备了", v);
|
|
||||||
these.formData.deviceId = v.deviceId;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
if (!f) {
|
if (!f) {
|
||||||
|
|
||||||
|
|
||||||
@ -1014,21 +1007,21 @@
|
|||||||
this.Status.sendDisc = true;
|
this.Status.sendDisc = true;
|
||||||
|
|
||||||
let sendNextPacket = () => {
|
let sendNextPacket = () => {
|
||||||
if(index>total){
|
if (index > total) {
|
||||||
this.Status.sendDisc = false;
|
this.Status.sendDisc = false;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ble.sendString(f.deviceId, json, f.writeServiceId, f.wirteCharactId, 30).then(res => {
|
ble.sendString(f.deviceId, json, f.writeServiceId, f.wirteCharactId, 30).then(res => {
|
||||||
index++;
|
index++;
|
||||||
setTimeout(sendNextPacket,300);
|
setTimeout(sendNextPacket, 300);
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
if (err.code == '10007') {
|
if (err.code == '10007') {
|
||||||
setTimeout(sendNextPacket, 800);
|
setTimeout(sendNextPacket, 800);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(index==0){
|
if (index == 0) {
|
||||||
MsgError(err.msg,'',these);
|
MsgError(err.msg, '', these);
|
||||||
}
|
}
|
||||||
this.Status.sendDisc = false;
|
this.Status.sendDisc = false;
|
||||||
});
|
});
|
||||||
@ -1122,7 +1115,7 @@
|
|||||||
}
|
}
|
||||||
if (res.deviceId == these.formData.deviceId) {
|
if (res.deviceId == these.formData.deviceId) {
|
||||||
this.formData.bleStatu = true;
|
this.formData.bleStatu = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -1271,12 +1264,23 @@
|
|||||||
},
|
},
|
||||||
getDevice: function() {
|
getDevice: function() {
|
||||||
|
|
||||||
console.log("LinkedList=", ble.data.LinkedList);
|
|
||||||
console.log("formData=", these.device);
|
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
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;
|
return f;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1614,7 +1618,8 @@
|
|||||||
border-color: #aed600 !important;
|
border-color: #aed600 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.lampMode .mode.active .bigTxt,.lampMode .mode.active .smallTxt {
|
.lampMode .mode.active .bigTxt,
|
||||||
|
.lampMode .mode.active .smallTxt {
|
||||||
|
|
||||||
color: #aed600 !important;
|
color: #aed600 !important;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -502,7 +502,7 @@
|
|||||||
these = this;
|
these = this;
|
||||||
this.initActionData();
|
this.initActionData();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -624,6 +624,9 @@
|
|||||||
|
|
||||||
this.$watch("formData.sta_PowerPercent", (newVal, oldVal) => {
|
this.$watch("formData.sta_PowerPercent", (newVal, oldVal) => {
|
||||||
console.log("电量发生变化");
|
console.log("电量发生变化");
|
||||||
|
if(!newVal){
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (newVal <= 20 && (this.formData.sta_system === 2 || this.formData.sta_system === 0)) {
|
if (newVal <= 20 && (this.formData.sta_system === 2 || this.formData.sta_system === 0)) {
|
||||||
//电量在20%及以及下,且是未充电状态提醒
|
//电量在20%及以及下,且是未充电状态提醒
|
||||||
showPop({
|
showPop({
|
||||||
@ -1110,13 +1113,13 @@
|
|||||||
|
|
||||||
if (combinedData.length === curr - 1) {
|
if (combinedData.length === curr - 1) {
|
||||||
|
|
||||||
Common.saveDeviceLog({
|
Common.saveDeviceLog({
|
||||||
deviceId: this.device.id,
|
deviceId: this.device.id,
|
||||||
name: '发送紧急通知',
|
name: '发送紧急通知',
|
||||||
sendMsg: this.formData.sendMsg.trim()
|
sendMsg: this.formData.sendMsg.trim()
|
||||||
}).catch(ex => {
|
}).catch(ex => {
|
||||||
|
|
||||||
});
|
});
|
||||||
holdHand('transmit complete', 200).then(res => {
|
holdHand('transmit complete', 200).then(res => {
|
||||||
|
|
||||||
MsgSuccess("消息发送成功", "确定", these);
|
MsgSuccess("消息发送成功", "确定", these);
|
||||||
@ -1137,7 +1140,7 @@
|
|||||||
console.log("发送成功", curr);
|
console.log("发送成功", curr);
|
||||||
setTimeout(sendPacket, 1000);
|
setTimeout(sendPacket, 1000);
|
||||||
|
|
||||||
|
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
if (err.code == '10007') {
|
if (err.code == '10007') {
|
||||||
|
|
||||||
@ -1282,17 +1285,23 @@
|
|||||||
},
|
},
|
||||||
getDevice: function() {
|
getDevice: function() {
|
||||||
|
|
||||||
console.log("LinkedList=", ble.data.LinkedList);
|
|
||||||
console.log("this.device=", this.device);
|
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
let f = ble.data.LinkedList.find((v) => {
|
||||||
if (v.macAddress == these.device.deviceMac) {
|
let flag = v.macAddress == these.device.deviceMac;
|
||||||
if (!this.formData.deviceId) {
|
if (!flag && v.device) {
|
||||||
this.formData.deviceId = v.deviceId
|
flag = v.device.id == these.device.id;
|
||||||
};
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
if (flag) {
|
||||||
|
these.formData.deviceId = v.deviceId;
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// #ifdef WEB
|
||||||
|
f = {
|
||||||
|
deviceId: '123'
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
|
||||||
return f;
|
return f;
|
||||||
},
|
},
|
||||||
showBleUnConnect() {
|
showBleUnConnect() {
|
||||||
@ -1430,7 +1439,7 @@
|
|||||||
this.formData.bleStatu = true;
|
this.formData.bleStatu = true;
|
||||||
|
|
||||||
batchTool = new SendBatchData(this, res, ble);
|
batchTool = new SendBatchData(this, res, ble);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -1524,7 +1533,8 @@
|
|||||||
},
|
},
|
||||||
gotoMap() {
|
gotoMap() {
|
||||||
let promise = Promise.resolve([this.formData.sta_longitude, this.formData
|
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 => {
|
promise.then(lnglat => {
|
||||||
|
|
||||||
this.detailData.longitude = lnglat[0];
|
this.detailData.longitude = lnglat[0];
|
||||||
|
|||||||
@ -75,12 +75,12 @@
|
|||||||
<view class="h50">
|
<view class="h50">
|
||||||
<view class="workMode">
|
<view class="workMode">
|
||||||
<view class="item" @click.stop="highSpeedSetting(item,index,true)"
|
<view class="item" @click.stop="highSpeedSetting(item,index,true)"
|
||||||
:class="{'active':formData.sta_highSpeed && formData.sta_LedType===item.key}">
|
:class="{'active':formData.sta_highSpeed && formData.sta_LedType===item.key}">
|
||||||
<view class="checkbox"></view>
|
<view class="checkbox"></view>
|
||||||
<text>强光</text>
|
<text>强光</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="item " @click.stop="highSpeedSetting(item,index,false)"
|
<view class="item " @click.stop="highSpeedSetting(item,index,false)"
|
||||||
:class="{'active':formData.sta_highSpeed===false && formData.sta_LedType===item.key}">
|
:class="{'active':formData.sta_highSpeed===false && formData.sta_LedType===item.key}">
|
||||||
<view class="checkbox "></view>
|
<view class="checkbox "></view>
|
||||||
<text>工作光</text>
|
<text>工作光</text>
|
||||||
</view>
|
</view>
|
||||||
@ -94,7 +94,7 @@
|
|||||||
<view class="mode fleft marginLeft" :class="{'rbActive':formData.SOS}" v-on:click.stop="sosSetting()">
|
<view class="mode fleft marginLeft" :class="{'rbActive':formData.SOS}" v-on:click.stop="sosSetting()">
|
||||||
<view class="leftImg">
|
<view class="leftImg">
|
||||||
<image class="img" :src="formData.SOS?'/static/images/670/sgActive.png':'/static/images/670/sg.png'"
|
<image class="img" :src="formData.SOS?'/static/images/670/sgActive.png':'/static/images/670/sg.png'"
|
||||||
mode="aspectFit">
|
mode="aspectFit">
|
||||||
</image>
|
</image>
|
||||||
</view>
|
</view>
|
||||||
<view class="rightTxt">
|
<view class="rightTxt">
|
||||||
@ -115,9 +115,9 @@
|
|||||||
<view class="mode fleft " @click.stop="playVolume()" :class="{'active':formData.isPlay}">
|
<view class="mode fleft " @click.stop="playVolume()" :class="{'active':formData.isPlay}">
|
||||||
<view class="leftImg">
|
<view class="leftImg">
|
||||||
<image class="img" :class="{'displayNone':formData.isPlay}" src="/static/images/common/play.png"
|
<image class="img" :class="{'displayNone':formData.isPlay}" src="/static/images/common/play.png"
|
||||||
mode="aspectFit"></image>
|
mode="aspectFit"></image>
|
||||||
<image class="img" :class="{'displayNone':!formData.isPlay}"
|
<image class="img" :class="{'displayNone':!formData.isPlay}"
|
||||||
src="/static/images/common/playingActive.png" mode="aspectFit"></image>
|
src="/static/images/common/playingActive.png" mode="aspectFit"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="rightTxt">
|
<view class="rightTxt">
|
||||||
<text class="bigTxt">{{formData.isPlay?'正在播放':'播放语音'}}</text>
|
<text class="bigTxt">{{formData.isPlay?'正在播放':'播放语音'}}</text>
|
||||||
@ -184,14 +184,14 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<ProParams :id="device.id"></ProParams>
|
<ProParams :id="device.id"></ProParams>
|
||||||
<!-- 弹窗通知 -->
|
<!-- 弹窗通知 -->
|
||||||
<MessagePopup v-for="item,key in Msgboxs" :visible="item.showPop" :type="item.popType" :bgColor="item.bgColor"
|
<MessagePopup v-for="item,key in Msgboxs" :visible="item.showPop" :type="item.popType" :bgColor="item.bgColor"
|
||||||
:borderColor="item.borderColor" :textColor="item.textColor" :buttonBgColor="item.buttonBgColor"
|
:borderColor="item.borderColor" :textColor="item.textColor" :buttonBgColor="item.buttonBgColor"
|
||||||
:buttonTextColor="item.buttonTextColor" :iconUrl="item.iconUrl" :message="item.message"
|
:buttonTextColor="item.buttonTextColor" :iconUrl="item.iconUrl" :message="item.message"
|
||||||
:buttonText="item.buttonText" @buttonClick="item.okCallback(item)" :visiblePrompt="item.visiblePrompt"
|
:buttonText="item.buttonText" @buttonClick="item.okCallback(item)" :visiblePrompt="item.visiblePrompt"
|
||||||
:promptTitle="item.promptTitle" v-model="item.modelValue" @closePop="closePop(item)"
|
:promptTitle="item.promptTitle" v-model="item.modelValue" @closePop="closePop(item)"
|
||||||
:buttonCancelText="item.buttonCancelText" :showCancel="item.showCancel" @cancelPop="closePop(item)" />
|
:buttonCancelText="item.buttonCancelText" :showCancel="item.showCancel" @cancelPop="closePop(item)" />
|
||||||
|
|
||||||
<!-- 下方菜单 -->
|
<!-- 下方菜单 -->
|
||||||
|
|
||||||
@ -205,7 +205,7 @@
|
|||||||
|
|
||||||
<view class="header">
|
<view class="header">
|
||||||
<uni-icons @click.stop="Status.showVolumPop=false" type="closeempty" size="15"
|
<uni-icons @click.stop="Status.showVolumPop=false" type="closeempty" size="15"
|
||||||
color="#FFFFFFde"></uni-icons>
|
color="#FFFFFFde"></uni-icons>
|
||||||
</view>
|
</view>
|
||||||
<view class="txtContent">
|
<view class="txtContent">
|
||||||
<view class="volTxt">
|
<view class="volTxt">
|
||||||
@ -218,8 +218,8 @@
|
|||||||
<view class="slider-container">
|
<view class="slider-container">
|
||||||
|
|
||||||
<slider min="0" max="100" step="1" :disabled="false" :value="formData.volumn" activeColor="#bbe600"
|
<slider min="0" max="100" step="1" :disabled="false" :value="formData.volumn" activeColor="#bbe600"
|
||||||
backgroundColor="#686767" block-size="20" block-color="#ffffffde" @change="volumechange"
|
backgroundColor="#686767" block-size="20" block-color="#ffffffde" @change="volumechange"
|
||||||
@changing="volumechange" class="custom-slider" />
|
@changing="volumechange" class="custom-slider" />
|
||||||
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
@ -245,13 +245,13 @@
|
|||||||
} from '@/utils/request.js'
|
} from '@/utils/request.js'
|
||||||
|
|
||||||
import Common from '@/utils/Common.js';
|
import Common from '@/utils/Common.js';
|
||||||
import {
|
import {
|
||||||
MsgSuccess,
|
MsgSuccess,
|
||||||
MsgError,
|
MsgError,
|
||||||
MsgClose,
|
MsgClose,
|
||||||
MsgWarning,
|
MsgWarning,
|
||||||
showPop,
|
showPop,
|
||||||
MsgInfo
|
MsgInfo
|
||||||
} from '@/utils/MsgPops.js'
|
} from '@/utils/MsgPops.js'
|
||||||
|
|
||||||
const pagePath = "/pages/018A/HBY018A";
|
const pagePath = "/pages/018A/HBY018A";
|
||||||
@ -377,14 +377,7 @@
|
|||||||
// console.log("收到父页面的参数:" + JSON.stringify(data));
|
// console.log("收到父页面的参数:" + JSON.stringify(data));
|
||||||
var device = data.data;
|
var device = data.data;
|
||||||
these.device = device;
|
these.device = device;
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
let f = these.getDevice();
|
||||||
if (v.macAddress == device.deviceMac) {
|
|
||||||
// console.log("找到设备了", v);
|
|
||||||
these.formData.deviceId = v.deviceId;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
if (!f) {
|
if (!f) {
|
||||||
|
|
||||||
|
|
||||||
@ -407,10 +400,10 @@
|
|||||||
these.formData.deviceId = f.deviceId;
|
these.formData.deviceId = f.deviceId;
|
||||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
}).catch(ex => {
|
}).catch(ex => {
|
||||||
these.formData.bleStatu = 'err';
|
these.formData.bleStatu = 'err';
|
||||||
MsgError("连接错误:" + ex.msg, "确定", these);
|
MsgError("连接错误:" + ex.msg, "确定", these);
|
||||||
});;
|
});;
|
||||||
|
|
||||||
these.setBleFormData();
|
these.setBleFormData();
|
||||||
|
|
||||||
@ -424,17 +417,17 @@
|
|||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.Status.pageHide = false;
|
this.Status.pageHide = false;
|
||||||
let f = this.getDevice();
|
let f = this.getDevice();
|
||||||
if (f) {
|
if (f) {
|
||||||
these.formData.bleStatu = 'connecting';
|
these.formData.bleStatu = 'connecting';
|
||||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
console.log("连接成功")
|
console.log("连接成功")
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
}).catch(ex => {
|
}).catch(ex => {
|
||||||
these.formData.bleStatu = 'err';
|
these.formData.bleStatu = 'err';
|
||||||
MsgError("连接错误:" + ex.msg, "确定", these);
|
MsgError("连接错误:" + ex.msg, "确定", these);
|
||||||
});;
|
});;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
||||||
@ -555,7 +548,7 @@
|
|||||||
buttonText: '确定',
|
buttonText: '确定',
|
||||||
buttonCancelText: '取消',
|
buttonCancelText: '取消',
|
||||||
showCancel: true
|
showCancel: true
|
||||||
},these);
|
}, these);
|
||||||
} else {
|
} else {
|
||||||
exec();
|
exec();
|
||||||
}
|
}
|
||||||
@ -582,7 +575,7 @@
|
|||||||
this.formData.sta_highSpeed = flag;
|
this.formData.sta_highSpeed = flag;
|
||||||
},
|
},
|
||||||
LighSetting(item, index) { //灯光模式切换
|
LighSetting(item, index) { //灯光模式切换
|
||||||
|
|
||||||
let val = item.key;
|
let val = item.key;
|
||||||
if (item.key === this.formData.sta_LedType) {
|
if (item.key === this.formData.sta_LedType) {
|
||||||
val = 'led_off';
|
val = 'led_off';
|
||||||
@ -671,7 +664,7 @@
|
|||||||
buttonText: '确定',
|
buttonText: '确定',
|
||||||
buttonCancelText: '取消',
|
buttonCancelText: '取消',
|
||||||
showCancel: true
|
showCancel: true
|
||||||
},these);
|
}, these);
|
||||||
|
|
||||||
},
|
},
|
||||||
deviceRecovry(res) {
|
deviceRecovry(res) {
|
||||||
@ -680,7 +673,7 @@
|
|||||||
}
|
}
|
||||||
if (res.deviceId == these.formData.deviceId) {
|
if (res.deviceId == these.formData.deviceId) {
|
||||||
this.formData.bleStatu = true;
|
this.formData.bleStatu = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -731,7 +724,7 @@
|
|||||||
updateLoading(these, {
|
updateLoading(these, {
|
||||||
text: ex.msg
|
text: ex.msg
|
||||||
});
|
});
|
||||||
these.formData.bleStatu = 'err';
|
these.formData.bleStatu = 'err';
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
hideLoading(these);
|
hideLoading(these);
|
||||||
@ -803,12 +796,23 @@
|
|||||||
|
|
||||||
getDevice: function() {
|
getDevice: function() {
|
||||||
|
|
||||||
// console.log("LinkedList=", ble.data.LinkedList);
|
|
||||||
// console.log("formData=", these.formData);
|
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
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;
|
return f;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -834,7 +838,7 @@
|
|||||||
borderColor: "#e034344d",
|
borderColor: "#e034344d",
|
||||||
buttonBgColor: "#E03434",
|
buttonBgColor: "#E03434",
|
||||||
buttonText: '去连接',
|
buttonText: '去连接',
|
||||||
buttonTextColor: '#FFFFFFde',
|
buttonTextColor: '#FFFFFFde',
|
||||||
okCallback: function() {
|
okCallback: function() {
|
||||||
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
@ -856,10 +860,10 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},these);
|
}, these);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//关闭某个弹窗,并执行关闭的回调函数
|
//关闭某个弹窗,并执行关闭的回调函数
|
||||||
@ -883,7 +887,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
showMsg(msg, type) {
|
showMsg(msg, type) {
|
||||||
|
|
||||||
let cfg = {
|
let cfg = {
|
||||||
@ -922,7 +926,7 @@
|
|||||||
buttonText: '确定',
|
buttonText: '确定',
|
||||||
okCallback: this.closePop
|
okCallback: this.closePop
|
||||||
};
|
};
|
||||||
showPop(options,these);
|
showPop(options, these);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1401,7 +1405,7 @@
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.slider-container {
|
.slider-container {
|
||||||
@ -1846,6 +1850,4 @@
|
|||||||
.volMath {
|
.volMath {
|
||||||
color: rgba(174, 214, 0, 1);
|
color: rgba(174, 214, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
@ -37,7 +37,8 @@
|
|||||||
<view class="row">
|
<view class="row">
|
||||||
<image class="img" src="/static/images/common/time.png" mode="aspectFit"></image>
|
<image class="img" src="/static/images/common/time.png" mode="aspectFit"></image>
|
||||||
<view class="txt">
|
<view class="txt">
|
||||||
<view class="bigTxt" v-show="getMode('main')!='关闭'||getMode('fu')!='关闭'">{{formData.xuhang}}</view>
|
<view class="bigTxt" v-show="getMode('main')!='关闭'||getMode('fu')!='关闭'">{{formData.xuhang}}
|
||||||
|
</view>
|
||||||
<view class="smallTxt">续航时间</view>
|
<view class="smallTxt">续航时间</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -209,7 +210,7 @@
|
|||||||
apiType: 'listA'
|
apiType: 'listA'
|
||||||
}],
|
}],
|
||||||
title: 'BJQ6155',
|
title: 'BJQ6155',
|
||||||
height:90
|
height: 90
|
||||||
|
|
||||||
},
|
},
|
||||||
lightMode: {
|
lightMode: {
|
||||||
@ -340,8 +341,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.Status.navbar.height = uni.getSystemInfoSync().statusBarHeight + 44;
|
this.Status.navbar.height = uni.getSystemInfoSync().statusBarHeight + 44;
|
||||||
},
|
},
|
||||||
onUnload() {
|
onUnload() {
|
||||||
ble.removeAllCallback(pagePath);
|
ble.removeAllCallback(pagePath);
|
||||||
},
|
},
|
||||||
@ -375,14 +376,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
let f = these.getDevice();
|
||||||
if (v.macAddress == device.deviceMac) {
|
|
||||||
// console.log("找到设备了", v);
|
|
||||||
these.formData.deviceId = v.deviceId;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
if (!f) {
|
if (!f) {
|
||||||
|
|
||||||
these.getDetail();
|
these.getDetail();
|
||||||
@ -591,7 +585,7 @@
|
|||||||
}
|
}
|
||||||
if (res.deviceId == these.formData.deviceId) {
|
if (res.deviceId == these.formData.deviceId) {
|
||||||
this.formData.bleStatu = true;
|
this.formData.bleStatu = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -665,12 +659,23 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
getDevice: function() {
|
getDevice: function() {
|
||||||
// console.log("LinkedList=", ble.data.LinkedList);
|
|
||||||
// console.log("formData=", these.formData);
|
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
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;
|
return f;
|
||||||
},
|
},
|
||||||
bleValueNotify: function(receive, device, path, recArr) {
|
bleValueNotify: function(receive, device, path, recArr) {
|
||||||
@ -1658,8 +1663,8 @@
|
|||||||
unitName: these.formData.textLines[2],
|
unitName: these.formData.textLines[2],
|
||||||
code: ""
|
code: ""
|
||||||
};
|
};
|
||||||
usrApi.sendUsr(json).catch(ex=>{
|
usrApi.sendUsr(json).catch(ex => {
|
||||||
console.error("ex=",ex);
|
console.error("ex=", ex);
|
||||||
});
|
});
|
||||||
|
|
||||||
hideLoading(these);
|
hideLoading(these);
|
||||||
@ -1743,12 +1748,14 @@
|
|||||||
getDetail() {
|
getDetail() {
|
||||||
var these = this;
|
var these = this;
|
||||||
usrApi.getDetail(this.device.id).then(res => {
|
usrApi.getDetail(this.device.id).then(res => {
|
||||||
|
|
||||||
if (res && res.code == 200) {
|
if (res && res.code == 200) {
|
||||||
res = res.data;
|
res = res.data;
|
||||||
let personnelInfo = res.personnelInfo;
|
let personnelInfo = res.personnelInfo;
|
||||||
if (personnelInfo) {
|
if (personnelInfo) {
|
||||||
these.formData.textLines=[personnelInfo.position, personnelInfo.name,personnelInfo.unitName];
|
these.formData.textLines = [personnelInfo.position, personnelInfo.name, personnelInfo
|
||||||
|
.unitName
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
<view slot="right">
|
<view slot="right">
|
||||||
<view class="navbarRight center">
|
<view class="navbarRight center">
|
||||||
<view class="imgContent" :class="{'visibilityHidden':Status.apiType!=item.apiType}"
|
<view class="imgContent" :class="{'visibilityHidden':Status.apiType!=item.apiType}"
|
||||||
@click.stop="handleRightClick(item,index)" v-for="item,index in Status.navbar.icons">
|
@click.stop="handleRightClick(item,index)" v-for="item,index in Status.navbar.icons">
|
||||||
<image class="img" :src="item.src" mode="aspectFit"></image>
|
<image class="img" :src="item.src" mode="aspectFit"></image>
|
||||||
<view class="baber" v-if="item.math">{{item.math>9?'9+':item.math}}</view>
|
<view class="baber" v-if="item.math">{{item.math>9?'9+':item.math}}</view>
|
||||||
</view>
|
</view>
|
||||||
@ -75,8 +75,8 @@
|
|||||||
|
|
||||||
<view class="slider-container">
|
<view class="slider-container">
|
||||||
<slider min="1" max="100" step="1" :disabled="false" :value="formData.liangDu" activeColor="#bbe600"
|
<slider min="1" max="100" step="1" :disabled="false" :value="formData.liangDu" activeColor="#bbe600"
|
||||||
backgroundColor="#00000000" block-size="20" block-color="#ffffffde" @change="sliderChange"
|
backgroundColor="#00000000" block-size="20" block-color="#ffffffde" @change="sliderChange"
|
||||||
@changing="sliderChange" class="custom-slider" />
|
@changing="sliderChange" class="custom-slider" />
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -125,33 +125,33 @@
|
|||||||
<view class="btnSend fright" v-on:click.stop="sendUsr">发送</view>
|
<view class="btnSend fright" v-on:click.stop="sendUsr">发送</view>
|
||||||
<view class="clear"></view>
|
<view class="clear"></view>
|
||||||
<TextToHexV1 class="TextToHex" ref="textToHex" :txts="formData.textLines" :bgColor="'#FFFFFF'"
|
<TextToHexV1 class="TextToHex" ref="textToHex" :txts="formData.textLines" :bgColor="'#FFFFFF'"
|
||||||
:color="'#000000'" :fontSize="14" />
|
:color="'#000000'" :fontSize="14" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<text class="lbl">单位:</text>
|
<text class="lbl">单位:</text>
|
||||||
<input class="value" v-model.trim="formData.textLines[0]" placeholder="请输入单位"
|
<input class="value" v-model.trim="formData.textLines[0]" placeholder="请输入单位"
|
||||||
placeholder-class="usrplace" />
|
placeholder-class="usrplace" />
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<text class="lbl">部门:</text>
|
<text class="lbl">部门:</text>
|
||||||
<input class="value" v-model.trim="formData.textLines[1]" placeholder="请输入姓名"
|
<input class="value" v-model.trim="formData.textLines[1]" placeholder="请输入姓名"
|
||||||
placeholder-class="usrplace" />
|
placeholder-class="usrplace" />
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<text class="lbl">姓名:</text>
|
<text class="lbl">姓名:</text>
|
||||||
<input class="value" v-model.trim="formData.textLines[2]" placeholder="请输入职位"
|
<input class="value" v-model.trim="formData.textLines[2]" placeholder="请输入职位"
|
||||||
placeholder-class="usrplace" />
|
placeholder-class="usrplace" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<ProParams :id="device.id"></ProParams>
|
<ProParams :id="device.id"></ProParams>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- 下方菜单 -->
|
<!-- 下方菜单 -->
|
||||||
<BottomSlideMenuPlus :config="Status.BottomMenu" @close="closeMenu" @itemClick="handleItemClick"
|
<BottomSlideMenuPlus :config="Status.BottomMenu" @close="closeMenu" @itemClick="handleItemClick"
|
||||||
@btnClick="btnClick">
|
@btnClick="btnClick">
|
||||||
<view class="addIco">
|
<view class="addIco">
|
||||||
<view class="icoContent center" v-on:click.stop="checkImgUpload()">
|
<view class="icoContent center" v-on:click.stop="checkImgUpload()">
|
||||||
<image mode="aspectFit" class="img" src="/static/images/6155/DeviceDetail/add.png"></image>
|
<image mode="aspectFit" class="img" src="/static/images/6155/DeviceDetail/add.png"></image>
|
||||||
@ -181,14 +181,14 @@
|
|||||||
} from '@/utils/request.js';
|
} from '@/utils/request.js';
|
||||||
|
|
||||||
var pagePath = "/pages/6155/deviceDetail";
|
var pagePath = "/pages/6155/deviceDetail";
|
||||||
import {
|
import {
|
||||||
MsgSuccess,
|
MsgSuccess,
|
||||||
MsgError,
|
MsgError,
|
||||||
MsgClose,
|
MsgClose,
|
||||||
MsgWarning,
|
MsgWarning,
|
||||||
showPop,
|
showPop,
|
||||||
MsgInfo
|
MsgInfo
|
||||||
} from '@/utils/MsgPops.js'
|
} from '@/utils/MsgPops.js'
|
||||||
|
|
||||||
var ble = null;
|
var ble = null;
|
||||||
var these = null;
|
var these = null;
|
||||||
@ -212,7 +212,7 @@
|
|||||||
apiType: 'listA'
|
apiType: 'listA'
|
||||||
}],
|
}],
|
||||||
title: 'BJQ6155',
|
title: 'BJQ6155',
|
||||||
height:90
|
height: 90
|
||||||
|
|
||||||
},
|
},
|
||||||
Pop: {
|
Pop: {
|
||||||
@ -310,8 +310,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.Status.navbar.height = uni.getSystemInfoSync().statusBarHeight + 44;
|
this.Status.navbar.height = uni.getSystemInfoSync().statusBarHeight + 44;
|
||||||
},
|
},
|
||||||
onUnload() {
|
onUnload() {
|
||||||
ble.removeAllCallback(pagePath);
|
ble.removeAllCallback(pagePath);
|
||||||
},
|
},
|
||||||
@ -344,14 +344,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
let f = these.getDevice();
|
||||||
if (v.macAddress == device.deviceMac) {
|
|
||||||
console.log("找到设备了", v);
|
|
||||||
these.formData.deviceId = v.deviceId;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
if (!f) {
|
if (!f) {
|
||||||
|
|
||||||
these.getDetail();
|
these.getDetail();
|
||||||
@ -374,10 +367,10 @@
|
|||||||
these.formData.bleStatu = 'connecting';
|
these.formData.bleStatu = 'connecting';
|
||||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
}).catch(ex => {
|
}).catch(ex => {
|
||||||
these.formData.bleStatu = 'err';
|
these.formData.bleStatu = 'err';
|
||||||
MsgError("连接错误:" + ex.msg, "确定", these);
|
MsgError("连接错误:" + ex.msg, "确定", these);
|
||||||
});
|
});
|
||||||
these.setBleFormData();
|
these.setBleFormData();
|
||||||
these.getDetail();
|
these.getDetail();
|
||||||
|
|
||||||
@ -390,18 +383,18 @@
|
|||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.Status.pageHide = false;
|
this.Status.pageHide = false;
|
||||||
|
|
||||||
let f=this.getDevice();
|
let f = this.getDevice();
|
||||||
if(f){
|
if (f) {
|
||||||
these.formData.bleStatu = 'connecting';
|
these.formData.bleStatu = 'connecting';
|
||||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
console.log("连接成功")
|
console.log("连接成功")
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
}).catch(ex => {
|
}).catch(ex => {
|
||||||
these.formData.bleStatu = 'err';
|
these.formData.bleStatu = 'err';
|
||||||
MsgError("连接错误:" + ex.msg, "确定", these);
|
MsgError("连接错误:" + ex.msg, "确定", these);
|
||||||
});;
|
});;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onBackPress(e) {
|
onBackPress(e) {
|
||||||
|
|
||||||
@ -447,7 +440,7 @@
|
|||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
}).catch(ex => {
|
}).catch(ex => {
|
||||||
these.formData.bleStatu = 'err';
|
these.formData.bleStatu = 'err';
|
||||||
MsgError("连接错误:" + ex.msg, "确定", these);
|
MsgError("连接错误:" + ex.msg, "确定", these);
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -558,7 +551,7 @@
|
|||||||
}
|
}
|
||||||
if (res.deviceId == these.formData.deviceId) {
|
if (res.deviceId == these.formData.deviceId) {
|
||||||
this.formData.bleStatu = true;
|
this.formData.bleStatu = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -567,9 +560,9 @@
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
if (res.deviceId == these.formData.deviceId) {
|
if (res.deviceId == these.formData.deviceId) {
|
||||||
if(res.device){
|
if (res.device) {
|
||||||
these.formData.bleStatu = 'connecting';
|
these.formData.bleStatu = 'connecting';
|
||||||
}else{
|
} else {
|
||||||
this.formData.bleStatu = false;
|
this.formData.bleStatu = false;
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -614,7 +607,7 @@
|
|||||||
updateLoading(these, {
|
updateLoading(these, {
|
||||||
text: ex.msg
|
text: ex.msg
|
||||||
});
|
});
|
||||||
these.formData.bleStatu = 'err';
|
these.formData.bleStatu = 'err';
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
hideLoading(these);
|
hideLoading(these);
|
||||||
@ -632,12 +625,23 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
getDevice: function() {
|
getDevice: function() {
|
||||||
// console.log("LinkedList=", ble.data.LinkedList);
|
|
||||||
// console.log("formData=", these.formData);
|
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
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;
|
return f;
|
||||||
},
|
},
|
||||||
bleValueNotify: function(receive, device, path, recArr) {
|
bleValueNotify: function(receive, device, path, recArr) {
|
||||||
@ -678,7 +682,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
showBleUnConnect() {
|
showBleUnConnect() {
|
||||||
this.showPop({
|
this.showPop({
|
||||||
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
|
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
|
||||||
@ -686,7 +690,7 @@
|
|||||||
borderColor: "#e034344d",
|
borderColor: "#e034344d",
|
||||||
buttonBgColor: "#E03434",
|
buttonBgColor: "#E03434",
|
||||||
buttonText: '去连接',
|
buttonText: '去连接',
|
||||||
buttonTextColor: '#FFFFFFde',
|
buttonTextColor: '#FFFFFFde',
|
||||||
okCallback: function() {
|
okCallback: function() {
|
||||||
// console.log("1111");
|
// console.log("1111");
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
@ -901,7 +905,7 @@
|
|||||||
uni.chooseImage({
|
uni.chooseImage({
|
||||||
count: 1,
|
count: 1,
|
||||||
sizeType: ['original', 'compressed'],
|
sizeType: ['original', 'compressed'],
|
||||||
sourceType: ['album','camera'],
|
sourceType: ['album', 'camera'],
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/common/ImgCrop/ImgCrop",
|
url: "/pages/common/ImgCrop/ImgCrop",
|
||||||
@ -1594,7 +1598,7 @@
|
|||||||
option.buttonBgColor = '#BBE600';
|
option.buttonBgColor = '#BBE600';
|
||||||
}
|
}
|
||||||
these.Status.Pop.showPop = true;
|
these.Status.Pop.showPop = true;
|
||||||
showPop(option,this);
|
showPop(option, this);
|
||||||
},
|
},
|
||||||
sendUsr() {
|
sendUsr() {
|
||||||
|
|
||||||
@ -2162,7 +2166,7 @@
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.slider-container {
|
.slider-container {
|
||||||
|
|||||||
@ -557,14 +557,22 @@
|
|||||||
if (ble) {
|
if (ble) {
|
||||||
|
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
let f = ble.data.LinkedList.find((v) => {
|
||||||
if (v.macAddress == this.itemInfo.deviceMac) {
|
let flag = v.macAddress == these.device.deviceMac;
|
||||||
if (!this.formData.deviceId) {
|
if (!flag && v.device) {
|
||||||
this.formData.deviceId = v.deviceId
|
flag = v.device.id == these.device.id;
|
||||||
};
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
if (flag) {
|
||||||
|
these.formData.deviceId = v.deviceId;
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// #ifdef WEB
|
||||||
|
f = {
|
||||||
|
deviceId: '123'
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -692,7 +700,7 @@
|
|||||||
deviceRecovry(res) {
|
deviceRecovry(res) {
|
||||||
console.log('蓝牙连接成功');
|
console.log('蓝牙连接成功');
|
||||||
if (res.deviceId == this.formData.deviceId) {
|
if (res.deviceId == this.formData.deviceId) {
|
||||||
this.formData.bleStatu = true;
|
this.formData.bleStatu = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -2117,14 +2125,7 @@
|
|||||||
this.initBle();
|
this.initBle();
|
||||||
|
|
||||||
console.log("ble=", ble);
|
console.log("ble=", ble);
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
let f = these.getDevice();
|
||||||
if (v.macAddress == this.itemInfo.deviceMac) {
|
|
||||||
console.log("找到设备了", v);
|
|
||||||
these.formData.deviceId = v.deviceId;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (f) {
|
if (f) {
|
||||||
these.formData.bleStatu = 'connecting';
|
these.formData.bleStatu = 'connecting';
|
||||||
|
|||||||
@ -45,34 +45,34 @@
|
|||||||
<view class="title">
|
<view class="title">
|
||||||
<text>照明模式</text>
|
<text>照明模式</text>
|
||||||
<text @click="showLihgtPercent('shuxie')"
|
<text @click="showLihgtPercent('shuxie')"
|
||||||
:class="formData.lightCurr=='shuxie'?'active':'noActive'">亮度</text>
|
:class="formData.lightCurr=='shuxie'?'active':'noActive'">亮度</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
<view class="lightMode">
|
<view class="lightMode">
|
||||||
<view class="item" @click="lightSetting('shuxie')" @longpress="showLihgtPercent('shuxie')"
|
<view class="item" @click="lightSetting('shuxie')" @longpress="showLihgtPercent('shuxie')"
|
||||||
:class="formData.lightCurr=='shuxie'?'active':''">
|
:class="formData.lightCurr=='shuxie'?'active':''">
|
||||||
<view class="imgContent center">
|
<view class="imgContent center">
|
||||||
<image class="img"
|
<image class="img"
|
||||||
:src="formData.lightCurr=='shuxie'?'/static/images/6331/shuxieActive.png':'/static/images/6331/shuXie.png'"
|
:src="formData.lightCurr=='shuxie'?'/static/images/6331/shuxieActive.png':'/static/images/6331/shuXie.png'"
|
||||||
mode="aspectFit"></image>
|
mode="aspectFit"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="txt">书写</view>
|
<view class="txt">书写</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item" @click="lightSetting('work')" :class="formData.lightCurr=='work'?'active':''">
|
<view class="item" @click="lightSetting('work')" :class="formData.lightCurr=='work'?'active':''">
|
||||||
<view class="imgContent center">
|
<view class="imgContent center">
|
||||||
<image class="img"
|
<image class="img"
|
||||||
:src="formData.lightCurr=='work'?'/static/images/6331/workActive.png':'/static/images/6331/work.png'"
|
:src="formData.lightCurr=='work'?'/static/images/6331/workActive.png':'/static/images/6331/work.png'"
|
||||||
mode="aspectFit"></image>
|
mode="aspectFit"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="txt">工作光</view>
|
<view class="txt">工作光</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item" @click="lightSetting('jieN')" :class="formData.lightCurr=='jieN'?'active':''">
|
<view class="item" @click="lightSetting('jieN')" :class="formData.lightCurr=='jieN'?'active':''">
|
||||||
<view class="imgContent center">
|
<view class="imgContent center">
|
||||||
<image class="img"
|
<image class="img"
|
||||||
:src="formData.lightCurr=='jieN'?'/static/images/lightImg/jieNActive.png':'/static/images/lightImg/jieN.png'"
|
:src="formData.lightCurr=='jieN'?'/static/images/lightImg/jieNActive.png':'/static/images/lightImg/jieN.png'"
|
||||||
mode="aspectFit"></image>
|
mode="aspectFit"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="txt">节能光</view>
|
<view class="txt">节能光</view>
|
||||||
</view>
|
</view>
|
||||||
@ -130,7 +130,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="mode fleft marginLeft noMargintop" :class="formData.cMode?'active':''"
|
<view class="mode fleft marginLeft noMargintop" :class="formData.cMode?'active':''"
|
||||||
v-on:click.stop="audioManage()">
|
v-on:click.stop="audioManage()">
|
||||||
<view class="leftImg">
|
<view class="leftImg">
|
||||||
<image class="img" src="/static/images/6331/upload.png" mode="aspectFit"></image>
|
<image class="img" src="/static/images/6331/upload.png" mode="aspectFit"></image>
|
||||||
</view>
|
</view>
|
||||||
@ -153,15 +153,15 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
<ProParams :id="device.id"></ProParams>
|
<ProParams :id="device.id"></ProParams>
|
||||||
|
|
||||||
<!-- 弹窗通知 -->
|
<!-- 弹窗通知 -->
|
||||||
<MessagePopup :visible="Status.Pop.showPop" :type="Status.Pop.popType" :bgColor="Status.Pop.bgColor"
|
<MessagePopup :visible="Status.Pop.showPop" :type="Status.Pop.popType" :bgColor="Status.Pop.bgColor"
|
||||||
:borderColor="Status.Pop.borderColor" :textColor="Status.Pop.textColor"
|
:borderColor="Status.Pop.borderColor" :textColor="Status.Pop.textColor"
|
||||||
:buttonBgColor="Status.Pop.buttonBgColor" :buttonTextColor="Status.Pop.buttonTextColor"
|
:buttonBgColor="Status.Pop.buttonBgColor" :buttonTextColor="Status.Pop.buttonTextColor"
|
||||||
:iconUrl="Status.Pop.iconUrl" :message="Status.Pop.message" :buttonText="Status.Pop.buttonText"
|
:iconUrl="Status.Pop.iconUrl" :message="Status.Pop.message" :buttonText="Status.Pop.buttonText"
|
||||||
@buttonClick="HidePop" :visiblePrompt="Status.Pop.visiblePrompt" :promptTitle="Status.Pop.promptTitle"
|
@buttonClick="HidePop" :visiblePrompt="Status.Pop.visiblePrompt" :promptTitle="Status.Pop.promptTitle"
|
||||||
v-model="Status.Pop.modelValue" @closePop="closePop" :showSlot="Status.Pop.showSlot">
|
v-model="Status.Pop.modelValue" @closePop="closePop" :showSlot="Status.Pop.showSlot">
|
||||||
|
|
||||||
<view :class="Status.showLightingSet?'':'displayNone'">
|
<view :class="Status.showLightingSet?'':'displayNone'">
|
||||||
<view class="slideTitle">
|
<view class="slideTitle">
|
||||||
@ -170,8 +170,8 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="slider-container">
|
<view class="slider-container">
|
||||||
<slider min="1" max="100" step="1" :disabled="false" :value="formData.liangDu" activeColor="#bbe600"
|
<slider min="1" max="100" step="1" :disabled="false" :value="formData.liangDu" activeColor="#bbe600"
|
||||||
backgroundColor="#00000000" block-size="20" block-color="#ffffffde" @change="sliderChange"
|
backgroundColor="#00000000" block-size="20" block-color="#ffffffde" @change="sliderChange"
|
||||||
@changing="sliderChange" class="custom-slider" />
|
@changing="sliderChange" class="custom-slider" />
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -183,8 +183,8 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="slider-container">
|
<view class="slider-container">
|
||||||
<slider min="1" max="100" step="1" :disabled="false" :value="formData.volume" activeColor="#bbe600"
|
<slider min="1" max="100" step="1" :disabled="false" :value="formData.volume" activeColor="#bbe600"
|
||||||
backgroundColor="#00000000" block-size="20" block-color="#ffffffde" @change="sliderChange"
|
backgroundColor="#00000000" block-size="20" block-color="#ffffffde" @change="sliderChange"
|
||||||
@changing="sliderChange" class="custom-slider" />
|
@changing="sliderChange" class="custom-slider" />
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -193,7 +193,7 @@
|
|||||||
|
|
||||||
<!-- 下方菜单 -->
|
<!-- 下方菜单 -->
|
||||||
<BottomSlideMenuPlus :config="Status.BottomMenu" @close="closeMenu" @itemClick="handleItemClick"
|
<BottomSlideMenuPlus :config="Status.BottomMenu" @close="closeMenu" @itemClick="handleItemClick"
|
||||||
@btnClick="btnClick">
|
@btnClick="btnClick">
|
||||||
<view>
|
<view>
|
||||||
<view class="addIco">
|
<view class="addIco">
|
||||||
<view class="icoContent center" v-on:click.stop="checkImgUpload()">
|
<view class="icoContent center" v-on:click.stop="checkImgUpload()">
|
||||||
@ -218,17 +218,19 @@
|
|||||||
hideLoading,
|
hideLoading,
|
||||||
updateLoading
|
updateLoading
|
||||||
} from '@/utils/loading.js'
|
} 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 usrApi from '@/api/670/HBY670.js';
|
||||||
import {
|
import {
|
||||||
MsgSuccess,
|
MsgSuccess,
|
||||||
MsgError,
|
MsgError,
|
||||||
MsgClose,
|
MsgClose,
|
||||||
MsgWarning,
|
MsgWarning,
|
||||||
showPop,
|
showPop,
|
||||||
MsgInfo
|
MsgInfo
|
||||||
} from '@/utils/MsgPops.js'
|
} from '@/utils/MsgPops.js'
|
||||||
const pagePath = "pages/6331/BJQ6331";
|
const pagePath = "pages/6331/BJQ6331";
|
||||||
|
|
||||||
var ble = null;
|
var ble = null;
|
||||||
@ -360,14 +362,7 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
// console.log("收到父页面的参数:" + JSON.stringify(data));
|
// console.log("收到父页面的参数:" + JSON.stringify(data));
|
||||||
var device = data.data;
|
var device = data.data;
|
||||||
these.device = device;
|
these.device = device;
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
let f = these.getDevice();
|
||||||
if (v.macAddress == device.deviceMac) {
|
|
||||||
// console.log("找到设备了", v);
|
|
||||||
these.formData.deviceId = v.deviceId;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
if (!f) {
|
if (!f) {
|
||||||
|
|
||||||
|
|
||||||
@ -388,15 +383,15 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
}
|
}
|
||||||
these.formData.blename = f.name ? f.name : "Unname";
|
these.formData.blename = f.name ? f.name : "Unname";
|
||||||
these.formData.deviceName = device.deviceName;
|
these.formData.deviceName = device.deviceName;
|
||||||
|
|
||||||
|
|
||||||
these.formData.deviceId = f.deviceId;
|
these.formData.deviceId = f.deviceId;
|
||||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
}).catch(ex => {
|
}).catch(ex => {
|
||||||
these.formData.bleStatu = 'err';
|
these.formData.bleStatu = 'err';
|
||||||
MsgError("连接错误:" + ex.msg, "确定", these);
|
MsgError("连接错误:" + ex.msg, "确定", these);
|
||||||
});;
|
});;
|
||||||
these.setBleFormData();
|
these.setBleFormData();
|
||||||
these.getDetail();
|
these.getDetail();
|
||||||
|
|
||||||
@ -409,17 +404,17 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.Status.pageHide = false;
|
this.Status.pageHide = false;
|
||||||
let f = this.getDevice();
|
let f = this.getDevice();
|
||||||
if (f) {
|
if (f) {
|
||||||
these.formData.bleStatu = 'connecting';
|
these.formData.bleStatu = 'connecting';
|
||||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
console.log("连接成功")
|
console.log("连接成功")
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
}).catch(ex => {
|
}).catch(ex => {
|
||||||
these.formData.bleStatu = 'err';
|
these.formData.bleStatu = 'err';
|
||||||
MsgError("连接错误:" + ex.msg, "确定", these);
|
MsgError("连接错误:" + ex.msg, "确定", these);
|
||||||
});;
|
});;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
||||||
@ -467,7 +462,7 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
modelValue: '',
|
modelValue: '',
|
||||||
visibleClose: true,
|
visibleClose: true,
|
||||||
okCallback: play
|
okCallback: play
|
||||||
},these);
|
}, these);
|
||||||
},
|
},
|
||||||
audioManage() { //语音管理
|
audioManage() { //语音管理
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
@ -597,7 +592,7 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
iconUrl: "/static/images/common/uploadErr.png",
|
iconUrl: "/static/images/common/uploadErr.png",
|
||||||
borderColor: "#e034344d",
|
borderColor: "#e034344d",
|
||||||
buttonBgColor: "#E03434",
|
buttonBgColor: "#E03434",
|
||||||
},these);
|
}, these);
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -608,7 +603,7 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
}
|
}
|
||||||
if (res.deviceId == these.formData.deviceId) {
|
if (res.deviceId == these.formData.deviceId) {
|
||||||
this.formData.bleStatu = true;
|
this.formData.bleStatu = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -617,9 +612,9 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
// return;
|
// return;
|
||||||
//}
|
//}
|
||||||
if (res.deviceId == these.formData.deviceId) {
|
if (res.deviceId == these.formData.deviceId) {
|
||||||
if(res.device){
|
if (res.device) {
|
||||||
these.formData.bleStatu = 'connecting';
|
these.formData.bleStatu = 'connecting';
|
||||||
}else{
|
} else {
|
||||||
this.formData.bleStatu = false;
|
this.formData.bleStatu = false;
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -663,7 +658,7 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
updateLoading(these, {
|
updateLoading(these, {
|
||||||
text: ex.msg
|
text: ex.msg
|
||||||
});
|
});
|
||||||
these.formData.bleStatu = 'err';
|
these.formData.bleStatu = 'err';
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
hideLoading(these);
|
hideLoading(these);
|
||||||
@ -693,12 +688,23 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
},
|
},
|
||||||
getDevice: function() {
|
getDevice: function() {
|
||||||
|
|
||||||
// console.log("LinkedList=", ble.data.LinkedList);
|
|
||||||
// console.log("formData=", these.formData);
|
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
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;
|
return f;
|
||||||
},
|
},
|
||||||
getDetail() {
|
getDetail() {
|
||||||
@ -733,7 +739,7 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
borderColor: "#e034344d",
|
borderColor: "#e034344d",
|
||||||
buttonBgColor: "#E03434",
|
buttonBgColor: "#E03434",
|
||||||
buttonText: '去连接',
|
buttonText: '去连接',
|
||||||
buttonTextColor: '#FFFFFFde',
|
buttonTextColor: '#FFFFFFde',
|
||||||
okCallback: function() {
|
okCallback: function() {
|
||||||
|
|
||||||
uni.navigateTo({
|
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() {
|
closePop: function() {
|
||||||
this.Status.Pop.showPop = false;
|
this.Status.Pop.showPop = false;
|
||||||
|
|
||||||
@ -1155,7 +1161,7 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.slider-container {
|
.slider-container {
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
<view slot="right">
|
<view slot="right">
|
||||||
<view class="navbarRight center">
|
<view class="navbarRight center">
|
||||||
<view class="imgContent" :class="{'visibilityHidden':Status.apiType!=item.apiType}"
|
<view class="imgContent" :class="{'visibilityHidden':Status.apiType!=item.apiType}"
|
||||||
@click.stop="handleRightClick(item,index)" v-for="item,index in Status.navbar.icons">
|
@click.stop="handleRightClick(item,index)" v-for="item,index in Status.navbar.icons">
|
||||||
<image class="img" :src="item.src" mode="aspectFit"></image>
|
<image class="img" :src="item.src" mode="aspectFit"></image>
|
||||||
<view class="baber" v-if="item.math">{{item.math>9?'9+':item.math}}</view>
|
<view class="baber" v-if="item.math">{{item.math>9?'9+':item.math}}</view>
|
||||||
</view>
|
</view>
|
||||||
@ -78,19 +78,19 @@
|
|||||||
|
|
||||||
<view class="modeSetting">
|
<view class="modeSetting">
|
||||||
<view class="item" :class="formData.modeCurr=='smalllow'?'active':''"
|
<view class="item" :class="formData.modeCurr=='smalllow'?'active':''"
|
||||||
@click="MainModeSetting('smalllow','staticBattery')">
|
@click="MainModeSetting('smalllow','staticBattery')">
|
||||||
<view class="p100 center">前置</view>
|
<view class="p100 center">前置</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item" :class="formData.modeCurr=='low'?'active':''"
|
<view class="item" :class="formData.modeCurr=='low'?'active':''"
|
||||||
@click="MainModeSetting('low','staticBattery')">
|
@click="MainModeSetting('low','staticBattery')">
|
||||||
<view class="p100 center">低档</view>
|
<view class="p100 center">低档</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item " :class="formData.modeCurr=='center'?'active':''"
|
<view class="item " :class="formData.modeCurr=='center'?'active':''"
|
||||||
@click="MainModeSetting('center','staticBattery')">
|
@click="MainModeSetting('center','staticBattery')">
|
||||||
<view class="p100 center">中档</view>
|
<view class="p100 center">中档</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item " :class="formData.modeCurr=='hight'?'active':''"
|
<view class="item " :class="formData.modeCurr=='hight'?'active':''"
|
||||||
@click="MainModeSetting('hight','staticBattery')">
|
@click="MainModeSetting('hight','staticBattery')">
|
||||||
<view class="p100 center">高档</view>
|
<view class="p100 center">高档</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -113,8 +113,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="mode marginLeft fleft"
|
<view class="mode marginLeft fleft" v-on:click.stop="ShowUpload()">
|
||||||
v-on:click.stop="ShowUpload()">
|
|
||||||
<view class="leftImg">
|
<view class="leftImg">
|
||||||
<image class="img" src="/static/images/6155/DeviceDetail/open.png" mode="aspectFit"></image>
|
<image class="img" src="/static/images/6155/DeviceDetail/open.png" mode="aspectFit"></image>
|
||||||
</view>
|
</view>
|
||||||
@ -161,11 +160,11 @@
|
|||||||
</view>
|
</view>
|
||||||
<ProParams :id="device.id"></ProParams>
|
<ProParams :id="device.id"></ProParams>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- 下方菜单 -->
|
<!-- 下方菜单 -->
|
||||||
<BottomSlideMenuPlus :config="Status.BottomMenu" @close="closeMenu" @itemClick="handleItemClick"
|
<BottomSlideMenuPlus :config="Status.BottomMenu" @close="closeMenu" @itemClick="handleItemClick"
|
||||||
@btnClick="btnClick">
|
@btnClick="btnClick">
|
||||||
</BottomSlideMenuPlus>
|
</BottomSlideMenuPlus>
|
||||||
|
|
||||||
<global-loading ref="loading" />
|
<global-loading ref="loading" />
|
||||||
@ -183,20 +182,22 @@
|
|||||||
hideLoading,
|
hideLoading,
|
||||||
updateLoading
|
updateLoading
|
||||||
} from '@/utils/loading.js'
|
} 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 usrApi from '@/api/670/HBY670.js';
|
||||||
import {
|
import {
|
||||||
MsgSuccess,
|
MsgSuccess,
|
||||||
MsgError,
|
MsgError,
|
||||||
MsgClose,
|
MsgClose,
|
||||||
MsgWarning,
|
MsgWarning,
|
||||||
showPop,
|
showPop,
|
||||||
MsgInfo
|
MsgInfo
|
||||||
} from '@/utils/MsgPops.js'
|
} from '@/utils/MsgPops.js'
|
||||||
const pagePath = "/pages/650/HBY650";
|
const pagePath = "/pages/650/HBY650";
|
||||||
import SendBatchData from '@/utils/SendBatchData.js';
|
import SendBatchData from '@/utils/SendBatchData.js';
|
||||||
var batchTool=null;
|
var batchTool = null;
|
||||||
var ble = null;
|
var ble = null;
|
||||||
var these = null;
|
var these = null;
|
||||||
var recei = null;
|
var recei = null;
|
||||||
@ -212,20 +213,20 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
apiType: 'listA'
|
apiType: 'listA'
|
||||||
}],
|
}],
|
||||||
title: 'HBY650'
|
title: 'HBY650'
|
||||||
|
|
||||||
},
|
},
|
||||||
pageHide: false,
|
pageHide: false,
|
||||||
|
|
||||||
BottomMenu: {
|
BottomMenu: {
|
||||||
show: false,
|
show: false,
|
||||||
showHeader: true,
|
showHeader: true,
|
||||||
menuItems: [{
|
menuItems: [{
|
||||||
text: '照片',
|
text: '照片',
|
||||||
value:'img'
|
value: 'img'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '动画',
|
text: '动画',
|
||||||
value:'flash'
|
value: 'flash'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
activeIndex: -1,
|
activeIndex: -1,
|
||||||
@ -296,8 +297,8 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.Status.navbar.height = uni.getSystemInfoSync().statusBarHeight + 44;
|
this.Status.navbar.height = uni.getSystemInfoSync().statusBarHeight + 44;
|
||||||
},
|
},
|
||||||
onUnload() {
|
onUnload() {
|
||||||
console.log("页面卸载,释放资源");
|
console.log("页面卸载,释放资源");
|
||||||
@ -334,14 +335,7 @@ created() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
let f = these.getDevice();
|
||||||
if (v.macAddress == device.deviceMac) {
|
|
||||||
// console.log("找到设备了", v);
|
|
||||||
these.formData.deviceId = v.deviceId;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
if (!f) {
|
if (!f) {
|
||||||
|
|
||||||
|
|
||||||
@ -363,13 +357,13 @@ created() {
|
|||||||
|
|
||||||
these.formData.bleStatu = false;
|
these.formData.bleStatu = false;
|
||||||
these.formData.deviceId = f.deviceId;
|
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 => {
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
}).catch(ex => {
|
}).catch(ex => {
|
||||||
these.formData.bleStatu = 'err';
|
these.formData.bleStatu = 'err';
|
||||||
MsgError("连接错误:" + ex.msg, "确定", these);
|
MsgError("连接错误:" + ex.msg, "确定", these);
|
||||||
});;
|
});;
|
||||||
these.setBleFormData();
|
these.setBleFormData();
|
||||||
console.error("222222");
|
console.error("222222");
|
||||||
these.getDetail();
|
these.getDetail();
|
||||||
@ -383,64 +377,64 @@ created() {
|
|||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.Status.pageHide = false;
|
this.Status.pageHide = false;
|
||||||
|
|
||||||
let f=this.getDevice();
|
let f = this.getDevice();
|
||||||
if(f){
|
if (f) {
|
||||||
these.formData.bleStatu = 'connecting';
|
these.formData.bleStatu = 'connecting';
|
||||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
console.log("连接成功")
|
console.log("连接成功")
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
}).catch(ex => {
|
}).catch(ex => {
|
||||||
these.formData.bleStatu = 'err';
|
these.formData.bleStatu = 'err';
|
||||||
MsgError("连接错误:" + ex.msg, "确定", these);
|
MsgError("连接错误:" + ex.msg, "确定", these);
|
||||||
});;
|
});;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
getbleStatu(){
|
getbleStatu() {
|
||||||
if(this.formData.bleStatu===true){
|
if (this.formData.bleStatu === true) {
|
||||||
return '已连接';
|
return '已连接';
|
||||||
}
|
}
|
||||||
if(this.formData.bleStatu==='connecting'){
|
if (this.formData.bleStatu === 'connecting') {
|
||||||
return '连接中';
|
return '连接中';
|
||||||
}
|
}
|
||||||
if(this.formData.bleStatu==='dicconnect'){
|
if (this.formData.bleStatu === 'dicconnect') {
|
||||||
return '正在断开';
|
return '正在断开';
|
||||||
}
|
}
|
||||||
if(this.formData.bleStatu==='err'){
|
if (this.formData.bleStatu === 'err') {
|
||||||
return '连接异常';
|
return '连接异常';
|
||||||
}
|
}
|
||||||
return '未连接';
|
return '未连接';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
bleStatuToggle(){
|
bleStatuToggle() {
|
||||||
let f=this.getDevice();
|
let f = this.getDevice();
|
||||||
if(!f){
|
if (!f) {
|
||||||
this.showBleUnConnect();
|
this.showBleUnConnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(this.formData.bleStatu===true){
|
if (this.formData.bleStatu === true) {
|
||||||
this.formData.bleStatu='dicconnect';
|
this.formData.bleStatu = 'dicconnect';
|
||||||
ble.disconnectDevice(f.deviceId).finally(r=>{
|
ble.disconnectDevice(f.deviceId).finally(r => {
|
||||||
this.formData.bleStatu=false;
|
this.formData.bleStatu = false;
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.formData.bleStatu===false || this.formData.bleStatu==='err'){
|
if (this.formData.bleStatu === false || this.formData.bleStatu === 'err') {
|
||||||
this.formData.bleStatu='connecting';
|
this.formData.bleStatu = 'connecting';
|
||||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
}).catch(ex=>{
|
}).catch(ex => {
|
||||||
these.formData.bleStatu = 'err';
|
these.formData.bleStatu = 'err';
|
||||||
MsgError("连接错误:" + ex.msg, "确定", these);
|
MsgError("连接错误:" + ex.msg, "确定", these);
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
handleRightClick(item, s) {
|
handleRightClick(item, s) {
|
||||||
if (item && item.callback) {
|
if (item && item.callback) {
|
||||||
item.callback(item, s);
|
item.callback(item, s);
|
||||||
@ -448,7 +442,7 @@ created() {
|
|||||||
uni.showModal({
|
uni.showModal({
|
||||||
content: '敬请期待'
|
content: '敬请期待'
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
navigatorBack() {
|
navigatorBack() {
|
||||||
@ -477,7 +471,7 @@ created() {
|
|||||||
}
|
}
|
||||||
if (res.deviceId == these.formData.deviceId) {
|
if (res.deviceId == these.formData.deviceId) {
|
||||||
this.formData.bleStatu = true;
|
this.formData.bleStatu = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -486,9 +480,9 @@ created() {
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
if (res.deviceId == these.formData.deviceId) {
|
if (res.deviceId == these.formData.deviceId) {
|
||||||
if(res.device){
|
if (res.device) {
|
||||||
these.formData.bleStatu = 'connecting';
|
these.formData.bleStatu = 'connecting';
|
||||||
}else{
|
} else {
|
||||||
this.formData.bleStatu = false;
|
this.formData.bleStatu = false;
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -523,7 +517,7 @@ created() {
|
|||||||
showLoading(this, {
|
showLoading(this, {
|
||||||
text: "蓝牙恢复可用,正在连接设备"
|
text: "蓝牙恢复可用,正在连接设备"
|
||||||
});
|
});
|
||||||
this.formData.bleStatu='connecting';
|
this.formData.bleStatu = 'connecting';
|
||||||
ble.LinkBlue(these.formData.deviceId).then(() => {
|
ble.LinkBlue(these.formData.deviceId).then(() => {
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
updateLoading(these, {
|
updateLoading(these, {
|
||||||
@ -533,7 +527,7 @@ created() {
|
|||||||
updateLoading(these, {
|
updateLoading(these, {
|
||||||
text: ex.msg
|
text: ex.msg
|
||||||
});
|
});
|
||||||
MsgError("连接错误:" + ex.msg, "确定", these);
|
MsgError("连接错误:" + ex.msg, "确定", these);
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
hideLoading(these);
|
hideLoading(these);
|
||||||
@ -624,7 +618,7 @@ created() {
|
|||||||
iconUrl: "/static/images/6155/DeviceDetail/warnning.png",
|
iconUrl: "/static/images/6155/DeviceDetail/warnning.png",
|
||||||
borderColor: "#e034344d",
|
borderColor: "#e034344d",
|
||||||
buttonBgColor: "#E03434",
|
buttonBgColor: "#E03434",
|
||||||
},these);
|
}, these);
|
||||||
}
|
}
|
||||||
|
|
||||||
these.setBleFormData();
|
these.setBleFormData();
|
||||||
@ -640,12 +634,23 @@ created() {
|
|||||||
},
|
},
|
||||||
getDevice: function() {
|
getDevice: function() {
|
||||||
|
|
||||||
// console.log("LinkedList=", ble.data.LinkedList);
|
|
||||||
// console.log("formData=", these.formData);
|
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
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;
|
return f;
|
||||||
},
|
},
|
||||||
getDetail() {
|
getDetail() {
|
||||||
@ -663,7 +668,7 @@ created() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -681,9 +686,9 @@ created() {
|
|||||||
uni.setStorageSync(ble.StorageKey, ble.data.LinkedList);
|
uni.setStorageSync(ble.StorageKey, ble.data.LinkedList);
|
||||||
},
|
},
|
||||||
MainModeSetting: function(type, byteType) {
|
MainModeSetting: function(type, byteType) {
|
||||||
|
|
||||||
if (!this.permissions.includes('41') && this.Status.apiType !== 'listA') {
|
if (!this.permissions.includes('41') && this.Status.apiType !== 'listA') {
|
||||||
|
|
||||||
showPop({
|
showPop({
|
||||||
message: '无操作权限',
|
message: '无操作权限',
|
||||||
iconUrl: "/static/images/common/uploadErr.png",
|
iconUrl: "/static/images/common/uploadErr.png",
|
||||||
@ -691,10 +696,10 @@ created() {
|
|||||||
buttonBgColor: "#E03434",
|
buttonBgColor: "#E03434",
|
||||||
okCallback: null,
|
okCallback: null,
|
||||||
buttonText: "确定"
|
buttonText: "确定"
|
||||||
},these)
|
}, these)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.formData.modeCurr == type) {
|
if (this.formData.modeCurr == type) {
|
||||||
type = 'close';
|
type = 'close';
|
||||||
}
|
}
|
||||||
@ -769,7 +774,7 @@ created() {
|
|||||||
iconUrl: "/static/images/common/uploadErr.png",
|
iconUrl: "/static/images/common/uploadErr.png",
|
||||||
borderColor: "#e034344d",
|
borderColor: "#e034344d",
|
||||||
buttonBgColor: "#E03434",
|
buttonBgColor: "#E03434",
|
||||||
},these);
|
}, these);
|
||||||
|
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
|
|
||||||
@ -795,7 +800,7 @@ created() {
|
|||||||
borderColor: "#e034344d",
|
borderColor: "#e034344d",
|
||||||
buttonBgColor: "#E03434",
|
buttonBgColor: "#E03434",
|
||||||
buttonText: '去连接',
|
buttonText: '去连接',
|
||||||
buttonTextColor: '#FFFFFFde',
|
buttonTextColor: '#FFFFFFde',
|
||||||
okCallback: function() {
|
okCallback: function() {
|
||||||
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
@ -817,7 +822,7 @@ created() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},these);
|
}, these);
|
||||||
},
|
},
|
||||||
LampToggle: function() {
|
LampToggle: function() {
|
||||||
if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
|
if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
|
||||||
@ -829,39 +834,39 @@ created() {
|
|||||||
buttonBgColor: "#E03434",
|
buttonBgColor: "#E03434",
|
||||||
okCallback: null,
|
okCallback: null,
|
||||||
buttonText: "确定"
|
buttonText: "确定"
|
||||||
},these)
|
}, these)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.formData.cMode = !this.formData.cMode;
|
this.formData.cMode = !this.formData.cMode;
|
||||||
this.MainModeSetting(this.formData.cMode, "lamp");
|
this.MainModeSetting(this.formData.cMode, "lamp");
|
||||||
},
|
},
|
||||||
|
|
||||||
checkImgUpload: function(type, index) {
|
checkImgUpload: function(type, index) {
|
||||||
let f = these.getDevice();
|
let f = these.getDevice();
|
||||||
if(!f){
|
if (!f) {
|
||||||
this.showBleUnConnect();
|
this.showBleUnConnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!batchTool){
|
if (!batchTool) {
|
||||||
batchTool=new SendBatchData(these,f,ble);
|
batchTool = new SendBatchData(these, f, ble);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (type) {
|
if (type) {
|
||||||
if (type == 'img') {
|
if (type == 'img') {
|
||||||
// sendImagePackets(index);
|
// sendImagePackets(index);
|
||||||
batchTool.SendImg();
|
batchTool.SendImg();
|
||||||
} else{
|
} else {
|
||||||
// sendVideoPackets(index);
|
// sendVideoPackets(index);
|
||||||
batchTool.SendVideo(506);
|
batchTool.SendVideo(506);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
console.log("123213213213");
|
console.log("123213213213");
|
||||||
|
|
||||||
// 分包发送图片数据
|
// 分包发送图片数据
|
||||||
var sendImagePackets = function(ReSendNo) {
|
var sendImagePackets = function(ReSendNo) {
|
||||||
|
|
||||||
@ -886,7 +891,7 @@ created() {
|
|||||||
showPop: true,
|
showPop: true,
|
||||||
message: "上传成功",
|
message: "上传成功",
|
||||||
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png",
|
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png",
|
||||||
},these);
|
}, these);
|
||||||
if (!ReSendNo) {
|
if (!ReSendNo) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
these.HoldYouHand("transmit complete", 0, f
|
these.HoldYouHand("transmit complete", 0, f
|
||||||
@ -928,7 +933,7 @@ created() {
|
|||||||
dataView.setUint8(2, currentPacket); // 包序号
|
dataView.setUint8(2, currentPacket); // 包序号
|
||||||
|
|
||||||
|
|
||||||
dataView.setUint16(3, packetData.length*2,false); // 包t长度
|
dataView.setUint16(3, packetData.length * 2, false); // 包t长度
|
||||||
|
|
||||||
// 填充数据(每个RGB565值占2字节)
|
// 填充数据(每个RGB565值占2字节)
|
||||||
for (let i = 0; i < packetData.length; i++) {
|
for (let i = 0; i < packetData.length; i++) {
|
||||||
@ -971,7 +976,7 @@ created() {
|
|||||||
iconUrl: "/static/images/common/uploadErr.png",
|
iconUrl: "/static/images/common/uploadErr.png",
|
||||||
borderColor: "#e034344d",
|
borderColor: "#e034344d",
|
||||||
buttonBgColor: "#E03434",
|
buttonBgColor: "#E03434",
|
||||||
},these);
|
}, these);
|
||||||
hideLoading(these);
|
hideLoading(these);
|
||||||
reject(err);
|
reject(err);
|
||||||
});
|
});
|
||||||
@ -992,7 +997,7 @@ created() {
|
|||||||
iconUrl: "/static/images/common/uploadErr.png",
|
iconUrl: "/static/images/common/uploadErr.png",
|
||||||
borderColor: "#e034344d",
|
borderColor: "#e034344d",
|
||||||
buttonBgColor: "#E03434",
|
buttonBgColor: "#E03434",
|
||||||
},these);
|
}, these);
|
||||||
hideLoading(these);
|
hideLoading(these);
|
||||||
reject(err);
|
reject(err);
|
||||||
});
|
});
|
||||||
@ -1068,7 +1073,7 @@ created() {
|
|||||||
showPop: true,
|
showPop: true,
|
||||||
message: "上传成功",
|
message: "上传成功",
|
||||||
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png"
|
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png"
|
||||||
},these);
|
}, these);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1145,7 +1150,7 @@ created() {
|
|||||||
buttonBgColor: "#E03434",
|
buttonBgColor: "#E03434",
|
||||||
buttonText: "确定",
|
buttonText: "确定",
|
||||||
iconUrl: "/static/images/common/uploadErr.png"
|
iconUrl: "/static/images/common/uploadErr.png"
|
||||||
},these);
|
}, these);
|
||||||
reject(err);
|
reject(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1245,7 +1250,7 @@ created() {
|
|||||||
iconUrl: "/static/images/common/uploadErr.png",
|
iconUrl: "/static/images/common/uploadErr.png",
|
||||||
borderColor: "#e034344d",
|
borderColor: "#e034344d",
|
||||||
buttonBgColor: "#E03434",
|
buttonBgColor: "#E03434",
|
||||||
},these);
|
}, these);
|
||||||
}
|
}
|
||||||
|
|
||||||
}).catch((ex) => {
|
}).catch((ex) => {
|
||||||
@ -1256,7 +1261,7 @@ created() {
|
|||||||
iconUrl: "/static/images/common/uploadErr.png",
|
iconUrl: "/static/images/common/uploadErr.png",
|
||||||
borderColor: "#e034344d",
|
borderColor: "#e034344d",
|
||||||
buttonBgColor: "#E03434",
|
buttonBgColor: "#E03434",
|
||||||
},these);
|
}, these);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
let f = these.getDevice();
|
let f = these.getDevice();
|
||||||
@ -1320,9 +1325,9 @@ created() {
|
|||||||
|
|
||||||
},
|
},
|
||||||
ShowUpload: function() {
|
ShowUpload: function() {
|
||||||
|
|
||||||
if (!this.permissions.includes('3') && this.Status.apiType !== 'listA') {
|
if (!this.permissions.includes('3') && this.Status.apiType !== 'listA') {
|
||||||
|
|
||||||
showPop({
|
showPop({
|
||||||
message: '无操作权限',
|
message: '无操作权限',
|
||||||
iconUrl: "/static/images/common/uploadErr.png",
|
iconUrl: "/static/images/common/uploadErr.png",
|
||||||
@ -1330,14 +1335,14 @@ created() {
|
|||||||
buttonBgColor: "#E03434",
|
buttonBgColor: "#E03434",
|
||||||
okCallback: null,
|
okCallback: null,
|
||||||
buttonText: "确定"
|
buttonText: "确定"
|
||||||
},these)
|
}, these)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//上传开机画面
|
//上传开机画面
|
||||||
this.Status.BottomMenu.title = "上传开机画面";
|
this.Status.BottomMenu.title = "上传开机画面";
|
||||||
this.Status.BottomMenu.type = "checkImg";
|
this.Status.BottomMenu.type = "checkImg";
|
||||||
this.Status.BottomMenu.show = true;
|
this.Status.BottomMenu.show = true;
|
||||||
this.Status.BottomMenu.activeIndex=0;
|
this.Status.BottomMenu.activeIndex = 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
showMenu(flag) {
|
showMenu(flag) {
|
||||||
@ -1348,7 +1353,7 @@ created() {
|
|||||||
},
|
},
|
||||||
btnClick(item, index) {
|
btnClick(item, index) {
|
||||||
this.Status.BottomMenu.show = false;
|
this.Status.BottomMenu.show = false;
|
||||||
this.checkImgUpload(item.value,index);
|
this.checkImgUpload(item.value, index);
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -1360,11 +1365,11 @@ created() {
|
|||||||
},
|
},
|
||||||
handleItemClick(item, index) {
|
handleItemClick(item, index) {
|
||||||
|
|
||||||
|
|
||||||
this.Status.BottomMenu.activeIndex = index;
|
this.Status.BottomMenu.activeIndex = index;
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
sendUsr: function(ReSendNo) {
|
sendUsr: function(ReSendNo) {
|
||||||
|
|
||||||
if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') {
|
if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') {
|
||||||
@ -1376,7 +1381,7 @@ created() {
|
|||||||
buttonBgColor: "#E03434",
|
buttonBgColor: "#E03434",
|
||||||
okCallback: null,
|
okCallback: null,
|
||||||
buttonText: "确定"
|
buttonText: "确定"
|
||||||
},these)
|
}, these)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1436,7 +1441,7 @@ created() {
|
|||||||
promptTitle: '',
|
promptTitle: '',
|
||||||
modelValue: '',
|
modelValue: '',
|
||||||
visibleClose: true
|
visibleClose: true
|
||||||
},these);
|
}, these);
|
||||||
these.setBleFormData();
|
these.setBleFormData();
|
||||||
|
|
||||||
|
|
||||||
@ -1499,7 +1504,7 @@ created() {
|
|||||||
iconUrl: "/static/images/common/uploadErr.png",
|
iconUrl: "/static/images/common/uploadErr.png",
|
||||||
borderColor: "#e034344d",
|
borderColor: "#e034344d",
|
||||||
buttonBgColor: "#E03434",
|
buttonBgColor: "#E03434",
|
||||||
},these);
|
}, these);
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
hideLoading(these);
|
hideLoading(these);
|
||||||
});
|
});
|
||||||
@ -1533,7 +1538,7 @@ created() {
|
|||||||
iconUrl: "/static/images/common/uploadErr.png",
|
iconUrl: "/static/images/common/uploadErr.png",
|
||||||
borderColor: "#e034344d",
|
borderColor: "#e034344d",
|
||||||
buttonBgColor: "#E03434",
|
buttonBgColor: "#E03434",
|
||||||
},these);
|
}, these);
|
||||||
});
|
});
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
@ -1909,7 +1914,7 @@ created() {
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.slider-container {
|
.slider-container {
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
@ -2104,27 +2109,27 @@ created() {
|
|||||||
.net.active {
|
.net.active {
|
||||||
background: #FFFFFF !important;
|
background: #FFFFFF !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.navbarRight {
|
.navbarRight {
|
||||||
width: 40px;
|
width: 40px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbarRight .imgContent {
|
.navbarRight .imgContent {
|
||||||
width: 36rpx;
|
width: 36rpx;
|
||||||
height: 36rpx;
|
height: 36rpx;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbarRight .imgContent:first-child {
|
.navbarRight .imgContent:first-child {
|
||||||
|
|
||||||
width: 38rpx !important;
|
width: 38rpx !important;
|
||||||
height: 38rpx !important;
|
height: 38rpx !important;
|
||||||
margin-top: -2rpx;
|
margin-top: -2rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbarRight .imgContent .baber {
|
.navbarRight .imgContent .baber {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
@ -2140,33 +2145,33 @@ created() {
|
|||||||
font-style: Regular;
|
font-style: Regular;
|
||||||
font-size: 20rpx;
|
font-size: 20rpx;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbarRight .imgContent .img {
|
.navbarRight .imgContent .img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbarRight .imgContent .img:last-child {
|
.navbarRight .imgContent .img:last-child {
|
||||||
padding: 1rpx;
|
padding: 1rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nvbar {
|
.nvbar {
|
||||||
top: 0px;
|
top: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/deep/ .uni-navbar--fixed {
|
/deep/ .uni-navbar--fixed {
|
||||||
top: 0px;
|
top: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uninavebartext {
|
.uninavebartext {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -10,7 +10,7 @@
|
|||||||
<view slot="right">
|
<view slot="right">
|
||||||
<view class="navbarRight center">
|
<view class="navbarRight center">
|
||||||
<view class="imgContent" :class="{'visibilityHidden':Status.apiType!=item.apiType}"
|
<view class="imgContent" :class="{'visibilityHidden':Status.apiType!=item.apiType}"
|
||||||
@click.stop="handleRightClick(item,index)" v-for="item,index in Status.navbar.icons">
|
@click.stop="handleRightClick(item,index)" v-for="item,index in Status.navbar.icons">
|
||||||
<image class="img" :src="item.src" mode="aspectFit"></image>
|
<image class="img" :src="item.src" mode="aspectFit"></image>
|
||||||
<view class="baber" v-if="item.math">{{item.math>9?'9+':item.math}}</view>
|
<view class="baber" v-if="item.math">{{item.math>9?'9+':item.math}}</view>
|
||||||
</view>
|
</view>
|
||||||
@ -73,8 +73,8 @@
|
|||||||
|
|
||||||
<view class="slider-container">
|
<view class="slider-container">
|
||||||
<slider min="1" max="100" step="1" :disabled="false" :value="formData.liangDu" activeColor="#bbe600"
|
<slider min="1" max="100" step="1" :disabled="false" :value="formData.liangDu" activeColor="#bbe600"
|
||||||
backgroundColor="#00000000" block-size="20" block-color="#ffffffde" @change="sliderChange"
|
backgroundColor="#00000000" block-size="20" block-color="#ffffffde" @change="sliderChange"
|
||||||
@changing="sliderChanging" class="custom-slider" />
|
@changing="sliderChanging" class="custom-slider" />
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -114,20 +114,23 @@
|
|||||||
<view class="btnSend fright" v-on:click.stop="sendUsr">发送</view>
|
<view class="btnSend fright" v-on:click.stop="sendUsr">发送</view>
|
||||||
<view class="clear"></view>
|
<view class="clear"></view>
|
||||||
<textToDotMatrixFor7305 class="TextToHex" ref="textToHex" :txts="formData.textLines"
|
<textToDotMatrixFor7305 class="TextToHex" ref="textToHex" :txts="formData.textLines"
|
||||||
:bgColor="'#FFFFFF'" :color="'#000000'" :fontSize="13" />
|
:bgColor="'#FFFFFF'" :color="'#000000'" :fontSize="13" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<text class="lbl">单位:</text>
|
<text class="lbl">单位:</text>
|
||||||
<input class="value" maxlength="5" v-model="formData.inputLines[0]" placeholder="请输入单位" placeholder-class="usrplace" />
|
<input class="value" maxlength="5" v-model="formData.inputLines[0]" placeholder="请输入单位"
|
||||||
|
placeholder-class="usrplace" />
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<text class="lbl">部门:</text>
|
<text class="lbl">部门:</text>
|
||||||
<input class="value" maxlength="5" v-model="formData.inputLines[1]" placeholder="请输入姓名" placeholder-class="usrplace" />
|
<input class="value" maxlength="5" v-model="formData.inputLines[1]" placeholder="请输入姓名"
|
||||||
|
placeholder-class="usrplace" />
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<text class="lbl">姓名:</text>
|
<text class="lbl">姓名:</text>
|
||||||
<input class="value" maxlength="5" v-model="formData.inputLines[2]" placeholder="请输入职位" placeholder-class="usrplace" />
|
<input class="value" maxlength="5" v-model="formData.inputLines[2]" placeholder="请输入职位"
|
||||||
|
placeholder-class="usrplace" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
@ -135,7 +138,7 @@
|
|||||||
|
|
||||||
<!-- 下方菜单 -->
|
<!-- 下方菜单 -->
|
||||||
<BottomSlideMenuPlus :config="Status.BottomMenu" @close="closeMenu" @itemClick="handleItemClick"
|
<BottomSlideMenuPlus :config="Status.BottomMenu" @close="closeMenu" @itemClick="handleItemClick"
|
||||||
@btnClick="btnClick">
|
@btnClick="btnClick">
|
||||||
<view class="addIco">
|
<view class="addIco">
|
||||||
<view class="icoContent center" v-on:click.stop="checkImgUpload()">
|
<view class="icoContent center" v-on:click.stop="checkImgUpload()">
|
||||||
<image mode="aspectFit" class="img" src="/static/images/6155/DeviceDetail/add.png"></image>
|
<image mode="aspectFit" class="img" src="/static/images/6155/DeviceDetail/add.png"></image>
|
||||||
@ -160,14 +163,14 @@
|
|||||||
} from '@/utils/loading.js'
|
} from '@/utils/loading.js'
|
||||||
import BleReceive from '@/utils/BleReceive';
|
import BleReceive from '@/utils/BleReceive';
|
||||||
import Common from '@/utils/Common.js';
|
import Common from '@/utils/Common.js';
|
||||||
import {
|
import {
|
||||||
MsgSuccess,
|
MsgSuccess,
|
||||||
MsgError,
|
MsgError,
|
||||||
MsgClose,
|
MsgClose,
|
||||||
MsgWarning,
|
MsgWarning,
|
||||||
showPop,
|
showPop,
|
||||||
MsgInfo
|
MsgInfo
|
||||||
} from '@/utils/MsgPops.js'
|
} from '@/utils/MsgPops.js'
|
||||||
var ble = null;
|
var ble = null;
|
||||||
var these = null;
|
var these = null;
|
||||||
var BrighInteval = null;
|
var BrighInteval = null;
|
||||||
@ -188,7 +191,7 @@
|
|||||||
apiType: 'listA'
|
apiType: 'listA'
|
||||||
}],
|
}],
|
||||||
title: 'BJQ6155',
|
title: 'BJQ6155',
|
||||||
height:90
|
height: 90
|
||||||
|
|
||||||
},
|
},
|
||||||
pageHide: false,
|
pageHide: false,
|
||||||
@ -260,7 +263,7 @@
|
|||||||
textLines: [],
|
textLines: [],
|
||||||
mode: '',
|
mode: '',
|
||||||
bleStatu: '',
|
bleStatu: '',
|
||||||
inputLines:[]
|
inputLines: []
|
||||||
},
|
},
|
||||||
inteval: 500,
|
inteval: 500,
|
||||||
device: {
|
device: {
|
||||||
@ -287,8 +290,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.Status.navbar.height = uni.getSystemInfoSync().statusBarHeight + 44;
|
this.Status.navbar.height = uni.getSystemInfoSync().statusBarHeight + 44;
|
||||||
},
|
},
|
||||||
onUnload() {
|
onUnload() {
|
||||||
ble.removeAllCallback(pagePath);
|
ble.removeAllCallback(pagePath);
|
||||||
},
|
},
|
||||||
@ -320,14 +323,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
let f = these.getDevice();
|
||||||
if (v.macAddress == device.deviceMac) {
|
|
||||||
console.log("找到设备了", v);
|
|
||||||
these.formData.deviceId = v.deviceId;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
if (!f) {
|
if (!f) {
|
||||||
|
|
||||||
these.getDetail();
|
these.getDetail();
|
||||||
@ -351,10 +347,10 @@
|
|||||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
console.log("连接成功")
|
console.log("连接成功")
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
}).catch(ex => {
|
}).catch(ex => {
|
||||||
these.formData.bleStatu = 'err';
|
these.formData.bleStatu = 'err';
|
||||||
MsgError("连接错误:" + ex.msg, "确定", these);
|
MsgError("连接错误:" + ex.msg, "确定", these);
|
||||||
});;
|
});;
|
||||||
these.setBleFormData();
|
these.setBleFormData();
|
||||||
these.getDetail();
|
these.getDetail();
|
||||||
|
|
||||||
@ -368,17 +364,17 @@
|
|||||||
},
|
},
|
||||||
onShow: function() {
|
onShow: function() {
|
||||||
this.Status.pageHide = false;
|
this.Status.pageHide = false;
|
||||||
|
|
||||||
let f=this.getDevice();
|
let f = this.getDevice();
|
||||||
if(f){
|
if (f) {
|
||||||
these.formData.bleStatu = 'connecting';
|
these.formData.bleStatu = 'connecting';
|
||||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||||
console.log("连接成功")
|
console.log("连接成功")
|
||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
}).catch(ex => {
|
}).catch(ex => {
|
||||||
these.formData.bleStatu = 'err';
|
these.formData.bleStatu = 'err';
|
||||||
MsgError("连接错误:" + ex.msg, "确定", these);
|
MsgError("连接错误:" + ex.msg, "确定", these);
|
||||||
});;
|
});;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -416,7 +412,7 @@
|
|||||||
case 3:
|
case 3:
|
||||||
txt = "爆闪模式";
|
txt = "爆闪模式";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
txt = "关闭";
|
txt = "关闭";
|
||||||
break;
|
break;
|
||||||
@ -446,7 +442,7 @@
|
|||||||
these.formData.bleStatu = true;
|
these.formData.bleStatu = true;
|
||||||
}).catch(ex => {
|
}).catch(ex => {
|
||||||
these.formData.bleStatu = 'err';
|
these.formData.bleStatu = 'err';
|
||||||
MsgError("连接错误:" + ex.msg, "确定", these);
|
MsgError("连接错误:" + ex.msg, "确定", these);
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -490,7 +486,7 @@
|
|||||||
if (res.deviceId == these.formData.deviceId) {
|
if (res.deviceId == these.formData.deviceId) {
|
||||||
this.formData.bleStatu = true;
|
this.formData.bleStatu = true;
|
||||||
// 重新连接后状态以设备上报为准
|
// 重新连接后状态以设备上报为准
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -550,7 +546,7 @@
|
|||||||
updateLoading(these, {
|
updateLoading(these, {
|
||||||
text: ex.msg
|
text: ex.msg
|
||||||
});
|
});
|
||||||
these.formData.bleStatu = 'err';
|
these.formData.bleStatu = 'err';
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
hideLoading(these);
|
hideLoading(these);
|
||||||
@ -568,12 +564,23 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
getDevice: function() {
|
getDevice: function() {
|
||||||
// console.log("LinkedList=", ble.data.LinkedList);
|
|
||||||
// console.log("formData=", these.formData);
|
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
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;
|
return f;
|
||||||
},
|
},
|
||||||
bleValueNotify: function(receive, device, path, recArr) {
|
bleValueNotify: function(receive, device, path, recArr) {
|
||||||
@ -595,8 +602,8 @@
|
|||||||
these.formData[key] = json[key];
|
these.formData[key] = json[key];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
these.formData.mode=parseInt(receive.hexs[2],16);
|
these.formData.mode = parseInt(receive.hexs[2], 16);
|
||||||
console.error("mode="+these.formData.mode);
|
console.error("mode=" + these.formData.mode);
|
||||||
if ('statu' in json) {
|
if ('statu' in json) {
|
||||||
const chargingVal = json.statu;
|
const chargingVal = json.statu;
|
||||||
const isCharging = chargingVal === 1 || chargingVal === '1' || chargingVal === true ||
|
const isCharging = chargingVal === 1 || chargingVal === '1' || chargingVal === true ||
|
||||||
@ -618,7 +625,7 @@
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
showBleUnConnect() {
|
showBleUnConnect() {
|
||||||
this.showPop({
|
this.showPop({
|
||||||
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
|
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
|
||||||
@ -626,7 +633,7 @@
|
|||||||
borderColor: "#e034344d",
|
borderColor: "#e034344d",
|
||||||
buttonBgColor: "#E03434",
|
buttonBgColor: "#E03434",
|
||||||
buttonText: '去连接',
|
buttonText: '去连接',
|
||||||
buttonTextColor: '#FFFFFFde',
|
buttonTextColor: '#FFFFFFde',
|
||||||
okCallback: function() {
|
okCallback: function() {
|
||||||
console.log("1111");
|
console.log("1111");
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
@ -756,7 +763,7 @@
|
|||||||
uni.chooseImage({
|
uni.chooseImage({
|
||||||
count: 1,
|
count: 1,
|
||||||
sizeType: ['original', 'compressed'],
|
sizeType: ['original', 'compressed'],
|
||||||
sourceType: ['album','camera'],
|
sourceType: ['album', 'camera'],
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/common/ImgCrop/ImgCrop",
|
url: "/pages/common/ImgCrop/ImgCrop",
|
||||||
@ -999,16 +1006,16 @@
|
|||||||
case 0:
|
case 0:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dataValue = 0x01;
|
|
||||||
|
dataValue = 0x01;
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
dataValue = 0x02;
|
dataValue = 0x02;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
dataValue = 0x03;
|
dataValue = 0x03;
|
||||||
break;
|
break;
|
||||||
@ -1042,7 +1049,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 100).then(() => {
|
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 100).then(() => {
|
||||||
this.formData.mode = mode+1;
|
this.formData.mode = mode + 1;
|
||||||
this.setBleFormData();
|
this.setBleFormData();
|
||||||
}).catch((ex) => {
|
}).catch((ex) => {
|
||||||
these.showPop({
|
these.showPop({
|
||||||
@ -1059,8 +1066,8 @@
|
|||||||
|
|
||||||
},
|
},
|
||||||
handleItemClick(item, index) {
|
handleItemClick(item, index) {
|
||||||
debugger;
|
debugger;
|
||||||
|
|
||||||
this.Status.BottomMenu.activeIndex = index;
|
this.Status.BottomMenu.activeIndex = index;
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -1143,7 +1150,7 @@ debugger;
|
|||||||
option.buttonBgColor = '#BBE600';
|
option.buttonBgColor = '#BBE600';
|
||||||
}
|
}
|
||||||
these.Status.Pop.showPop = true;
|
these.Status.Pop.showPop = true;
|
||||||
showPop(option,this);
|
showPop(option, this);
|
||||||
},
|
},
|
||||||
sendUsr() {
|
sendUsr() {
|
||||||
if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') {
|
if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') {
|
||||||
@ -1182,16 +1189,18 @@ debugger;
|
|||||||
});
|
});
|
||||||
return;
|
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, {
|
showLoading(these, {
|
||||||
text: "发送中..."
|
text: "发送中..."
|
||||||
});
|
});
|
||||||
this.setBleFormData();
|
this.setBleFormData();
|
||||||
let task = async () => {
|
let task = async () => {
|
||||||
var sendTxtPackge = (rgbdata, type, str,index) => {
|
var sendTxtPackge = (rgbdata, type, str, index) => {
|
||||||
|
|
||||||
var promise = new Promise((resolve, reject) => {
|
var promise = new Promise((resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
@ -1234,7 +1243,10 @@ debugger;
|
|||||||
.toString(16).padStart(2, '0'));
|
.toString(16).padStart(2, '0'));
|
||||||
console.log(`发送数据块 ${chunkIndex + 1}/${numChunks}:`, hexArray
|
console.log(`发送数据块 ${chunkIndex + 1}/${numChunks}:`, hexArray
|
||||||
.join(' '));
|
.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
|
ble.sendData(f.deviceId, chunk, f.writeServiceId, f
|
||||||
.wirteCharactId, 100).then(() => {
|
.wirteCharactId, 100).then(() => {
|
||||||
chunkIndex++;
|
chunkIndex++;
|
||||||
@ -1291,7 +1303,7 @@ debugger;
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// console.log("1111");
|
// console.log("1111");
|
||||||
await sendTxtPackge(rgb, h3dic[i], str,i+1);
|
await sendTxtPackge(rgb, h3dic[i], str, i + 1);
|
||||||
// console.log("222222");
|
// console.log("222222");
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
flag = false;
|
flag = false;
|
||||||
@ -1344,7 +1356,9 @@ debugger;
|
|||||||
res = res.data;
|
res = res.data;
|
||||||
let personnelInfo = res.personnelInfo;
|
let personnelInfo = res.personnelInfo;
|
||||||
if (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;
|
this.formData.liangDu = evt.detail.value;
|
||||||
},
|
},
|
||||||
|
|
||||||
sliderChange: function(evt) {
|
sliderChange: function(evt) {
|
||||||
this.formData.liangDu = evt.detail.value;
|
this.formData.liangDu = evt.detail.value;
|
||||||
clearTimeout(BrighInteval)
|
clearTimeout(BrighInteval)
|
||||||
@ -1820,7 +1834,7 @@ debugger;
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.slider-container {
|
.slider-container {
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
|
|||||||
@ -35,8 +35,8 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="centertxt ">
|
<view class="centertxt ">
|
||||||
<view class="name" v-text="item.name"></view>
|
<view class="name" v-text="item.name"></view>
|
||||||
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<view class="rightIco center">
|
<view class="rightIco center">
|
||||||
<image src="/static/images/BLEAdd/linked.png" class="img" mode="aspectFit">
|
<image src="/static/images/BLEAdd/linked.png" class="img" mode="aspectFit">
|
||||||
@ -49,8 +49,8 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="lblTitle">
|
<view class="lblTitle">
|
||||||
<text>发现设备:{{EquipMents.length}} 筛选设备:{{deviceCnt}}</text>
|
<text>发现设备:{{EquipMents.length}} 筛选设备:{{deviceCnt}}</text>
|
||||||
|
|
||||||
<view @click="refreshBleList()">刷新</view>
|
<view @click="refreshBleList()">刷新</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="">
|
<view class="">
|
||||||
@ -58,7 +58,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="list searchList">
|
<view class="list searchList">
|
||||||
<view class="item" v-on:click="Link(item,index)" v-for="item, index in EquipMents"
|
<view class="item" v-on:click="Link(item,index)" v-for="item, index in EquipMents"
|
||||||
v-show="item.name.indexOf(search)>-1">
|
v-show="item.name.toLowerCase().indexOf(search.toLowerCase())>-1">
|
||||||
<view class="before" v-if="item.isTarget"></view>
|
<view class="before" v-if="item.isTarget"></view>
|
||||||
<view class="leftImg ">
|
<view class="leftImg ">
|
||||||
<image src="/static/images/BLEAdd/bluetooth.png" class="titleIco" mode="heightFix">
|
<image src="/static/images/BLEAdd/bluetooth.png" class="titleIco" mode="heightFix">
|
||||||
@ -68,7 +68,7 @@
|
|||||||
<view class="name">
|
<view class="name">
|
||||||
<text>{{item.name?item.name:'Unnamed'}}</text>
|
<text>{{item.name?item.name:'Unnamed'}}</text>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<view class="id">
|
<view class="id">
|
||||||
<text>信号:{{item.RSSI}}dBm</text>
|
<text>信号:{{item.RSSI}}dBm</text>
|
||||||
</view>
|
</view>
|
||||||
@ -131,7 +131,7 @@
|
|||||||
var ble = null;
|
var ble = null;
|
||||||
var these = null;
|
var these = null;
|
||||||
var eventChannel = null;
|
var eventChannel = null;
|
||||||
|
var sortTime = null;
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -276,7 +276,7 @@
|
|||||||
}
|
}
|
||||||
console.log("处理蓝牙不可用");
|
console.log("处理蓝牙不可用");
|
||||||
hideLoading(these);
|
hideLoading(these);
|
||||||
|
clearInterval(these.Status.intval);
|
||||||
these.PairEquip = [];
|
these.PairEquip = [];
|
||||||
these.EquipMents = [];
|
these.EquipMents = [];
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@ -310,14 +310,12 @@
|
|||||||
if (these.Status.isPageHidden) {
|
if (these.Status.isPageHidden) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// console.log("处理蓝牙断开连接");
|
console.log("处理蓝牙断开连接");
|
||||||
|
if(res.deviceId==this.item.deviceId){
|
||||||
|
these.item.deviceId = null;
|
||||||
these.refreshLinked();
|
these.refreshLinked();
|
||||||
|
clearInterval(these.Status.intval);
|
||||||
setTimeout(() => {
|
}
|
||||||
hideLoading(these);
|
|
||||||
}, 1500);
|
|
||||||
|
|
||||||
}, pagePath);
|
}, pagePath);
|
||||||
|
|
||||||
@ -348,7 +346,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!f) {
|
if (!f) {
|
||||||
|
|
||||||
if (these.device && these.device.bluetoothName && device.name) {
|
if (these.device && these.device.bluetoothName && device.name) {
|
||||||
const bn = these.device.bluetoothName;
|
const bn = these.device.bluetoothName;
|
||||||
if (bn === device.name ||
|
if (bn === device.name ||
|
||||||
@ -357,16 +355,23 @@
|
|||||||
device.isTarget = true;
|
device.isTarget = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 102J:与 100J 同 AE30 芯片;协议不同。广播名一般为 HBY102J-xxxxxx(见协议)
|
||||||
|
if (device.name && /^HBY102J/i.test(device.name)) {
|
||||||
|
device.isTarget = true;
|
||||||
|
}
|
||||||
if (device.name) {
|
if (device.name) {
|
||||||
device.name = device.name.replace('JQZM-', '');
|
device.name = device.name.replace(/^HBY102J-/i, '');
|
||||||
}
|
}
|
||||||
these.EquipMents.push(device);
|
these.EquipMents.push(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
clearTimeout(sortTime);
|
||||||
|
sortTime = setTimeout(() => {
|
||||||
|
these.EquipMents.sort((a, b) => b.RSSI - a.RSSI);
|
||||||
|
}, 500);
|
||||||
|
|
||||||
these.EquipMents.sort((a, b) => b.RSSI - a.RSSI); //信号好的排前面,一般信号好的是目标设备
|
|
||||||
|
|
||||||
}, pagePath);
|
}, pagePath);
|
||||||
|
|
||||||
@ -402,23 +407,27 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (receivData.str.indexOf('mac address:') > -1 || receivData.str.indexOf(
|
if (f.deviceId == this.item.deviceId) {//只处理本次连接的设备消息
|
||||||
'sta_address') > -1 ||
|
if ((receivData.str && (receivData.str.indexOf('mac address:') > -1 || receivData
|
||||||
(receivData.bytes[0] === 0xFC && receivData.bytes.length >= 7)) {
|
.str.indexOf(
|
||||||
|
'sta_address') > -1)) ||
|
||||||
|
(receivData.bytes && receivData.bytes[0] === 0xFC && receivData.bytes.length >=
|
||||||
|
7)) {
|
||||||
|
|
||||||
if (f.macAddress && these.device) {
|
if (f.macAddress && these.device) {
|
||||||
|
|
||||||
clearInterval(this.Status.intval);
|
clearInterval(this.Status.intval);
|
||||||
this.Status.intval = null;
|
this.Status.intval = null;
|
||||||
this.Status.time = null;
|
this.Status.time = null;
|
||||||
|
|
||||||
showLoading(these, {
|
showLoading(these, {
|
||||||
text: '正在验证设备'
|
text: '正在验证设备'
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
these.DeviceVerdict(f.deviceId);
|
these.DeviceVerdict(f.deviceId);
|
||||||
}, 0);
|
}, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, pagePath);
|
}, pagePath);
|
||||||
@ -627,10 +636,10 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
hideLoading(these);
|
hideLoading(these);
|
||||||
these.device.bleId=deviceId;
|
these.device.bleId = deviceId;
|
||||||
eventChannel.emit('BindOver', these.device);
|
|
||||||
|
|
||||||
ble.updateCache();
|
ble.updateCache();
|
||||||
|
eventChannel.emit('BindOver', these.device);
|
||||||
uni.navigateBack();
|
uni.navigateBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -638,7 +647,8 @@
|
|||||||
if (f && f.macAddress) {
|
if (f && f.macAddress) {
|
||||||
|
|
||||||
if (!these.device || !these.device.deviceMac) { //走服务端验证
|
if (!these.device || !these.device.deviceMac) { //走服务端验证
|
||||||
console.error("走服务端验证")
|
console.error("理论上永远不会走这里,走服务端验证");
|
||||||
|
console.error("我TM太相信理论了");
|
||||||
request({
|
request({
|
||||||
url: '/app/device/getDeviceInfoByDeviceMac',
|
url: '/app/device/getDeviceInfoByDeviceMac',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
@ -646,8 +656,6 @@
|
|||||||
deviceMac: f.macAddress
|
deviceMac: f.macAddress
|
||||||
}
|
}
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
|
|
||||||
|
|
||||||
if (res && res.code == 200) {
|
if (res && res.code == 200) {
|
||||||
|
|
||||||
let data = res.data;
|
let data = res.data;
|
||||||
@ -697,17 +705,7 @@
|
|||||||
clearInterval(this.Status.intval)
|
clearInterval(this.Status.intval)
|
||||||
this.Status.intval = null;
|
this.Status.intval = null;
|
||||||
this.Status.time = null;
|
this.Status.time = null;
|
||||||
f = ble.data.LinkedList.find(v => {
|
deviceInvalid();
|
||||||
if (v.deviceId == deviceId) {
|
|
||||||
v.device = these.device;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
if (!(f && f.macAddress)) {
|
|
||||||
deviceInvalid()
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -725,9 +723,9 @@
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
Link: function(item) {
|
Link: function(item) {
|
||||||
this.item.deviceId = item.deviceId;
|
|
||||||
showLoading(this, {
|
showLoading(this, {
|
||||||
text: "正在连接:第1次"
|
text: "正在连接..."
|
||||||
});
|
});
|
||||||
|
|
||||||
let index = 1;
|
let index = 1;
|
||||||
@ -765,15 +763,18 @@
|
|||||||
ble.LinkBlue(item.deviceId).then((res) => {
|
ble.LinkBlue(item.deviceId).then((res) => {
|
||||||
this.tmpLink = [item];
|
this.tmpLink = [item];
|
||||||
console.log("连接成功");
|
console.log("连接成功");
|
||||||
ble.StopSearch();
|
these.item.deviceId = item.deviceId;
|
||||||
|
ble.StopSearch().catch(ex=>{});
|
||||||
resolve(res);
|
resolve(res);
|
||||||
|
|
||||||
}).catch((ex) => {
|
}).catch((ex) => {
|
||||||
if (index == total) {
|
if (index == total) {
|
||||||
console.log("连接了N次都没连上");
|
console.log("连接了N次都没连上");
|
||||||
reject(ex);
|
reject(ex);
|
||||||
updateLoading(this, {
|
updateLoading(this, {
|
||||||
text: ex.msg
|
text: ex.msg
|
||||||
})
|
});
|
||||||
|
this.item.deviceId =null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
index++;
|
index++;
|
||||||
|
|||||||
@ -122,7 +122,7 @@ class BleHelper {
|
|||||||
{
|
{
|
||||||
key: '10013',
|
key: '10013',
|
||||||
remark: '连接 deviceId 为空或者是格式不正确'
|
remark: '连接 deviceId 为空或者是格式不正确'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: '10016',
|
key: '10016',
|
||||||
remark: '定位服务已关闭'
|
remark: '定位服务已关闭'
|
||||||
@ -164,7 +164,20 @@ class BleHelper {
|
|||||||
//更新缓存
|
//更新缓存
|
||||||
updateCache() {
|
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();
|
||||||
|
|
||||||
}
|
}
|
||||||
//连接所有已连接过的设备
|
//连接所有已连接过的设备
|
||||||
@ -933,7 +946,9 @@ class BleHelper {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
this.updateCache();
|
this.updateCache();
|
||||||
|
|
||||||
if (f && f.device && f.device.id && this.data.available) {
|
if (f && f.device && f.device.id && this.data.available) {
|
||||||
|
//已绑定过的设备尝试重连
|
||||||
let fdis = this.data.Disconnect.find(dis => {
|
let fdis = this.data.Disconnect.find(dis => {
|
||||||
return dis === res.deviceId
|
return dis === res.deviceId
|
||||||
}); //用户主动断开的,不再重连
|
}); //用户主动断开的,不再重连
|
||||||
@ -954,6 +969,9 @@ class BleHelper {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
//未绑定过的设备播放连接锁
|
||||||
|
delete this.data.connectingDevices[res.deviceId];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.cfg.bleDisposeCallback.length > 0) {
|
if (this.cfg.bleDisposeCallback.length > 0) {
|
||||||
@ -1595,7 +1613,7 @@ class BleHelper {
|
|||||||
LinkBlue(deviceId, targetServiceId, writeCharId, notifyCharId, maxRetries) {
|
LinkBlue(deviceId, targetServiceId, writeCharId, notifyCharId, maxRetries) {
|
||||||
|
|
||||||
//连接成功的回调
|
//连接成功的回调
|
||||||
let LinkedCallback=() => {
|
let LinkedCallback = () => {
|
||||||
if (this.cfg.recoveryCallback.length > 0) {
|
if (this.cfg.recoveryCallback.length > 0) {
|
||||||
this.cfg.recoveryCallback.forEach((
|
this.cfg.recoveryCallback.forEach((
|
||||||
c) => {
|
c) => {
|
||||||
@ -1613,7 +1631,6 @@ class BleHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (this.data.platform == 'web') {
|
if (this.data.platform == 'web') {
|
||||||
LinkedCallback();
|
LinkedCallback();
|
||||||
return Promise.resolve(true);
|
return Promise.resolve(true);
|
||||||
@ -1667,7 +1684,7 @@ class BleHelper {
|
|||||||
console.log("当前已连接,释放连接锁");
|
console.log("当前已连接,释放连接锁");
|
||||||
delete this.data.connectingDevices[deviceId];
|
delete this.data.connectingDevices[deviceId];
|
||||||
resolve(false);
|
resolve(false);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1689,7 +1706,7 @@ class BleHelper {
|
|||||||
|
|
||||||
delete this.data.connectingDevices[deviceId];
|
delete this.data.connectingDevices[deviceId];
|
||||||
console.error("新连接成功释放连接锁", deviceId);
|
console.error("新连接成功释放连接锁", deviceId);
|
||||||
|
|
||||||
// 处理 MTU 设置
|
// 处理 MTU 设置
|
||||||
if (plus.os.name === 'Android') {
|
if (plus.os.name === 'Android') {
|
||||||
this.setMtu(deviceId).catch(ex => {
|
this.setMtu(deviceId).catch(ex => {
|
||||||
@ -1703,7 +1720,7 @@ class BleHelper {
|
|||||||
if (c.deviceId == deviceId) {
|
if (c.deviceId == deviceId) {
|
||||||
c.Linked = true;
|
c.Linked = true;
|
||||||
c.linkId = linkId
|
c.linkId = linkId
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -1711,9 +1728,11 @@ class BleHelper {
|
|||||||
|
|
||||||
if (fIndex > -1) {
|
if (fIndex > -1) {
|
||||||
this.data.LinkedList[fIndex].Linked = true;
|
this.data.LinkedList[fIndex].Linked = true;
|
||||||
this.data.LinkedList[fIndex].linkId =linkId;
|
this.data.LinkedList[fIndex].linkId =
|
||||||
this.data.LinkedList[fIndex].name =cr.name;
|
linkId;
|
||||||
this.data.LinkedList[fIndex].advertisData =cr.advertisData;
|
this.data.LinkedList[fIndex].name = cr.name;
|
||||||
|
this.data.LinkedList[fIndex].advertisData =
|
||||||
|
cr.advertisData;
|
||||||
} else {
|
} else {
|
||||||
this.data.LinkedList.push(cr);
|
this.data.LinkedList.push(cr);
|
||||||
}
|
}
|
||||||
@ -1727,7 +1746,7 @@ class BleHelper {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
resolve(true);
|
resolve(true);
|
||||||
|
|
||||||
}).catch((ex) => {
|
}).catch((ex) => {
|
||||||
@ -1735,7 +1754,7 @@ class BleHelper {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
fail: (ex) => {
|
fail: (ex) => {
|
||||||
if(ex.code===10010){
|
if (ex.code === 10010) {
|
||||||
console.log("设备已连接,无需重复连接");
|
console.log("设备已连接,无需重复连接");
|
||||||
delete this.data.connectingDevices[deviceId];
|
delete this.data.connectingDevices[deviceId];
|
||||||
resolve(true);
|
resolve(true);
|
||||||
@ -1775,7 +1794,7 @@ class BleHelper {
|
|||||||
console.log("2222222");
|
console.log("2222222");
|
||||||
return linkDevice(deviceId);
|
return linkDevice(deviceId);
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
LinkedCallback();
|
LinkedCallback();
|
||||||
if (res) { //新连接(含 createBLEConnection 刚成功)
|
if (res) { //新连接(含 createBLEConnection 刚成功)
|
||||||
// console.log("11111111");
|
// console.log("11111111");
|
||||||
if (fIndex == -1) {
|
if (fIndex == -1) {
|
||||||
|
|||||||
@ -2,6 +2,9 @@ import Common from '@/utils/Common.js'
|
|||||||
import {
|
import {
|
||||||
parseBleData
|
parseBleData
|
||||||
} from '@/api/100J/HBY100-J.js'
|
} from '@/api/100J/HBY100-J.js'
|
||||||
|
import {
|
||||||
|
parseHby102jUplink
|
||||||
|
} from '@/api/102J/hby102jBleProtocol.js'
|
||||||
import {
|
import {
|
||||||
MsgSuccess,
|
MsgSuccess,
|
||||||
MsgError,
|
MsgError,
|
||||||
@ -30,6 +33,7 @@ class BleReceive {
|
|||||||
'/pages/4877/BJQ4877': this.Receive_4877.bind(this),
|
'/pages/4877/BJQ4877': this.Receive_4877.bind(this),
|
||||||
'/pages/100/HBY100': this.Receive_100.bind(this),
|
'/pages/100/HBY100': this.Receive_100.bind(this),
|
||||||
'/pages/102/HBY102': this.Receive_102.bind(this),
|
'/pages/102/HBY102': this.Receive_102.bind(this),
|
||||||
|
'/pages/102J/HBY102J': this.Receive_102J.bind(this),
|
||||||
'/pages/6170/deviceControl/index': this.Receive_6170.bind(this),
|
'/pages/6170/deviceControl/index': this.Receive_6170.bind(this),
|
||||||
'/pages/100J/HBY100-J': this.Receive_100J.bind(this),
|
'/pages/100J/HBY100-J': this.Receive_100J.bind(this),
|
||||||
'/pages/6075J/BJQ6075J': this.Receive_6075.bind(this),
|
'/pages/6075J/BJQ6075J': this.Receive_6075.bind(this),
|
||||||
@ -70,15 +74,24 @@ class BleReceive {
|
|||||||
|
|
||||||
|
|
||||||
ReceiveData(receive, f, path, recArr) {
|
ReceiveData(receive, f, path, recArr) {
|
||||||
// 100J:首页等场景 LinkedList 项可能未带齐 mac/device,但语音分片上传依赖 parseBleData 消费 FB 05
|
// AE30 服务:100J 与 102J 为同一套蓝牙芯片(GATT 相同),应用层协议不同。
|
||||||
|
// 100J:f 未就绪时仍需 parseBleData 消费 FB 05 等语音/文件应答。
|
||||||
|
// 102J:上行 FB 21–28 为晶全协议,不得走 100J parseBleData,避免误触发语音/文件回调。
|
||||||
const sid = receive && receive.serviceId ? String(receive.serviceId) : '';
|
const sid = receive && receive.serviceId ? String(receive.serviceId) : '';
|
||||||
const is100JAe30 = /ae30/i.test(sid);
|
const isAe30 = /ae30/i.test(sid);
|
||||||
const fReady = f && f.macAddress && f.device && f.device.id;
|
const fReady = f && f.macAddress && f.device && f.device.id;
|
||||||
if (is100JAe30 && receive && receive.bytes && receive.bytes.length >= 3 && !fReady) {
|
const u8Early = receive && receive.bytes && receive.bytes.length >= 4
|
||||||
try {
|
? new Uint8Array(receive.bytes)
|
||||||
parseBleData(new Uint8Array(receive.bytes));
|
: null;
|
||||||
} catch (e) {
|
const is102JFbControl = u8Early && u8Early[0] === 0xfb && u8Early[u8Early.length - 1] === 0xff
|
||||||
console.warn('[100J] ReceiveData 兜底解析失败', e);
|
&& u8Early[1] >= 0x21 && u8Early[1] <= 0x28;
|
||||||
|
if (isAe30 && receive && receive.bytes && receive.bytes.length >= 3 && !fReady) {
|
||||||
|
if (!is102JFbControl) {
|
||||||
|
try {
|
||||||
|
parseBleData(new Uint8Array(receive.bytes));
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('[100J/AE30] ReceiveData 兜底 parseBleData 失败', e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return receive;
|
return receive;
|
||||||
}
|
}
|
||||||
@ -107,8 +120,8 @@ class BleReceive {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// 100J AE30 二进制帧在 f 不完整时已在上方 parseBleData,此处不再误报「无法处理」
|
// AE30:100J 在 f 不完整时已在上方 parseBleData;102J 控制帧被有意跳过 parseBleData
|
||||||
if (!is100JAe30) {
|
if (!isAe30) {
|
||||||
console.error("已收到该消息,但无法处理", receive, "f:", f);
|
console.error("已收到该消息,但无法处理", receive, "f:", f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1013,6 +1026,147 @@ class BleReceive {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Receive_102J(receive, f, path, recArr) {
|
||||||
|
let receiveData = {}
|
||||||
|
try {
|
||||||
|
if (receive && receive.bytes && receive.bytes.length >= 3) {
|
||||||
|
receiveData = parseHby102jUplink(new Uint8Array(receive.bytes))
|
||||||
|
}
|
||||||
|
|
||||||
|
let recCnt = recArr.find((v) => {
|
||||||
|
return v.key.replace(/\//g, '').toLowerCase() == f.device.detailPageUrl
|
||||||
|
.replace(/\//g, '').toLowerCase()
|
||||||
|
})
|
||||||
|
if (!recCnt) {
|
||||||
|
let msgs = []
|
||||||
|
if (receiveData.sta_PowerPercent <= 20 && receiveData.sta_charge == 0) {
|
||||||
|
msgs.push("设备'" + f.device.deviceName + "'电量低")
|
||||||
|
}
|
||||||
|
if (receiveData.sta_Intrusion === 1) {
|
||||||
|
msgs.push("设备'" + f.device.deviceName + "'闯入报警中")
|
||||||
|
}
|
||||||
|
if (this.ref && msgs.length > 0) {
|
||||||
|
const text = msgs.join(',')
|
||||||
|
MsgError(text, '', this.ref, () => {
|
||||||
|
MsgClear(this.ref)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (f.device && path === 'pages/common/index') {
|
||||||
|
let linkKey = '102J_' + f.device.id + '_linked'
|
||||||
|
let warnKey = '102J_' + f.device.id + '_warning'
|
||||||
|
let time = new Date()
|
||||||
|
|
||||||
|
if (receiveData.sta_tomac) {
|
||||||
|
if (receiveData.sta_tomac.indexOf(':') === -1) {
|
||||||
|
receiveData.sta_tomac = receiveData.sta_tomac.replace(/(.{2})/g, '$1:').slice(0, -1)
|
||||||
|
}
|
||||||
|
uni.getStorageInfo({
|
||||||
|
success: function(res) {
|
||||||
|
let arr = []
|
||||||
|
let linked = {
|
||||||
|
linkId: f.linkId,
|
||||||
|
read: false,
|
||||||
|
linkEqs: [{
|
||||||
|
linkTime: time,
|
||||||
|
linkMac: f.macAddress
|
||||||
|
}, {
|
||||||
|
linkTime: time,
|
||||||
|
linkMac: receiveData.sta_tomac
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
if (res.keys.includes(linkKey)) {
|
||||||
|
arr = uni.getStorageSync(linkKey)
|
||||||
|
}
|
||||||
|
if (arr.length === 0) {
|
||||||
|
arr.unshift(linked)
|
||||||
|
} else {
|
||||||
|
let dev = arr.find((v) => {
|
||||||
|
if (v.linkId === f.linkId) {
|
||||||
|
let vl = v.linkEqs.find((cvl) => {
|
||||||
|
if (cvl.linkMac === receiveData.sta_tomac) {
|
||||||
|
v.read = false
|
||||||
|
cvl.linkTime = time
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
if (!vl) {
|
||||||
|
v.linkEqs.push({
|
||||||
|
linkTime: time,
|
||||||
|
linkMac: receiveData.sta_tomac
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return vl
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
if (!dev) {
|
||||||
|
arr.unshift(linked)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
uni.setStorage({
|
||||||
|
key: linkKey,
|
||||||
|
data: arr
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
let warnArrs = []
|
||||||
|
let guid = Common.guid()
|
||||||
|
if (receiveData.sta_sosadd) {
|
||||||
|
if (receiveData.sta_sosadd.indexOf(':') === -1) {
|
||||||
|
receiveData.sta_sosadd = receiveData.sta_sosadd.replace(/(.{2})/g, '$1:').slice(0, -1)
|
||||||
|
}
|
||||||
|
warnArrs.push({
|
||||||
|
linkId: f.linkId,
|
||||||
|
read: false,
|
||||||
|
key: guid,
|
||||||
|
warnType: '闯入报警',
|
||||||
|
warnMac: receiveData.sta_sosadd,
|
||||||
|
warnTime: time,
|
||||||
|
warnName: ''
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (receiveData.sta_LedType === 'led_alarm' || receiveData.ins_LedType === 'led_alarm') {
|
||||||
|
warnArrs.push({
|
||||||
|
linkId: f.linkId,
|
||||||
|
read: false,
|
||||||
|
key: guid,
|
||||||
|
warnType: '强制报警',
|
||||||
|
warnMac: f.macAddress,
|
||||||
|
warnTime: time,
|
||||||
|
warnName: ''
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (warnArrs.length > 0) {
|
||||||
|
uni.getStorageInfo({
|
||||||
|
success: function(res) {
|
||||||
|
let arr = []
|
||||||
|
if (res.keys.includes(warnKey)) {
|
||||||
|
arr = uni.getStorageSync(warnKey)
|
||||||
|
arr = warnArrs.concat(arr)
|
||||||
|
} else {
|
||||||
|
arr = warnArrs
|
||||||
|
}
|
||||||
|
uni.setStorage({
|
||||||
|
key: warnKey,
|
||||||
|
data: arr
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
receiveData = {}
|
||||||
|
console.log('Receive_102J 解析失败', error)
|
||||||
|
}
|
||||||
|
return receiveData
|
||||||
|
}
|
||||||
|
|
||||||
Receive_6075(receive, f, path, recArr) {
|
Receive_6075(receive, f, path, recArr) {
|
||||||
let receiveData = {};
|
let receiveData = {};
|
||||||
|
|||||||
Reference in New Issue
Block a user