matt订阅设备消息

This commit is contained in:
fengerli
2025-08-04 17:48:03 +08:00
parent afc79db6bb
commit 40a5897b1b
4 changed files with 115 additions and 68 deletions

View File

@ -252,8 +252,24 @@
</view>
</view>
<!-- 人员信息成功提示弹框 -->
<CustomPopup :show="showPopupFlag" :message="popupMessage" icon="/static/images/sendSucc.png"
:confirm-text="popupConfirmText" :show-cancel="false" @confirm="onPopupConfirm" />
<CustomPopup v-if="popupType === 'person'" :show="showPopupFlag" :message="popupMessage"
icon="/static/images/common/sendSucc.png" :confirm-text="popupConfirmText" :show-cancel="false"
@confirm="onPopupConfirm" />
<!-- 开机log上传成功的弹框提示 -->
<CustomPopup v-if="popupType === 'logo'" :show="showPopupFlag" :message="popupMessage"
icon="/static/images/common/upload.png" :confirm-text="popupConfirmText" :show-cancel="false"
@confirm="onPopupConfirm" />
<!--============= 电量低于提示弹框=========== -->
<CustomPopup v-if="popupType === 'bettery'" :show="showPopupFlag"
popupBorder="1rpx solid rgba(224, 52, 52, 0.3)" :message="popupMessage" title="设备电量低于20%"
titleColor="rgba(224, 52, 52, 1)" icon="/static/images/common/path.png" :confirm-text="popupConfirmText"
:show-cancel="true" @cancel="onPopupConfirm" @confirm="onPopupConfirm"
confirmBtnBg="rgba(224, 52, 52, 1)" confirmBtnColor="#fff" />
<!-- 解除报警 -->
<CustomPopup v-if="popupType === 'cancel'" :show="showPopupFlag"
popupBorder="1rpx solid rgba(224, 52, 52, 0.3)" :message="popupMessage"
icon="/static/images/6170/svg.png" :confirm-text="popupConfirmText" :show-cancel="false"
@confirm="onPopupConfirm" confirmBtnBg="rgba(224, 52, 52, 1)" confirmBtnColor="#fff" />
</view>
</view>
</template>
@ -301,7 +317,6 @@
code: '',
},
deviceInfo: {},
activePermissions: [], // 存储当前设备的权限数组
isSharedDevice: false, // 标记是否来自分享
isRightIconVisible: false,
@ -314,7 +329,8 @@
selectedItemIndex: 0,
radioList: ['M', 'S'],
radioSelected: 0, // -1表示未选中任何项
deviceType:''
deviceType: '',
popupType:'popupType' //弹框类型
}
},
methods: {
@ -324,10 +340,10 @@
this.lightModeB = false;
this.lightModeC = false;
},
handleRadioSelect(index) {
this.radioSelected = index;
console.log('选中了单选选项:', this.radioList[index]);
},
handleRadioSelect(index) {
this.radioSelected = index;
console.log('选中了单选选项:', this.radioList[index]);
},
// *******定位******
gpsPosition() {
uni.navigateTo({
@ -337,7 +353,7 @@
// 联机设备
selectMode() {
uni.navigateTo({
url:'/pages/210/onlineDevice/index',
url: '/pages/210/onlineDevice/index',
events: {
ack: function(data) {}
},
@ -492,10 +508,9 @@
try {
const responseData = JSON.parse(res.data);
if (responseData.code === 200) {
uni.showToast({
title: responseData.msg,
icon: 'success'
});
this.popupType = 'logo'; //弹框类型
this.showPopupFlag = true;
this.popupMessage = '上传成功';
this.selectedImage = '';
this.file = null;
this.lightModeB = false
@ -595,7 +610,8 @@
registerPersonInfo(data).then((res) => {
if (res.code == 200) {
uni.hideLoading()
this.showPopupFlag = true
this.popupType = 'person'; //弹框类型
this.showPopupFlag = true;
this.popupMessage = '人员信息发送成功'
} else {
uni.showToast({
@ -629,7 +645,8 @@
deviceSendMessage(data).then((res) => {
if (res.code == 200) {
uni.hideLoading()
this.showPopupFlag = true
this.popupType = 'person'; //弹框类型
this.showPopupFlag = true;
this.popupMessage = '发送信息成功'
} else {
uni.showToast({
@ -676,13 +693,13 @@
title: '加载中...'
})
eventChannel.on('deviceControl', (data) => {
console.log(data,'这是传过来的惨呼啊');
console.log(data, '这是传过来的惨呼啊');
this.itemInfo = data.data;
this.deviceID = data.data.id;
this.navTitle = data.data.deviceName;
this.apiType = data.apiType
this.deviceType=data.deviceType
this.deviceType = data.deviceType
// 根据 apiType 设置右图标的显示状态
this.isRightIconVisible = this.apiType === 'listA';
// 初始化并连接MQTT
@ -850,7 +867,7 @@
gap: 12px;
align-items: center;
margin-bottom: 20rpx;
font-size:200rpx;
font-size: 200rpx;
}
.group-item {
@ -859,25 +876,28 @@
height: 136rpx;
border-radius: 72rpx;
text-align: center;
line-height:136rpx;
line-height: 136rpx;
position: relative;
}
.radio-icon.selected {
background-color: rgba(174, 214, 0, 1);
transition: background-color 0.3s;
border-radius: 72rpx;
}
.radio-icon{
font-size:50rpx;
.radio-icon {
font-size: 50rpx;
}
.uni-border{
border:4rpx solid rgba(26, 26, 26, 1);
width:96%;
height:123rpx;
.uni-border {
border: 4rpx solid rgba(26, 26, 26, 1);
width: 96%;
height: 123rpx;
position: absolute;
top:7rpx;
left:6rpx;
border-radius:72rpx;
top: 7rpx;
left: 6rpx;
border-radius: 72rpx;
}
.info-card {