1
0
forked from dyf/APP

完成008A功能开发

This commit is contained in:
liub
2026-05-19 17:38:56 +08:00
parent 6d9df4c945
commit 8f53a45280
63 changed files with 4162 additions and 766 deletions

View File

@ -84,12 +84,24 @@
</view>
</view>
<view class="warnnig" v-show="formData.sta_ShakeBit==1 && formData.sta_ShakeBit==2"
@click="showAction('map')">
<view class="warnnig" v-show="formData.sta_ShakeBit==1 && formData.sta_ShakeBit==2" @click="showAction('map')">
<view>{{ShakeBit}}</view>
</view>
<view class="lamp">
<view class="title">
<text>灯光亮度</text>
<text>{{formData.sta_brightness}}%</text>
</view>
<view class="slider-container">
<slider min="50" max="100" step="1" :disabled="false" :value="formData.sta_brightness"
activeColor="#bbe600" backgroundColor="#00000000" block-size="20" block-color="#ffffffde"
@change="sliderChange" @changing="sliderChanging" class="custom-slider" />
</view>
</view>
<view class="lampMode">
<view class="sosContent">
<view class="btnSos openSos center"
@ -147,6 +159,17 @@
</view>
</view>
<view class="mode fleft " @click.stop="WarnToggle()" :class="{active:formData.warnStatu}">
<view class="leftImg">
<image class="img" src="/static/images/common/linkMan.png" mode="aspectFit">
</image>
</view>
<view class="rightTxt">
<text class="bigTxt">关闭静止报警</text>
<text class="smallTxt" v-show="formData.warnStatu">已关闭</text>
</view>
</view>
@ -182,10 +205,10 @@
showPop,
MsgInfo,
MsgClear
} from '@/utils/MsgPops.js'
} from '@/utils/MsgPops.js';
import request, {
baseURL
} from '@/utils/request.js'
} from '@/utils/request.js';
import lnglatConvert from '@/utils/wgs84_to_gcj02.js';
import Common from '@/utils/Common.js';
@ -199,7 +222,7 @@
var mq = null;
var instrusionTime = null;
var reGeoTime = null;
var brightnessTimer=null;
export default {
data() {
@ -233,7 +256,8 @@
sta_ShakeBit: 0, //报警状态
sta_system: '', //0关机 1关机充电 2开机未充电 3开机充电
bleStatu: '',
warnStatu:false,
sta_brightness:50
},
dic: {
sta_Side_Light: [
@ -297,9 +321,9 @@
permissions: []
}
},
created() {
created() {
this.Status.navbar.height = uni.getSystemInfoSync().statusBarHeight + 44;
console.log("this.Status.navbar.height=",this.Status.navbar.height);
console.log("this.Status.navbar.height=", this.Status.navbar.height);
},
onUnload() {
console.log("页面卸载,释放资源");
@ -352,13 +376,15 @@ created() {
let key = keys[i];
these.formData[key] = form[key];
}
these.device.longitude = form.sta_longitude;
these.device.latitude = form.sta_latitude;
}
these.device.longitude = form.sta_longitude;
these.device.latitude = form.sta_latitude;
these.formData.blename = f.name ? f.name : "Unname";
these.formData.deviceName = device.deviceName;
these.formData.bleStatu = false;
these.formData.deviceId = f.deviceId;
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
@ -366,13 +392,13 @@ created() {
}).catch(ex => {
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
});;
});
these.formData.sta_IntrusTime = 0;
these.formData.sta_sosadd = "";
these.setBleFormData();
});
},
@ -415,7 +441,7 @@ created() {
let dic = {
"1": "设备SOS求救中",
"2": "设备静止报警中",
"6":"设备遇水报警中"
"6": "设备遇水报警中"
};
let keys = Object.keys(dic);
let f = keys.find(key => {
@ -432,6 +458,61 @@ created() {
},
methods: {
sliderChanging(e) {
this.formData.sta_brightness = e.detail.value;
},
sliderChange(e) {
this.formData.sta_brightness = e.detail.value;
// 清除之前的定时器
if (brightnessTimer) {
clearTimeout(brightnessTimer);
}
// 设置新的定时器,控制发送频率
brightnessTimer = setTimeout(() => {
let json = {
ins_brightness: e.detail.value
}
let f = this.getDevice();
if(f){
ble.sendString(f.deviceId, json).then(() => {
}).catch(() => {
this.mqSend(json).catch(ex=>{
MsgError(ex.msg,'',this,null,false);
});
});
}else{
this.mqSend(json).catch(ex=>{
MsgError(ex.msg,'',this,null,false);
});
}
}, 200);
},
WarnToggle(){
let json={ins_stop:1};
let f = this.getDevice();
if(f){
ble.sendString(f.deviceId, json).then(() => {
this.formData.warnStatu=true;
}).catch(() => {
// MsgError(ex.msg,'',this,null,false);
this.mqSend(json).catch(ex=>{
MsgError(ex.msg,'',this,null,false);
});
});
}else{
this.mqSend(json).catch(ex=>{
MsgError(ex.msg,'',this,null,false);
});
}
},
prevPage() {
uni.navigateBack({
@ -745,7 +826,7 @@ created() {
console.log("this.formData[key] =", this.formData[key]);
}
},
bleSend(json, validWarn = true,bleLink) {
bleSend(json, validWarn = true, bleLink) {
return new Promise((resolve, reject) => {
if (this.formData.sta_ShakeBit != '' && this.formData.sta_ShakeBit != '0' && validWarn) {
reject({
@ -759,10 +840,10 @@ created() {
reject({
code: -1
});
if(bleLink){
this.showBleUnConnect();
if (bleLink) {
this.showBleUnConnect();
}
return;
}
@ -849,6 +930,10 @@ created() {
},
gotoMap() {
if (!this.formData) {
MsgError("获取设备位置异常", '', these);
return;
}
if (!this.formData.sta_longitude || !this.formData.sta_latitude) {
MsgError("获取设备位置异常", '', these);
return;
@ -893,8 +978,8 @@ created() {
let json = {
ins_Side_Light: val
}
this.bleSend(json, true,false).then(() => {}).catch(ex => {
this.bleSend(json, true, false).then(() => {}).catch(ex => {
console.log("蓝牙发送失败尝试用mq发送");
this.mqSend(json, true).catch(err => {
if (err.code == -1) {
@ -922,7 +1007,20 @@ created() {
return;
}
let msg = type == 1 ? "确定开启强制报警" : '确定解除强制报警';
let json = {
ins_ShakeBit: type
};
let recordSOS=()=>{
request({
url: `/app/hby018a/device/ShakeBitSettings`,
method: 'post',
data: { 'deviceId': this.device.id, 'deviceImei': this.device.deviceImei, 'instructValue': json.ins_ShakeBit }
}).then((res) => {
console.log("记录强制报警",res);
});
}
showPop({
message: msg,
@ -938,19 +1036,21 @@ created() {
MsgClear(these);
},
okCallback: () => {
let json = {
ins_ShakeBit: type
};
this.bleSend(json, false,false).catch(ex => {
this.bleSend(json, false, false).then(res=>{
recordSOS();
}).catch(ex => {
this.mqSend(json, false).catch(err => {
if (err.code == -1) {
return;
}
MsgError(err.msg, '', these);
})
recordSOS();
}).then(()=>{
recordSOS();
});
});
}
@ -974,17 +1074,10 @@ created() {
these.setBleFormData();
},
deviceRecovry(res) {
console.log("蓝牙连接成功", these.formData);
console.log("蓝牙连接成功", res);
if (res.deviceId == these.formData.deviceId) {
this.formData.bleStatu = true;
setTimeout(() => {
hideLoading(these, 1000);
});
uni.showToast({
icon: 'success',
title: '蓝牙连接成功'
});
}
},
@ -1064,12 +1157,6 @@ created() {
let json = recei.ReceiveData(receive, device, pagePath, recArr);
this.receivData(json);
},
getDevice: function() {
@ -1102,10 +1189,9 @@ created() {
uni.navigateTo({
url: "/pages/common/addBLE/addEquip",
events: {
// BindOver: function(data) {
// console.log(data)
// these.formData.bleStatu = true;
// }
BindOver(data) {
these.formData.bleStatu = true;
}
},
success: function(res) {
// 通过eventChannel向被打开页面传送数据