670分享功能
This commit is contained in:
@ -53,6 +53,14 @@
|
|||||||
<view v-bind:class="getWarnStyle(5)" class="net netfive"></view>
|
<view v-bind:class="getWarnStyle(5)" class="net netfive"></view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="warnnig" v-bind:class="(formData.qzwarn && Status.staticWarn.time)?'':'displayNone'"
|
||||||
|
@click="CloseWarn(true)">
|
||||||
|
<view>设备强制闪烁报警中!</view>
|
||||||
|
<view class="netContent">
|
||||||
|
{{Status.staticWarn.time}}s
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
|
||||||
<view class="optTitle">
|
<view class="optTitle">
|
||||||
档位
|
档位
|
||||||
@ -250,7 +258,7 @@
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
Status: {
|
Status: {
|
||||||
apiType:"listA",
|
apiType: "listA",
|
||||||
navbar: {
|
navbar: {
|
||||||
icons: [{
|
icons: [{
|
||||||
src: '/static/images/common/msg.png'
|
src: '/static/images/common/msg.png'
|
||||||
@ -393,7 +401,7 @@
|
|||||||
|
|
||||||
console.log("收到父页面的参数:" + JSON.stringify(data));
|
console.log("收到父页面的参数:" + JSON.stringify(data));
|
||||||
var device = data.data;
|
var device = data.data;
|
||||||
these.Status.apiType=data.apiType;
|
these.Status.apiType = data.apiType;
|
||||||
these.device = device;
|
these.device = device;
|
||||||
if (these.device.deviceImei) {
|
if (these.device.deviceImei) {
|
||||||
these.initMQ();
|
these.initMQ();
|
||||||
@ -438,7 +446,7 @@
|
|||||||
methods: {
|
methods: {
|
||||||
getWarnStyle(index) {
|
getWarnStyle(index) {
|
||||||
let className = "";
|
let className = "";
|
||||||
|
|
||||||
switch (this.formData.warnLevel) {
|
switch (this.formData.warnLevel) {
|
||||||
case "none":
|
case "none":
|
||||||
break;
|
break;
|
||||||
@ -463,7 +471,7 @@
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return className;
|
return className;
|
||||||
},
|
},
|
||||||
handleRightClick: function(s, e) {
|
handleRightClick: function(s, e) {
|
||||||
@ -496,9 +504,9 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
initMQ() {
|
initMQ() {
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
||||||
if (mqttClient) {
|
if (mqttClient) {
|
||||||
console.log("无需再次初始化")
|
console.log("无需再次初始化")
|
||||||
resolve();
|
resolve();
|
||||||
@ -606,14 +614,14 @@
|
|||||||
};
|
};
|
||||||
warn = dic[json.sta_DetectResult];
|
warn = dic[json.sta_DetectResult];
|
||||||
|
|
||||||
|
|
||||||
let sosText =null;
|
let sosText = null;
|
||||||
if(json.sta_SOSGrade!==undefined){
|
if (json.sta_SOSGrade !== undefined) {
|
||||||
|
|
||||||
|
|
||||||
sosText=json.sta_SOSGrade === 2 ? 'rb' :
|
sosText = json.sta_SOSGrade === 2 ? 'rb' :
|
||||||
json.sta_SOSGrade === 1 ? "sg" : "close"
|
json.sta_SOSGrade === 1 ? "sg" : "close"
|
||||||
|
|
||||||
receiveData.SOS = sosText;
|
receiveData.SOS = sosText;
|
||||||
}
|
}
|
||||||
let staticWarn = json.sta_ShakeBit === 1;
|
let staticWarn = json.sta_ShakeBit === 1;
|
||||||
@ -622,7 +630,7 @@
|
|||||||
receiveData.lightCurr = lightingLevelText;
|
receiveData.lightCurr = lightingLevelText;
|
||||||
receiveData.xuhang = json.sta_PowerTime + "分钟";
|
receiveData.xuhang = json.sta_PowerTime + "分钟";
|
||||||
receiveData.battary = json.sta_PowerPercent + "%";
|
receiveData.battary = json.sta_PowerPercent + "%";
|
||||||
|
|
||||||
receiveData.warnLevel = warn;
|
receiveData.warnLevel = warn;
|
||||||
receiveData.staticWarn = staticWarn;
|
receiveData.staticWarn = staticWarn;
|
||||||
receiveData.fourGStrenth = json.sta_4gSinal;
|
receiveData.fourGStrenth = json.sta_4gSinal;
|
||||||
@ -630,13 +638,13 @@
|
|||||||
receiveData.Lon = json.sta_longitude;
|
receiveData.Lon = json.sta_longitude;
|
||||||
receiveData.Lat = json.sta_latitude;
|
receiveData.Lat = json.sta_latitude;
|
||||||
|
|
||||||
this.refreshFormData(receiveData,'auto');
|
this.refreshFormData(receiveData, 'auto');
|
||||||
return receiveData;
|
return receiveData;
|
||||||
},
|
},
|
||||||
bleValueNotify: function(receive, device, path) { //订阅消息
|
bleValueNotify: function(receive, device, path) { //订阅消息
|
||||||
|
|
||||||
let data = recei.ReceiveData(receive, device, pagePath);
|
let data = recei.ReceiveData(receive, device, pagePath);
|
||||||
console.log("收到设备的数据", data)
|
console.log("收到设备的数据", data)
|
||||||
if (data) {
|
if (data) {
|
||||||
if ("staBlue_picture" in data) {
|
if ("staBlue_picture" in data) {
|
||||||
//重发图片
|
//重发图片
|
||||||
@ -659,11 +667,11 @@
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.refreshFormData(data,'auto');
|
this.refreshFormData(data, 'auto');
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
refreshFormData(data,type) {
|
refreshFormData(data, type) {
|
||||||
let keys = Object.keys(data);
|
let keys = Object.keys(data);
|
||||||
for (var i = 0; i < keys.length; i++) {
|
for (var i = 0; i < keys.length; i++) {
|
||||||
let key = keys[i];
|
let key = keys[i];
|
||||||
@ -683,15 +691,7 @@
|
|||||||
buttonText: "确定",
|
buttonText: "确定",
|
||||||
clickEvt: "staticWarn"
|
clickEvt: "staticWarn"
|
||||||
});
|
});
|
||||||
// this.Status.staticWarn.time=5;
|
|
||||||
// this.Status.staticWarn.inteval=setInterval(()=>{
|
|
||||||
// if(this.Status.staticWarn.time===0){
|
|
||||||
// clearInterval(this.Status.staticWarn.inteval);
|
|
||||||
// this.formData.staticWarn=false;
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// this.Status.staticWarn.time=this.Status.staticWarn.time-1;
|
|
||||||
// },1000)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -754,7 +754,7 @@
|
|||||||
this.sendMQ(json).then((res) => {
|
this.sendMQ(json).then((res) => {
|
||||||
console.log("4g发送成功");
|
console.log("4g发送成功");
|
||||||
}).catch((ex) => {
|
}).catch((ex) => {
|
||||||
console.log("ex=",ex);
|
console.log("ex=", ex);
|
||||||
these.showPop({
|
these.showPop({
|
||||||
message: "通信异常,请检查手机或设备网络",
|
message: "通信异常,请检查手机或设备网络",
|
||||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||||
@ -799,6 +799,112 @@
|
|||||||
|
|
||||||
setTimeout(task, 0);
|
setTimeout(task, 0);
|
||||||
},
|
},
|
||||||
|
CloseWarn: function(ispop) {
|
||||||
|
let closeEvt=()=>{
|
||||||
|
{
|
||||||
|
these.Status.Pop.showPop = false;
|
||||||
|
|
||||||
|
these.formData.qzwarn = false;
|
||||||
|
clearInterval(these.Status.staticWarn.inteval);
|
||||||
|
|
||||||
|
let closeSOS=()=>{
|
||||||
|
let json = {
|
||||||
|
ins_SOSGrade: [0]
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
this.sendMQ(json).then((res) => {
|
||||||
|
console.log("4g发送成功");
|
||||||
|
}).catch((ex) => {
|
||||||
|
console.log("ex=",ex);
|
||||||
|
these.showPop({
|
||||||
|
message: "通信异常,请检查手机或设备网络",
|
||||||
|
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||||
|
borderColor: "#e034344d",
|
||||||
|
buttonBgColor: "#E03434",
|
||||||
|
});
|
||||||
|
|
||||||
|
}).finally(() => {
|
||||||
|
hideLoading(these);
|
||||||
|
these.setBleFormData();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
let closeWarn=()=>{
|
||||||
|
let json = {
|
||||||
|
ins_ShakeBit: [0]
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
this.sendMQ(json).then((res) => {
|
||||||
|
console.log("4g发送成功");
|
||||||
|
}).catch((ex) => {
|
||||||
|
console.log("ex=",ex);
|
||||||
|
these.showPop({
|
||||||
|
message: "通信异常,请检查手机或设备网络",
|
||||||
|
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||||
|
borderColor: "#e034344d",
|
||||||
|
buttonBgColor: "#E03434",
|
||||||
|
});
|
||||||
|
|
||||||
|
}).finally(() => {
|
||||||
|
hideLoading(these);
|
||||||
|
these.setBleFormData();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
let f = this.getDevice();
|
||||||
|
let buffer = null;
|
||||||
|
if (f) {
|
||||||
|
// 发送数据
|
||||||
|
buffer = new ArrayBuffer(6);
|
||||||
|
let dataView = new DataView(buffer);
|
||||||
|
dataView.setUint8(0, 0x55); // 帧头
|
||||||
|
dataView.setUint8(1, 0x06); // 帧类型
|
||||||
|
dataView.setUint8(2, 0x01); // 包序号
|
||||||
|
dataView.setUint8(3, 0x00); // 数据长度
|
||||||
|
dataView.setUint8(4, 0x01); // 数据长度
|
||||||
|
dataView.setUint8(5, 0x71); // 数据
|
||||||
|
|
||||||
|
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 10).then(
|
||||||
|
() => {
|
||||||
|
console.log("关闭强制报警成功")
|
||||||
|
dataView.setUint8(0, 0x55); // 帧头
|
||||||
|
dataView.setUint8(1, 0x05); // 帧类型
|
||||||
|
dataView.setUint8(2, 0x01); // 包序号
|
||||||
|
dataView.setUint8(3, 0x00); // 数据长度
|
||||||
|
dataView.setUint8(4, 0x01); // 数据长度
|
||||||
|
dataView.setUint8(5, 0x68);
|
||||||
|
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 10).then(()=>{
|
||||||
|
console.log("成功");
|
||||||
|
});
|
||||||
|
}).catch(ex => {
|
||||||
|
closeSOS();
|
||||||
|
closeWarn();
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
closeSOS();
|
||||||
|
closeWarn();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!ispop){
|
||||||
|
closeEvt();
|
||||||
|
}
|
||||||
|
this.showPop({
|
||||||
|
showHeader: true,
|
||||||
|
headerTxt: "强制报警",
|
||||||
|
message: '持续报警时间' + this.Status.staticWarn.time,
|
||||||
|
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||||
|
borderColor: "#e034344d",
|
||||||
|
buttonBgColor: "#E03434",
|
||||||
|
buttonText:"解除报警",
|
||||||
|
okCallback: closeEvt
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
sosSetting: function(type) {
|
sosSetting: function(type) {
|
||||||
if (this.formData.SOS == type) {
|
if (this.formData.SOS == type) {
|
||||||
type = "close";
|
type = "close";
|
||||||
@ -831,7 +937,7 @@
|
|||||||
this.sendMQ(json).then((res) => {
|
this.sendMQ(json).then((res) => {
|
||||||
console.log("4g发送成功");
|
console.log("4g发送成功");
|
||||||
}).catch((ex) => {
|
}).catch((ex) => {
|
||||||
console.log("ex=",ex);
|
console.log("ex=", ex);
|
||||||
these.showPop({
|
these.showPop({
|
||||||
message: "通信异常,请检查手机或设备网络",
|
message: "通信异常,请检查手机或设备网络",
|
||||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||||
@ -862,27 +968,28 @@
|
|||||||
dataView.setUint8(5, dic.ble[type]); // 数据
|
dataView.setUint8(5, dic.ble[type]); // 数据
|
||||||
|
|
||||||
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 10).then(
|
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 10).then(
|
||||||
() => {
|
() => {
|
||||||
console.log("蓝牙发送成功了");
|
console.log("蓝牙发送成功了");
|
||||||
|
|
||||||
dic={
|
dic = {
|
||||||
close: 0x71
|
close: 0x71
|
||||||
}
|
}
|
||||||
if(type in dic){
|
if (type in dic) {
|
||||||
dataView.setUint8(1, 0x06); // 帧类型
|
dataView.setUint8(1, 0x06); // 帧类型
|
||||||
dataView.setUint8(5, 0x71); // 数据
|
dataView.setUint8(5, 0x71); // 数据
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
dataView.setUint8(1, 0x06); // 帧类型
|
dataView.setUint8(1, 0x06); // 帧类型
|
||||||
dataView.setUint8(5, 0x70); // 数据
|
dataView.setUint8(5, 0x70); // 数据
|
||||||
}
|
}
|
||||||
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 10).then(()=>{
|
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId,
|
||||||
console.log("蓝牙发送报警成功",type);
|
10).then(() => {
|
||||||
})
|
console.log("蓝牙发送报警成功", type);
|
||||||
|
})
|
||||||
hideLoading(these);
|
|
||||||
these.setBleFormData();
|
hideLoading(these);
|
||||||
}).catch((ex) => {
|
these.setBleFormData();
|
||||||
|
}).catch((ex) => {
|
||||||
//使用4G发送
|
//使用4G发送
|
||||||
console.log("蓝牙发送失败,转4g发送", ex);
|
console.log("蓝牙发送失败,转4g发送", ex);
|
||||||
requestSend();
|
requestSend();
|
||||||
@ -892,7 +999,35 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SendCmd();
|
if (type !== 'sg') {
|
||||||
|
SendCmd();
|
||||||
|
} else {
|
||||||
|
|
||||||
|
this.showPop({
|
||||||
|
message: '确定开启声光报警模式?',
|
||||||
|
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||||
|
borderColor: "#e034344d",
|
||||||
|
buttonBgColor: "#E03434",
|
||||||
|
okCallback: function() {
|
||||||
|
these.formData.qzwarn = true;
|
||||||
|
|
||||||
|
these.Status.staticWarn.time = 5;
|
||||||
|
these.Status.staticWarn.inteval = setInterval(() => {
|
||||||
|
if (these.Status.staticWarn.time === 0) {
|
||||||
|
clearInterval(these.Status.staticWarn.inteval);
|
||||||
|
these.formData.qzwarn = false;
|
||||||
|
these.CloseWarn(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
these.Status.staticWarn.time = these.Status.staticWarn
|
||||||
|
.time - 1;
|
||||||
|
}, 1000)
|
||||||
|
|
||||||
|
SendCmd();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(task, 0);
|
setTimeout(task, 0);
|
||||||
@ -929,7 +1064,7 @@
|
|||||||
this.sendMQ(json).then((res) => {
|
this.sendMQ(json).then((res) => {
|
||||||
console.log("4g发送成功");
|
console.log("4g发送成功");
|
||||||
}).catch((ex) => {
|
}).catch((ex) => {
|
||||||
console.log("ex=",ex)
|
console.log("ex=", ex)
|
||||||
these.showPop({
|
these.showPop({
|
||||||
message: "通信异常,请检查手机或设备网络",
|
message: "通信异常,请检查手机或设备网络",
|
||||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||||
@ -1534,32 +1669,33 @@
|
|||||||
// clearInterval(this.Status.staticWarn.inteval);
|
// clearInterval(this.Status.staticWarn.inteval);
|
||||||
// this.formData.staticWarn=false;
|
// this.formData.staticWarn=false;
|
||||||
}
|
}
|
||||||
if(this.Status.Pop.okCallback){
|
if (this.Status.Pop.okCallback) {
|
||||||
console.log("执行点击按钮回调");
|
console.log("执行点击按钮回调");
|
||||||
this.Status.Pop.okCallback();
|
this.Status.Pop.okCallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.Status.Pop.showPop = false;
|
this.Status.Pop.showPop = false;
|
||||||
},
|
},
|
||||||
closePop: function() {
|
closePop: function() {
|
||||||
this.Status.Pop.showPop = false;
|
this.Status.Pop.showPop = false;
|
||||||
|
|
||||||
if(this.Status.Pop.cancelCallback){
|
if (this.Status.Pop.cancelCallback) {
|
||||||
this.Status.Pop.cancelCallback();
|
this.Status.Pop.cancelCallback();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
showPop: function(option) {
|
showPop: function(option) {
|
||||||
hideLoading(this);
|
hideLoading(this);
|
||||||
let defaultCfg = {
|
let defaultCfg = {
|
||||||
showCancel: false,
|
showHeader: false,
|
||||||
borderColor: '#BBE600',
|
showCancel: false,
|
||||||
buttonBgColor:'#BBE600',
|
borderColor: '#BBE600',
|
||||||
okCallback:null,
|
buttonBgColor: '#BBE600',
|
||||||
cancelCallback:null,
|
okCallback: null,
|
||||||
popType: 'custom'
|
cancelCallback: null,
|
||||||
};
|
popType: 'custom'
|
||||||
|
};
|
||||||
if (!option) {
|
if (!option) {
|
||||||
|
|
||||||
}
|
}
|
||||||
let keys = Object.keys(option);
|
let keys = Object.keys(option);
|
||||||
for (var i = 0; i < keys.length; i++) {
|
for (var i = 0; i < keys.length; i++) {
|
||||||
@ -1569,12 +1705,12 @@
|
|||||||
keys = Object.keys(defaultCfg);
|
keys = Object.keys(defaultCfg);
|
||||||
for (var i = 0; i < keys.length; i++) {
|
for (var i = 0; i < keys.length; i++) {
|
||||||
let key = keys[i];
|
let key = keys[i];
|
||||||
if(key in option){
|
if (key in option) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
these.Status.Pop[key] = defaultCfg[key];
|
these.Status.Pop[key] = defaultCfg[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
these.Status.Pop.showPop = true;
|
these.Status.Pop.showPop = true;
|
||||||
},
|
},
|
||||||
sendUsr: function(ReSendNo) {
|
sendUsr: function(ReSendNo) {
|
||||||
@ -2515,8 +2651,8 @@
|
|||||||
width: 40rpx;
|
width: 40rpx;
|
||||||
height: 40rpx;
|
height: 40rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.netContent {
|
.netContent {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
@ -2526,32 +2662,32 @@
|
|||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
width: 50rpx;
|
width: 50rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.net {
|
.net {
|
||||||
width: 7rpx;
|
width: 7rpx;
|
||||||
background: rgba(255, 255, 255, 0.3);
|
background: rgba(255, 255, 255, 0.3);
|
||||||
}
|
}
|
||||||
|
|
||||||
.net.netone {
|
.net.netone {
|
||||||
height: 11rpx;
|
height: 11rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.net.nettwo {
|
.net.nettwo {
|
||||||
height: 17rpx;
|
height: 17rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.net.netsiri {
|
.net.netsiri {
|
||||||
height: 23rpx;
|
height: 23rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.net.netfour {
|
.net.netfour {
|
||||||
height: 29rpx;
|
height: 29rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.net.netfive {
|
.net.netfive {
|
||||||
height: 35rpx;
|
height: 35rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.net.active {
|
.net.active {
|
||||||
background: #FFFFFF !important;
|
background: #FFFFFF !important;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user