670完成
This commit is contained in:
@ -104,29 +104,7 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- <view class="lampMode">
|
||||
<view class="mode fleft" :class="formData.lightCurr?'active':''" v-on:click.stop="LampToggle()">
|
||||
<view class="leftImg">
|
||||
<image class="img" src="/static/images/6155/DeviceDetail/mainLamp.png" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="rightTxt">
|
||||
<text class="bigTxt">照明模式</text>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="mode marginLeft fleft" :class="formData.cMode=='mode'?'':'active'"
|
||||
v-on:click.stop="ShowUpload()">
|
||||
<view class="leftImg">
|
||||
<image class="img" src="/static/images/6155/DeviceDetail/open.png" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="rightTxt">
|
||||
<text class="bigTxt">开机画面</text>
|
||||
<text class="smallTxt">上传</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="clear"></view>
|
||||
</view> -->
|
||||
|
||||
<view class="usrinfo">
|
||||
<view @click="Status.usrToggle=!Status.usrToggle">
|
||||
<text class="usrtitle fleft">人员信息登记</text>
|
||||
@ -161,6 +139,35 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="usrinfo">
|
||||
<view >
|
||||
<text class="usrtitle fleft">发送信息</text>
|
||||
<view class="btnSend fright" v-on:click.stop="sendUrgent(null)">发送</view>
|
||||
<view class="clear"></view>
|
||||
</view>
|
||||
<view >
|
||||
|
||||
<view class="item">
|
||||
<input class="value" style="text-indent: 20rpx;" v-model="formData.msgTxt" placeholder="请输入文字" placeholder-class="usrplace" />
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="usrinfo picVideo">
|
||||
<view >
|
||||
<text class="usrtitle fleft">开机画面</text>
|
||||
|
||||
<view class="clear"></view>
|
||||
</view>
|
||||
<view v-on:click.stop="ShowUpload()" class="btnImg center">
|
||||
|
||||
<image class="img" src="/static/images/6155/DeviceDetail/add.png" mode="aspectFit"></image>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="proinfo lamp">
|
||||
<text class="title">产品信息</text>
|
||||
<view class="itemcontent">
|
||||
@ -297,7 +304,7 @@
|
||||
job: "", //职位
|
||||
id: "", //id
|
||||
msgTxt: "", //消息1
|
||||
qzwarn: false, //是否报警
|
||||
qzwarn: false, //是否强制报警
|
||||
warnLevel: "", //报警级别
|
||||
staticWarn:false,//静止报警
|
||||
fourGStrenth:0,//4G信号强度
|
||||
@ -323,7 +330,8 @@
|
||||
showConfirm: false
|
||||
},
|
||||
rgb565Data: [],
|
||||
videoHexArray: []
|
||||
videoHexArray: [],
|
||||
picPath:""
|
||||
}
|
||||
},
|
||||
|
||||
@ -421,22 +429,26 @@
|
||||
|
||||
let json = JSON.parse(payload);
|
||||
let keys = Object.keys(json);
|
||||
console.log("keys=", keys);
|
||||
// console.log("keys=", keys);
|
||||
if (keys.indexOf('sta_DetectGrade') > -1) { //上报的报文
|
||||
console.log("收到设备上报的数据", payload);
|
||||
// this.parseDataMQ(json);
|
||||
} else if (keys.indexOf('sta_PicTrans') > -1) { //发送开机画面
|
||||
console.log("收到开机画面答复", payload);
|
||||
// this.SendImgMQ(json);
|
||||
} else if (keys.indexOf('sta_TexTrans') > -1) { //发送文本信息
|
||||
console.log("收到文本回复", payload);
|
||||
// this.SendTxtMQ(json);
|
||||
} else if (keys.indexOf('sta_BreakNews') > -1) { //紧急通知
|
||||
console.log("收到紧急消息回复", payload);
|
||||
// this.sendUrgentMQ(json);
|
||||
} else {
|
||||
console.log("收到不能处理的数据", payload);
|
||||
}
|
||||
this.parseDataMQ(json);
|
||||
}
|
||||
// else if (keys.indexOf('sta_PicTrans') > -1) { //发送开机画面
|
||||
// console.log("收到开机画面答复", payload);
|
||||
// // this.SendImgMQ(json);
|
||||
// }
|
||||
// else if (keys.indexOf('sta_TexTrans') > -1) { //发送文本信息
|
||||
// console.log("收到文本回复", payload);
|
||||
// // this.SendTxtMQ(json);
|
||||
// }
|
||||
// else if (keys.indexOf('sta_BreakNews') > -1) { //紧急通知
|
||||
// console.log("收到紧急消息回复", payload);
|
||||
// // this.sendUrgentMQ(json);
|
||||
// }
|
||||
// else {
|
||||
// console.log("收到不能处理的数据", payload);
|
||||
// }
|
||||
|
||||
|
||||
} catch (error) {
|
||||
@ -476,7 +488,54 @@
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
parseDataMQ(json){
|
||||
let staticLevelText = "";
|
||||
let dic = {
|
||||
"3": "hight",
|
||||
"2": "center",
|
||||
"1": "low",
|
||||
"0": "close",
|
||||
|
||||
};
|
||||
staticLevelText = dic[json.sta_DetectGrade];
|
||||
|
||||
let lightingLevelText = json.sta_LightGrade ===
|
||||
1 ? 'hight' :
|
||||
json.sta_LightGrade ===
|
||||
2 ?
|
||||
'low' :
|
||||
'close';
|
||||
let warn = "";
|
||||
dic = {
|
||||
"0": "none",
|
||||
"1": "ruo",
|
||||
"2": "center",
|
||||
"3": "hight",
|
||||
"4": "veryhight",
|
||||
};
|
||||
warn = dic[json.sta_DetectResult];
|
||||
|
||||
|
||||
let sosText = json.sta_SOSGrade === 2 ? 'rb' :
|
||||
json.sta_SOSGrade === 1 ? "sg" : "close"
|
||||
|
||||
let staticWarn = json.sta_ShakeBit === 1 ;
|
||||
|
||||
receiveData.modeCurr = staticLevelText;
|
||||
receiveData.lightCurr = lightingLevelText;
|
||||
receiveData.xuhang = json.sta_PowerTime + "分钟";
|
||||
receiveData.battary = json.sta_PowerPercent + "%";
|
||||
receiveData.SOS = sosText;
|
||||
receiveData.warnLevel = warn;
|
||||
receiveData.staticWarn = staticWarn;
|
||||
receiveData.fourGStrenth = json.sta_4gSinal;
|
||||
receiveData.imei = json.sta_imei;
|
||||
receiveData.Lon = json.sta_longitude;
|
||||
receiveData.Lat = json.sta_latitude;
|
||||
|
||||
this.refreshFormData(receiveData);
|
||||
return receiveData;
|
||||
},
|
||||
bleValueNotify: function(receive, device, path) { //订阅消息
|
||||
|
||||
let data = recei.ReceiveData(receive, device, pagePath);
|
||||
@ -503,41 +562,44 @@
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
let keys = Object.keys(data);
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
let key = keys[i];
|
||||
if (key in these.formData) {
|
||||
these.formData[key] = data[key];
|
||||
}
|
||||
}
|
||||
if(this.formData.imei){
|
||||
this.initMQ();
|
||||
}
|
||||
if (these.formData.staticWarn) {//有静止报警
|
||||
these.showPop({
|
||||
message: "自动报警",
|
||||
iconUrl: "/static/images/6155/DeviceDetail/warnning.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonText:"解除报警",
|
||||
clickEvt:"staticWarn"
|
||||
});
|
||||
this.Status.staticWarn.time=180;
|
||||
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)
|
||||
|
||||
}
|
||||
|
||||
these.setBleFormData();
|
||||
this.refreshFormData(data);
|
||||
|
||||
}
|
||||
},
|
||||
refreshFormData(data){
|
||||
let keys = Object.keys(data);
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
let key = keys[i];
|
||||
if (key in these.formData) {
|
||||
these.formData[key] = data[key];
|
||||
}
|
||||
}
|
||||
if(this.formData.imei){
|
||||
this.initMQ();
|
||||
}
|
||||
if (these.formData.staticWarn) {//有静止报警
|
||||
these.showPop({
|
||||
message: "自动报警",
|
||||
iconUrl: "/static/images/6155/DeviceDetail/warnning.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonText:"解除报警",
|
||||
clickEvt:"staticWarn"
|
||||
});
|
||||
this.Status.staticWarn.time=180;
|
||||
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)
|
||||
|
||||
}
|
||||
|
||||
these.setBleFormData();
|
||||
},
|
||||
getDevice: function() {
|
||||
|
||||
// console.log("LinkedList=", ble.data.LinkedList);
|
||||
@ -796,7 +858,7 @@
|
||||
proParam: function() {
|
||||
|
||||
uni.navigateTo({
|
||||
url: '/pages/common/productDes/index?id=' + this.formData.id,
|
||||
url: '/pages/common/productDes/index?id=' + this.device.id,
|
||||
success(ev) {
|
||||
|
||||
}
|
||||
@ -804,7 +866,7 @@
|
||||
},
|
||||
handRemark: function() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/common/operatingInstruct/index?id=' + this.formData.id,
|
||||
url: '/pages/common/operatingInstruct/index?id=' + this.device.id,
|
||||
success(ev) {
|
||||
|
||||
}
|
||||
@ -812,7 +874,7 @@
|
||||
},
|
||||
handVideo: function() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/common/operationVideo/index?id=' + this.formData.id,
|
||||
url: '/pages/common/operationVideo/index?id=' + this.device.id,
|
||||
success(ev) {
|
||||
|
||||
}
|
||||
@ -821,6 +883,41 @@
|
||||
checkImgUpload: function(type, index) {
|
||||
console.log("123213213213");
|
||||
let f = these.getDevice();
|
||||
|
||||
var sendImgByRequest=()=>{
|
||||
return new Promise((resolve,reject)=>{
|
||||
api.sendPic({
|
||||
picPath:these.picPath,
|
||||
deviceId:these.device.id,
|
||||
deviceImei:these.device.deviceImei
|
||||
}).then((res)=>{
|
||||
if (res.code == 200) {
|
||||
these.showPop({
|
||||
showPop: true,
|
||||
message: "上传成功",
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png",
|
||||
});
|
||||
resolve();
|
||||
return;
|
||||
} else {
|
||||
|
||||
these.showPop({
|
||||
message: res.errMsg?res.errMsg:"未知的原因上传失败了",
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
});
|
||||
reject(res);
|
||||
}
|
||||
}).catch((ex)=>{
|
||||
console.log("图片上传失败了",ex);
|
||||
reject(ex)
|
||||
}).finally(()=>{
|
||||
hideLoading(these);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
// 分包发送图片数据
|
||||
var sendImagePackets = function(ReSendNo) {
|
||||
|
||||
@ -918,7 +1015,7 @@
|
||||
updateLoading(these, {
|
||||
text: "正在发送:" + currentPacket + "/" +
|
||||
totalPackets
|
||||
})
|
||||
});
|
||||
currentPacket++;
|
||||
|
||||
setTimeout(sendNextPacket, 0);
|
||||
@ -927,19 +1024,21 @@
|
||||
if (err.code == '10007') {
|
||||
setTimeout(sendNextPacket, 0);
|
||||
return;
|
||||
}else{
|
||||
updateLoading(these, {
|
||||
text: "蓝牙发送失败,正在使用4G发送"
|
||||
});
|
||||
sendImgByRequest().then(resolve).catch(reject);
|
||||
}
|
||||
these.Status.BottomMenu.show = false;
|
||||
|
||||
|
||||
|
||||
these.showPop({
|
||||
message: err.msg,
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
});
|
||||
hideLoading(these);
|
||||
reject(err);
|
||||
// these.Status.BottomMenu.show = false;
|
||||
// these.showPop({
|
||||
// message: err.msg,
|
||||
// iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||
// borderColor: "#e034344d",
|
||||
// buttonBgColor: "#E03434",
|
||||
// });
|
||||
// hideLoading(these);
|
||||
// reject(err);
|
||||
});
|
||||
}
|
||||
|
||||
@ -952,15 +1051,11 @@
|
||||
f.wirteCharactId).then(() => {
|
||||
sendNextPacket();
|
||||
}).catch((err) => {
|
||||
console.log("握手没有成功");
|
||||
these.showPop({
|
||||
message: err.msg,
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
updateLoading(these, {
|
||||
text: "蓝牙发送失败,正在使用4G发送"
|
||||
});
|
||||
hideLoading(these);
|
||||
reject(err);
|
||||
sendImgByRequest().then(resolve).catch(reject);
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -978,8 +1073,10 @@
|
||||
});
|
||||
|
||||
these.Status.BottomMenu.show = false;
|
||||
these.rgb565Data = ble.convertToRGB565(data);
|
||||
these.picPath=data.picPath;
|
||||
these.rgb565Data = ble.convertToRGB565(data.piexls);
|
||||
setTimeout(function() {
|
||||
|
||||
sendImagePackets().catch(() => {
|
||||
|
||||
});
|
||||
@ -1080,7 +1177,7 @@
|
||||
dataView.setUint8(6 + i, '0x' + packetData[i]);
|
||||
}
|
||||
|
||||
let inteval = 50;
|
||||
let inteval = 30;
|
||||
console.log("开始发送一段视频"); //
|
||||
ble.sendData(f.deviceId, buffer, f.writeServiceId, f
|
||||
.wirteCharactId, 10).then(() => {
|
||||
@ -1272,8 +1369,8 @@
|
||||
this.Status.BottomMenu.menuItems = [];
|
||||
this.Status.BottomMenu.title = "上传开机画面";
|
||||
this.Status.BottomMenu.type = "checkImg";
|
||||
this.Status.BottomMenu.show = true;
|
||||
this.formData.cMode = "img";
|
||||
this.Status.BottomMenu.show = true;
|
||||
this.Status.BottomMenu.showBtn=false;
|
||||
},
|
||||
|
||||
showMenu(flag) {
|
||||
@ -1335,8 +1432,8 @@
|
||||
|
||||
let requestSend=()=>{
|
||||
let json = {
|
||||
deviceId: '1942386314582163705',
|
||||
deviceImei: '862419074249128',
|
||||
deviceId: this.device.id,
|
||||
deviceImei: this.device.deviceImei?this.device.deviceImei:this.formData.imei,
|
||||
name: this.formData.company,
|
||||
position: this.formData.name,
|
||||
unitName: this.formData.job,
|
||||
@ -1514,6 +1611,67 @@
|
||||
|
||||
|
||||
|
||||
},
|
||||
sendUrgent(type) {
|
||||
if(!this.formData.msgTxt){
|
||||
|
||||
return;
|
||||
}
|
||||
showLoading(this, {
|
||||
text: "请稍候..."
|
||||
});
|
||||
this.setBleFormData();
|
||||
let arr=[];
|
||||
if(this.formData.msgTxt.length>8){
|
||||
arr.push(this.formData.msgTxt.substring(0,8));
|
||||
arr.push(this.formData.msgTxt.substring(8));
|
||||
}else{
|
||||
let index=Math.floor(this.formData.msgTxt.length/2)
|
||||
arr.push(this.formData.msgTxt.substring(0,index));
|
||||
arr.push(this.formData.msgTxt.substring(index));
|
||||
}
|
||||
|
||||
let data={
|
||||
"sendMsg": arr.join('|'),
|
||||
"deviceIds": [
|
||||
this.device.id
|
||||
],
|
||||
"deviceImeiList": [
|
||||
this.device.deviceImei?this.device.deviceImei:this.formData.imei
|
||||
]
|
||||
}
|
||||
console.log("data=",data);
|
||||
api.warnMsg(data).then((res)=>{
|
||||
if (res.code == 200) {
|
||||
these.showPop({
|
||||
showPop: true, //是否显示弹窗
|
||||
popType: 'custom',
|
||||
bgColor: '#383934bd',
|
||||
borderColor: '#BBE600',
|
||||
textColor: '#ffffffde',
|
||||
buttonBgColor: '#BBE600',
|
||||
buttonTextColor: '#232323DE',
|
||||
iconUrl: '/static/images/6155/DeviceDetail/sendSucc.png',
|
||||
message: '发送成功',
|
||||
buttonText: '确定',
|
||||
clickEvt: 'SendUsr',
|
||||
visiblePrompt: false,
|
||||
promptTitle: '',
|
||||
modelValue: '',
|
||||
visibleClose: true
|
||||
});
|
||||
} else {
|
||||
these.showPop({
|
||||
message: res.msg,
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
});
|
||||
}
|
||||
}).finally(()=>{
|
||||
hideLoading(this);
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
HoldYouHand(str, pauseTime, deviceid, serviceid, characid) {
|
||||
@ -2189,4 +2347,14 @@ display: flex;
|
||||
height: 100%;
|
||||
|
||||
}
|
||||
.picVideo .btnImg{
|
||||
width: 100%;
|
||||
height:100rpx;
|
||||
border-radius: 16rpx;
|
||||
background: rgba(42, 42, 42, 1);
|
||||
}
|
||||
.picVideo .btnImg .img{
|
||||
width: 40rpx;
|
||||
height:40rpx;
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user