This commit is contained in:
fengerli
2026-04-14 16:25:00 +08:00
39 changed files with 3414 additions and 1777 deletions

View File

@ -66,7 +66,9 @@
</view>
<ProParams :id="device.id"></ProParams>
<MsgBox ref="msgPop" />
<global-loading ref="loading" />
</view>
</template>
@ -85,7 +87,8 @@
MsgClose,
MsgWarning,
showPop,
MsgInfo
MsgInfo,
MsgPrompt
} from '@/utils/MsgPops.js'
import Common from '@/utils/Common.js';
import BleTool from '@/utils/BleHelper.js'
@ -213,7 +216,7 @@
},
onLoad() {
these = this;
recei = BleReceive.getBleReceive();
ble = BleTool.getBleTool();
@ -227,8 +230,8 @@
eventChannel = this.getOpenerEventChannel();
eventChannel.on('detailData', function(data) {
eventChannel.on('detailData', (data)=> {
console.log("收到父页面的参数:" + JSON.stringify(data));
var device = data.data;
these.Status.apiType = data.apiType;
@ -1196,7 +1199,7 @@
.navbarRight .img {
width: 35rpx;
height: 35rpx;
margin-right: 20rpx;
margin-right: 30rpx;
}
.uni-navbar--fixed {

View File

@ -623,7 +623,7 @@
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
buttonTextColor: '#FFFFFFde',
okCallback: function() {
uni.navigateTo({

View File

@ -1360,7 +1360,7 @@ onFreqChanging(e){
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
buttonTextColor: '#FFFFFFde',
okCallback: function() {
uni.navigateTo({

View File

@ -58,6 +58,11 @@
<text class="value"
:class="deviceInfo.onlineStatus===0?'red':'green'">{{ deviceInfo.onlineStatus === 0 ? '离线': '在线' }}</text>
</view>
<view class="item">
<text class="lbl">充电状态</text>
<text class="value"
>{{ deviceInfo.chargingStatus === 0 ? '未充电': '充电中' }}</text>
</view>
<view class="info-row">
<text class="info-label" style="display: flex; align-items: center;">定位信息</text>
<view class="info-value status-running" @click="gpsPosition(deviceInfo)">
@ -192,6 +197,16 @@
</view>
</view>
<ProParams :id="device.id"></ProParams>
<MessagePopup :visible="Status.Pop.showPop" :type="Status.Pop.popType" :bgColor="Status.Pop.bgColor"
:borderColor="Status.Pop.borderColor" :textColor="Status.Pop.textColor"
:buttonBgColor="Status.Pop.buttonBgColor" :buttonTextColor="Status.Pop.buttonTextColor"
:iconUrl="Status.Pop.iconUrl" :message="Status.Pop.message" :buttonText="Status.Pop.buttonText"
@buttonClick="HidePop" :visiblePrompt="Status.Pop.visiblePrompt"
:promptTitle="Status.Pop.promptTitle" v-model="Status.Pop.modelValue"
:buttonCancelText="Status.Pop.buttonCancelText" :showCancel="Status.Pop.showCancel"
@cancelPop="closePop" />
<MsgBox ref="msgPop" />
</view>
</view>
@ -1514,7 +1529,7 @@
option.buttonBgColor = '#BBE600';
}
these.Status.Pop.showPop = true;
showPop(option,this);
},
btnClick() {

View File

@ -1196,7 +1196,7 @@
.navbarRight .img {
width: 35rpx;
height: 35rpx;
margin-right: 20rpx;
margin-right: 30rpx;
}
.uni-navbar--fixed {

View File

@ -1365,7 +1365,7 @@
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
buttonTextColor: '#FFFFFFde',
okCallback: function() {
uni.navigateTo({

File diff suppressed because it is too large Load Diff

1528
pages/210/HBY210Old.vue Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1252,7 +1252,7 @@
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
buttonTextColor: '#FFFFFFde',
okCallback: function() {
uni.navigateTo({

View File

@ -748,7 +748,7 @@ import request, { baseURL } from '@/utils/request.js';
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
buttonTextColor: '#FFFFFFde',
okCallback: function() {
uni.navigateTo({

View File

@ -39,7 +39,7 @@
</view>
</view>
<view class="warnnig" :class="formData.sta_ShakeBit!==0 ?'':'displayNone'">
<view class="warnnig" :class="formData.sta_ShakeBit!=0 ?'':'displayNone'">
<view>{{formData.sta_ShakeBit==3?'设备疑似受到外力碰撞':'设备声光报警中'}}</view>
<view @click.stop="SOSToggle()">
<uni-icons type="closeempty" color="#FFFFFFde" size="16"></uni-icons>
@ -1418,7 +1418,7 @@
console.error("出现错误", ex)
});
}
let msg = val == 1 ? '确定开启声光报警' : '确定关闭声光报警';
let msg = val == 1 ? '确定开启声光报警' : '确定解除声光报警';
showPop({
message: msg,
@ -1912,7 +1912,7 @@
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
buttonTextColor: '#FFFFFFde',
showCancel: true,
okCallback: function() {
console.log("1111");
@ -2858,7 +2858,7 @@
.navbarRight .img {
width: 35rpx;
height: 35rpx;
margin-right: 20rpx;
margin-right: 30rpx;
}
.uni-navbar--fixed {

View File

@ -840,7 +840,7 @@
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
buttonTextColor: '#FFFFFFde',
okCallback: function() {
uni.navigateTo({

View File

@ -708,7 +708,7 @@
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
buttonTextColor: '#FFFFFFde',
okCallback: function() {
// console.log("1111");
uni.navigateTo({

View File

@ -688,7 +688,7 @@
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
buttonTextColor: '#FFFFFFde',
okCallback: function() {
// console.log("1111");
uni.navigateTo({

View File

@ -58,6 +58,12 @@
{{getbleStatu}}
</text>
</view>
<view class="info-row" v-if="itemInfo.deviceMac" @click="bleStatuToggle">
<text class="info-label">充电状态</text>
<text class="info-value status-running" >
{{deviceInfo.chargeState != 0?'充电中':'未充电'}}
</text>
</view>
<view class="info-row">
<text class="info-label" style="display: flex; align-items: center;">定位信息</text>
<view class="info-value status-running" @click="gpsPosition(deviceInfo)">
@ -73,7 +79,7 @@
</view>
</view>
</view>
<view class="callpolice" v-if="deviceInfo.onlineStatus == 1 && deviceInfo.alarmStatus == 1">
<view class="callpolice" v-if="deviceInfo.alarmStatus == 1">
<view class="">设备强制报警中</view>
<view>
<uni-icons type="closeempty" size="15" color="rgba(255, 255, 255, 0.9)"
@ -436,6 +442,52 @@
}
},
methods: {
onReceive(deviceState){//蓝牙/Mq通用消息处理
switch (deviceState[0]) {
// 1设备切换灯光实时返回
case 1:
this.currentMainMode = this.getMainLightModeLabel(
deviceState[
1]);
this.sliderValue = deviceState[2];
this.deviceInfo.batteryRemainingTime = deviceState[3];
break;
// 12为设备实时上报
case 12:
this.currentMainMode = this.getMainLightModeLabel(
deviceState[
1]);
this.isLaserOn = deviceState[2] === 1; //第3位表示当时激光灯档位
this.currentlaserMode = this.isLaserOn ? "开启" : "关闭";
if (this.deviceInfo) {
this.deviceInfo.batteryPercentage = deviceState[3]; //第4位电量百分比
this.deviceInfo.chargeState = deviceState[4]; //第5位为充电状态0没有充电1正在充电2为已充满
this.deviceInfo.batteryRemainingTime = deviceState[5]; //第6位200代表电池剩余续航时间200分钟
}
setTimeout(() => {
if (this.deviceInfo.batteryPercentage < 20 &&
this.deviceInfo.chargeState == 0) {
this.popupType = 'bettery';
this.popupMessage = '请及时充电';
this.showPopupFlag = true;
}
if (this.apiType === 'listA') {
this.fetchDeviceDetail(data.data.id)
} else {
// 分享权限详情
this.fetchSharedDeviceDetail(data.data.id)
}
}, 10000);
// 上报电量,在列表里面同步
uni.$emit('deviceStatusUpdate', {
message: parsedMessage,
timestamp: new Date().getTime()
});
break;
default:
console.log('未知的 deviceState 类型:', deviceState[0]);
}
},
bleStatuToggle() {
let f = this.getDevice();
if (!f) {
@ -504,7 +556,7 @@
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
buttonTextColor: '#FFFFFFde',
showCancel: true,
okCallback: function() {
console.log("1111");
@ -532,11 +584,9 @@
}
let data = rec.ReceiveData(receive, device, pagePath, recArr);
console.log("蓝牙收到消息", data)
this.receivData(data);
},
receivData(data) {
this.onReceive(data.state);
},
bleStateBreak() {
if (this.Status.pageHide) {
return;
@ -1566,6 +1616,7 @@
// this.popupConfirmText="";
},
OpenWarn(val){//开启/解除强制报警
debugger;
const topic = `B/${this.itemInfo.deviceImei}`;
let message={"instruct":[7,val,0,0,0,0]};
message=JSON.stringify(message);
@ -1575,6 +1626,8 @@
});
if(flag){
this.itemInfo.alarmStatus=val;
}else{
MsgError("操作没有成功",'确定',this);
}
this.showPopupFlag = false;
@ -1644,11 +1697,11 @@
// 3.解除告警状态
const registerRes = await deviceSendAlarmMessage(data);
if (registerRes.code !== 200) {
uni.showToast({
title: registerRes.msg,
icon: 'none'
})
// uni.showToast({
// title: registerRes.msg,
// icon: 'none'
// })
this.OpenWarn(0);
return
}
this.itemInfo.alarmStatus=0;
@ -1908,53 +1961,8 @@
const deviceState = parsedMessage.state; // 直接取 state 数组
// 切换主灯光模式,亮度值设备同步
if (!deviceState) return;
// 1设备切换灯光实时返回
switch (deviceState[0]) {
case 1:
this.currentMainMode = this.getMainLightModeLabel(
deviceState[
1]);
this.sliderValue = deviceState[2];
this.deviceInfo.batteryRemainingTime = deviceState[3];
break;
// 12为设备实时上报
case 12:
this.currentMainMode = this.getMainLightModeLabel(
deviceState[
1]);
this.isLaserOn = deviceState[2] === 1; //第3位表示当时激光灯档位
this.currentlaserMode = this.isLaserOn ? "开启" : "关闭";
if (this.deviceInfo) {
this.deviceInfo.batteryPercentage = deviceState[
3]; //第4位电量百分比
this.deviceInfo.chargeState = deviceState[
4]; //第5位为充电状态0没有充电1正在充电2为已充满
this.deviceInfo.batteryRemainingTime = deviceState[
5]; //第6位200代表电池剩余续航时间200分钟
}
setTimeout(() => {
if (this.deviceInfo.batteryPercentage < 20 &&
this.deviceInfo.chargeState == 0) {
this.popupType = 'bettery';
this.popupMessage = '请及时充电';
this.showPopupFlag = true;
}
if (this.apiType === 'listA') {
this.fetchDeviceDetail(data.data.id)
} else {
// 分享权限详情
this.fetchSharedDeviceDetail(data.data.id)
}
}, 10000);
// 上报电量,在列表里面同步
uni.$emit('deviceStatusUpdate', {
message: parsedMessage,
timestamp: new Date().getTime()
});
break;
default:
console.log('未知的 deviceState 类型:', deviceState[0]);
}
this.onReceive(deviceState);
} catch (error) {
console.log('解析MQTT消息失败:', error, '原始消息:', payload);
}

View File

@ -739,7 +739,7 @@ import request, { baseURL } from '@/utils/request.js';
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
buttonTextColor: '#FFFFFFde',
okCallback: function() {
uni.navigateTo({

View File

@ -822,7 +822,7 @@ import request, { baseURL } from '@/utils/request.js';
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
buttonTextColor: '#FFFFFFde',
okCallback: function() {
uni.navigateTo({

View File

@ -180,7 +180,7 @@
<view class="item" @click="lightSetting('close')" :class="formData.lightCurr=='close'?'active':''">
<view class="imgContent center">
<image class="img"
:src="formData.lightCurr=='close'?'/static/images/lightImg/jieNActive.png':'/static/images/lightImg/jieN.png'"
:src="formData.lightCurr=='close'?'/static/images/lightImg/closeLightActive.png':'/static/images/lightImg/closeLight.png'"
mode="aspectFit"></image>
</view>
<view class="txt">关闭</view>
@ -340,7 +340,7 @@
borderColor: '#BBE600',
textColor: '#ffffffde',
buttonBgColor: '#BBE600',
buttonTextColor: '#232323DE',
buttonTextColor: '#FFFFFFDE',
iconUrl: '',
message: '您确定要这样做吗?',
@ -725,7 +725,7 @@
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
buttonTextColor: '#FFFFFFde',
showCancel: true,
cancelCallback: () => {
// this.closePop();
@ -1178,6 +1178,7 @@
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonTextColor: "#FFFFFFde",
okCallback: null,
buttonText: "确定"
},these)
@ -1221,6 +1222,7 @@
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonTextColor: "#FFFFFFde"
},these);
}).finally(() => {
@ -1285,7 +1287,8 @@
message: "通信异常,请检查手机或设备网络",
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonBgColor: "#E03434",
buttonTextColor: "#FFFFFFde"
},these);
}).finally(() => {
@ -1367,7 +1370,8 @@
message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonBgColor: "#E03434",
buttonTextColor: "#FFFFFFde",
okCallback: null,
buttonText: "确定"
},these)
@ -1439,7 +1443,8 @@
message: "通信异常,请检查手机或设备网络",
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonBgColor: "#E03434",
buttonTextColor: "#FFFFFFde"
},these);
}).finally(() => {
@ -1562,6 +1567,7 @@
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonTextColor:"#FFFFFFde",
okCallback: OpenSOS,
buttonText: "开启"
},these);
@ -1591,6 +1597,7 @@
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonTextColor: "#FFFFFFde",
okCallback: null,
buttonText: "确定"
},these)
@ -1632,7 +1639,8 @@
message: "通信异常,请检查手机或设备网络",
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonBgColor: "#E03434",
buttonTextColor: "#FFFFFFde"
},these);
}).finally(() => {
@ -2192,7 +2200,8 @@
message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonBgColor: "#E03434",
buttonTextColor: "#FFFFFFde",
okCallback: null,
buttonText: "确定"
},these)
@ -2313,7 +2322,8 @@
message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonBgColor: "#E03434",
buttonTextColor: "#FFFFFFde",
okCallback: null,
buttonText: "确定"
},these)
@ -2531,7 +2541,8 @@
message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonBgColor: "#E03434",
buttonTextColor: "#FFFFFFde",
okCallback: null,
buttonText: "确定"
},these)
@ -2921,18 +2932,16 @@
}
.usrinfo .btnSend {
line-height: 65rpx;
border-radius: 8px;
width: 120rpx;
height: 65rpx;
color: rgba(35, 35, 35, 0.87);
font-family: PingFang SC;
font-size: 24rpx;
font-weight: 400;
letter-spacing: 0.15rpx;
text-align: center;
background-color: #BBE600;
.usrinfo .btnSend {
background-color: rgb(187, 230, 0);
color: rgba(35, 35, 35, 0.87);
height: 50rpx;
line-height: 50rpx;
border-radius: 16rpx;
font-size: 26rpx;
width: 112rpx;
white-space: nowrap;
text-align: center;
}
.usrinfo .item {
@ -3330,7 +3339,7 @@
.navbarRight .img{
width: 35rpx;
height: 35rpx;
margin-right: 20rpx;
margin-right: 30rpx;
}
.uni-navbar--fixed{
top:0rpx;

View File

@ -628,7 +628,7 @@
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
buttonTextColor: '#FFFFFFde',
okCallback: function() {
console.log("1111");
uni.navigateTo({

View File

@ -482,20 +482,20 @@
ble.addStateBreakCallback(() => {
uni.showModal({
title: '提示',
content: '蓝牙不可用'
});
MsgError('蓝牙不可用','',these);
these.EquipMents.filter((v, i) => {
these.$set(these.EquipMents[i], 'link', false);
});
}, pagePath);
ble.addStateRecoveryCallback(() => {
uni.showModal({
title: '提示',
content: '蓝牙恢复可用'
});
MsgSuccess('蓝牙恢复可用','',these,()=>{
MsgClear(these);
})
},
pagePath);
@ -568,7 +568,7 @@
plus.runtime.openURL('weixin://', (err) => {
MsgError("打开微信失败,请手动打开微信粘贴");
MsgError("打开微信失败,请手动打开微信,发送至'文件传输助手'");
});
},
fail(ex){
@ -805,10 +805,8 @@
let json = getUrlParams(res.result);
if (!json.key) {
uni.showModal({
title: '错误',
content: "无效的二维码"
})
MsgError('无效的二维码','',these);
return;
}
this.scanKey = json.key;
@ -1050,9 +1048,8 @@
these.sendEquipToMq();
}).catch(ex => {
console.log("ex=", ex)
uni.showModal({
content: "连接失败:" + ex.msg
});
MsgError("连接失败:" + ex.msg,'',these);
hideLoading(these);
});
}

View File

@ -27,7 +27,7 @@
<mescroll-uni class="device-list" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption"
:down="downOption" :fixed="false" :style="{ height: mescrollHeight + 'px' }">
<view v-if="deviceList.length>0">
<uni-swipe-action ref="swipeAction">
<uni-swipe-action ref="swipeAction" >
<block v-for="(item, index) in deviceList" :key="index" :ref="'swipeItem_' + index">
<uni-swipe-action-item :right-options="Options"
@click="handleSwipeClick($event, item, index)" class="device-card"
@ -88,6 +88,7 @@
</view>
<!-- 按钮组 -->
<view class="popup-buttons">
<button class="btn cancelBtn" @click="closePopup('delete')">取消</button>
<button class="btn agreeBtn" @click="handleBtn">确定</button>
</view>
</view>
@ -98,14 +99,15 @@
<view class="popup-content">
<view>
<view class="popup-flex">
<text>设备名称</text>
<input type="text" v-model="deviceName" placeholder="请输入设备名称" class="popup-input"
<text>名称</text>
<input type="text" v-model="deviceName" placeholder="请输入名称" class="popup-input"
@click.stop />
</view>
</view>
</view>
<!-- 按钮组 -->
<view class="popup-buttons" style="margin-top:50rpx;">
<button class="btn cancelBtn" @click="closePopup('rename')">取消</button>
<button class="btn agreeBtn4" @click="handleBtnName">确定</button>
</view>
</view>
@ -134,6 +136,9 @@
</view>
<!-- 蒙板用于点击任意位置关闭悬浮的菜单 -->
<view class="mask" v-show="showTooltip||showshare" @click.stop="closePopMenu"></view>
<MsgBox ref="msgPop" />
</view>
</template>
@ -772,7 +777,8 @@
this.downCallback();
});
ble = bleTool.getBleTool();
recei = BleReceive.getBleReceive();
console.log("this=",this);
recei = BleReceive.getBleReceive(this);
//蓝牙连接成功的回调
ble.addRecoveryCallback((res) => {
// console.log("蓝牙连接成功的回调");
@ -799,8 +805,9 @@
//接收到消息的回调
ble.addReceiveCallback((receive, device, path, recArr) => {
// console.error("首页收到消息了");
recei.ReceiveData(receive, device, path, recArr);
console.error("首页收到消息了");
let json=recei.ReceiveData(receive, device, path, recArr);
console.error("消息内容",json);
this.updateBleStatu();
}, pagePath);
@ -873,12 +880,25 @@
text-align: center;
/* 文字居中 */
/* 设置最小宽度 */
position: relative;
}
.active {
color: rgba(187, 230, 0, 1);
border-bottom: 6rpx solid rgba(187, 230, 0, 1);
.tab-item.active {
color: #bbe600;
height: 60rpx;
font-weight: bold;
}
.tab-item.active::before{
content: "";
background-color: #bbe600;
position: absolute;
top: 90%;
left:35%;
width: 30%;
height: 6rpx;
border-radius: 6rpx;
}
.sendFlex {
@ -1128,14 +1148,32 @@
border-radius: 40rpx;
padding: 30rpx;
text-align: center;
border: 1px solid rgba(255, 200, 78, 0.3);
border: 1px solid #E034344d;
}
.cancelBtn{
text-align: center;
width: 170rpx !important;
background-color: #00000000;
}
.agreement-popupC .cancelBtn{
border:1rpx solid #E034344d;
color:#E03434;
}
.agreement-popupD .cancelBtn{
border: 1rpx solid rgba(255, 255, 255, 0.6);
color:rgba(255, 255, 255, 0.6);
}
.agreement-popupD {
width: 70%;
width: 75%;
background-color: rgb(42, 42, 42);
border-radius: 40rpx;
padding: 40rpx;
padding: 40rpx 5rpx;
text-align: center;
border: 1px solid rgba(187, 230, 0, 0.3);
}
@ -1157,6 +1195,7 @@
font-size: 28rpx;
text-align: left;
text-indent: 5rpx;
width: calc(100% - 75rpx);
}
.svg {
@ -1177,8 +1216,8 @@
/* 同意按钮 */
.agreeBtn {
background: #FFC84E;
color: #232323;
background: #E03434;
color: #FFFFFF;
border: none;
width: 170rpx !important;
}