1
0
forked from dyf/APP

新增210管控页面,6170设备控制,订阅设备消息

This commit is contained in:
fengerli
2025-07-31 19:02:09 +08:00
parent c7d7149d2f
commit 766c72941e
6 changed files with 1285 additions and 24 deletions

File diff suppressed because it is too large Load Diff

View File

@ -18,14 +18,14 @@
<view class="battery-v1">
<image src="/static/images/dl.png" class="dlIMG"></image>
<view>
<view class="battery-v2">90%</view>
<view class="battery-v2">{{deviceInfo.batteryPercentage}}%</view>
<view class="battery-v3">电量</view>
</view>
</view>
<view class="battery-v1">
<image src="/static/images/nz.png" class="dlIMG" mode="aspectFit"></image>
<view>
<view class="battery-v2">1小时</view>
<view class="battery-v2">{{deviceInfo.batteryRemainingTime || '0分钟'}}</view>
<view class="battery-v3">续航时间</view>
</view>
</view>
@ -42,7 +42,7 @@
</view>
<view class="info-row">
<text class="info-label">设备状态</text>
<text class="info-value status-running">运行中</text>
<text class="info-value status-running">{{deviceInfo.onlineStatus===0?'离线':'在线'}}</text>
</view>
<view class="info-row">
<text class="info-label">定位信息</text>
@ -316,7 +316,7 @@
console.log('这是我滑动的吗');
this.sliderValue = e.detail.value;
let data = {
deviceld: this.deviceID,
deviceId: this.deviceID,
instructValue: this.sliderValue + '.00'
}
lightBrightnessSettings(data).then((res) => {
@ -392,7 +392,7 @@
// 修正这里的赋值错误,应该保存索引而不是文本
this.selectedItemIndex = this.selectedItemIndex;
let data = {
deviceld: this.deviceID,
deviceId: this.deviceID,
instructValue: selectedItem.instructValue
}
lightModeSettings(data).then((res) => {
@ -417,7 +417,7 @@
// 激光确认框提交
handleBtn() {
let data = {
deviceld: this.deviceID,
deviceId: this.deviceID,
instructValue: 1
}
laserModeSettings(data).then((res) => {
@ -465,7 +465,7 @@
}
this.selectedImage = res.tempFilePaths[0];
console.log('选择的图片:', res);
this.file = res.tempFiles[0].file
//this.file = res.tempFiles[0].file
},
fail: (err) => {
console.error('选择图片失败:', err);
@ -485,10 +485,16 @@
});
return;
}
// 显示上传中加载提示
uni.showLoading({
title: '上传中...',
mask: true
});
uni.uploadFile({
url: baseURL + '/app/device/uploadLogo',
filePath: this.selectedImage,
name: this.file,
name: 'file',
formData: {
deviceId: this.deviceID,
},
@ -524,7 +530,6 @@
}
}
})
},
// 分享
shareUp() {

View File

@ -41,8 +41,13 @@
<view class="ID" v-if="item.communicationMode==0">ID:{{item.deviceImei}}
</view>
<view class="ID" v-else>ID:{{item.deviceMac}}</view>
<view class="onlines" v-if="item.communicationMode==0">在线</view>
<view>电量90%</view>
<!-- 在线状态 -->
<view class="onlines"
v-if="item.communicationMode==0 && item.onlineStatus==1">在线</view>
<!-- 离线状态 -->
<view class="offlines"
v-if="item.communicationMode==0 && item.onlineStatus==0">离线</view>
<view>电量{{item.battery || '0'}}%</view>
</view>
</view>
</view>
@ -423,7 +428,7 @@
handleFile(item) {
//console.log('item' + JSON.stringify(item));
// communicationMode 0是4G 1是蓝牙
if (item.communicationMode == 0) {
if (item.typeName == 'BJQ6170') {
uni.navigateTo({
url: "/pages/6170/deviceControl/index",
events: {
@ -437,6 +442,19 @@
});
}
})
} else if (item.typeName == 'HBY210') {
uni.navigateTo({
url: "/pages/210/deviceControl/index",
events: {
ack: function(data) {}
},
success: (res) => {
// 页面跳转成功后的回调函数
res.eventChannel.emit('deviceControl', {
data: item,
});
}
})
}
if (item.typeName == '6155') {
uni.navigateTo({
@ -460,7 +478,7 @@
updateDeviceStatus(data) {
// 只更新 communicationMode == 0 的设备
this.deviceList = this.deviceList.map(item => {
console.log(item,'item2222');
console.log(item, 'item2222');
if (item.communicationMode === 0) {
// 这里根据消息内容更新设备状态
// 示例:如果消息包含特定字段,则更新设备状态
@ -703,6 +721,19 @@
top: 20rpx;
left: -20rpx
}
.offlines{
position: relative;
}
.offlines::before {
content: '';
position: absolute;
width: 15rpx;
height: 15rpx;
background: rgba(255, 255, 255, 0.4);
border-radius: 50%;
top: 20rpx;
left: -20rpx
}
.line {
width: 2rpx;

View File

@ -61,7 +61,7 @@
data() {
return {
showView: false,
phone: '13800138001', //手机号码
phone: '13800138002', //手机号码
code: "", //验证码
agreed: false,
isCounting: false,

View File

@ -16,19 +16,16 @@
<view class="device-name">
<view>设备:{{item.deviceName}}</view>
<view class="ID">
<view class="ID" v-if="item.communicationMode==0">ID:{{item.deviceImei}}
</view>
<view class="ID" v-else>ID:{{item.deviceMac}}</view>
<!-- <view class="onlines" v-if="item.communicationMode==0">在线</view> -->
<view class="unlines" v-if="item.communicationMode==0">离线</view>
<view>电量90%</view>
<view class="ID">ID:{{item.deviceImei}}</view>
<view class="onlines"
v-if="item.onlineStatus==1">在线</view>
<!-- 离线状态 -->
<view class="unlines"
v-if="item.onlineStatus==0">离线</view>
<view>电量{{item.battery || '0'}}%</view>
</view>
</view>
</view>
<view class="" v-if="item.communicationMode==1">
<view class="device-status online">已连接</view>
<view class="device-status unline">未连接</view>
</view>
</view>
</view>
<view class="editInfmation">