From 8c6bd7941005c95df815d438a9cd2540fec38a63 Mon Sep 17 00:00:00 2001 From: fengerli <528575642@qq.com> Date: Wed, 4 Mar 2026 09:58:06 +0800 Subject: [PATCH] =?UTF-8?q?100Jbug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/100J/HBY100-J.vue | 73 +++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 40 deletions(-) diff --git a/pages/100J/HBY100-J.vue b/pages/100J/HBY100-J.vue index 3daa3e8..c2afd3b 100644 --- a/pages/100J/HBY100-J.vue +++ b/pages/100J/HBY100-J.vue @@ -231,9 +231,6 @@ deviceUpdateVolume, deviceVoiceBroadcast } from '@/api/100J/HBY100-J.js' - import { - deviceShareId - } from '@/api/6170/deviceControl.js' var these = null; import Common from '@/utils/Common.js' const pagePath = "/pages/100/HBY100"; @@ -241,6 +238,7 @@ data() { return { mqttClient: null, + activePermissions: [], // 存储当前设备的权限数组 Status: { isRightIconVisible: false, navTitle: '', @@ -249,6 +247,7 @@ curr: 0, total: 0, pageHide: false, + Pop: { showPop: false, //是否显示弹窗 popType: 'custom', @@ -456,7 +455,7 @@ these.Status.navTitle = data.data.deviceName; these.Status.apiType = data.apiType; these.Status.isRightIconVisible = these.Status.apiType === 'listA'; - + this.mqttClient = new MqttClient(); this.mqttClient.connect(() => { @@ -580,13 +579,13 @@ }) }) console.log(data, 'datatatatat'); + // 分享接口 if (these.Status.apiType === 'listA') { these.fetchDeviceDetail(data.data.id) } else { - console.log('走到这里了没'); - // 分享权限详情 - these.fetchSharedDeviceDetail(data.data.id) + these.fetchDeviceDetail(data.data.deviceId) } + }); this.createThrottledFunctions(); @@ -638,17 +637,13 @@ } }) }, - // 获取分享设备详情 - async fetchSharedDeviceDetail(id) { - try { - const res = await deviceShareId(id) - if (res.code == 200) { - console.log(this.deviceInfo,'this.deviceInfo'); - this.deviceInfo=res.data - } - } catch (error) { - - } + // 检查权限的方法 + hasPermission(permissionCode) { + // 如果还在加载中,直接返回false + if (this.pageLoading) return false + // 如果不是分享设备,默认有全部权限 + if (!this.isSharedDevice) return true + return this.activePermissions.includes(permissionCode) }, handleRightClick(item, s) { if (item && item.callback) { @@ -858,28 +853,8 @@ this.formData.sta_VoiceType = val; // 模式类型为7时才去判断 console.log(val, 'valllll'); - const voiceStrobeAlarm = this.deviceInfo?.voiceStrobeAlarm ?? 0; // 兜底0,避免undefined const isVoiceOperate = val === '7' || val === '-1'; // 标记是否是语音开启/关闭操作 - if (voiceStrobeAlarm === 0 && isVoiceOperate) { - let data = { - deviceId: this.deviceInfo.deviceId, - voiceBroadcast: Number(this.formData.sta_VoiceType) === -1 ? 0 : 1 - } - deviceVoiceBroadcast(data).then((res) => { - if (res.code == 200) { - uni.showToast({ - title: res.msg, - icon: 'none' - }); - } else { - uni.showToast({ - title: res.msg, - icon: 'none' - }); - } - }) - } else if (this.deviceInfo.voiceStrobeAlarm == 1) { - console.log('走到这里了没'); + if (this.deviceInfo.voiceStrobeAlarm == 1) { // 如果强制报警已经开启了,那么切换下面的模式需要时,需要触发报警指令 const data = { deviceIds: [this.deviceInfo.deviceId], @@ -900,8 +875,26 @@ }); } }) + } else if (isVoiceOperate) { + console.log('我是谁'); + let data = { + deviceId: this.deviceInfo.deviceId, + voiceBroadcast: Number(this.formData.sta_VoiceType) === -1 ? 0 : 1 + } + deviceVoiceBroadcast(data).then((res) => { + if (res.code == 200) { + uni.showToast({ + title: res.msg, + icon: 'none' + }); + } else { + uni.showToast({ + title: res.msg, + icon: 'none' + }); + } + }) } - }, // 报警模式 sosSetting(item) {