Compare commits
3 Commits
new-202508
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 8c6bd79410 | |||
| 569c7cf0b4 | |||
| 253733ad2b |
@ -238,6 +238,7 @@
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
mqttClient: null,
|
mqttClient: null,
|
||||||
|
activePermissions: [], // 存储当前设备的权限数组
|
||||||
Status: {
|
Status: {
|
||||||
isRightIconVisible: false,
|
isRightIconVisible: false,
|
||||||
navTitle: '',
|
navTitle: '',
|
||||||
@ -246,6 +247,7 @@
|
|||||||
curr: 0,
|
curr: 0,
|
||||||
total: 0,
|
total: 0,
|
||||||
pageHide: false,
|
pageHide: false,
|
||||||
|
|
||||||
Pop: {
|
Pop: {
|
||||||
showPop: false, //是否显示弹窗
|
showPop: false, //是否显示弹窗
|
||||||
popType: 'custom',
|
popType: 'custom',
|
||||||
@ -454,16 +456,6 @@
|
|||||||
these.Status.apiType = data.apiType;
|
these.Status.apiType = data.apiType;
|
||||||
these.Status.isRightIconVisible = these.Status.apiType === 'listA';
|
these.Status.isRightIconVisible = these.Status.apiType === 'listA';
|
||||||
|
|
||||||
if (data.apiType !== 'listA') {
|
|
||||||
Common.getdeviceShareId(data.data.id).then(res => {
|
|
||||||
if (res.code == 200) {
|
|
||||||
if (res.data.permission) {
|
|
||||||
these.permissions = res.data.permission.split(',');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
this.mqttClient = new MqttClient();
|
this.mqttClient = new MqttClient();
|
||||||
|
|
||||||
this.mqttClient.connect(() => {
|
this.mqttClient.connect(() => {
|
||||||
@ -503,7 +495,7 @@
|
|||||||
.battery_remaining_time //续航时间
|
.battery_remaining_time //续航时间
|
||||||
// 设备按键, app同步
|
// 设备按键, app同步
|
||||||
} else if (funcType == '14') {
|
} else if (funcType == '14') {
|
||||||
// 调节相关字段
|
// 调节亮度,音量,频率相关字段
|
||||||
these.formData.strobeFrequency = led_strobe.frequency ||
|
these.formData.strobeFrequency = led_strobe.frequency ||
|
||||||
0.5; //频率
|
0.5; //频率
|
||||||
these.formData.volume = volume || 10; //音量
|
these.formData.volume = volume || 10; //音量
|
||||||
@ -587,7 +579,13 @@
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
console.log(data, 'datatatatat');
|
console.log(data, 'datatatatat');
|
||||||
|
// 分享接口
|
||||||
|
if (these.Status.apiType === 'listA') {
|
||||||
these.fetchDeviceDetail(data.data.id)
|
these.fetchDeviceDetail(data.data.id)
|
||||||
|
} else {
|
||||||
|
these.fetchDeviceDetail(data.data.deviceId)
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
this.createThrottledFunctions();
|
this.createThrottledFunctions();
|
||||||
|
|
||||||
@ -639,6 +637,14 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// 检查权限的方法
|
||||||
|
hasPermission(permissionCode) {
|
||||||
|
// 如果还在加载中,直接返回false
|
||||||
|
if (this.pageLoading) return false
|
||||||
|
// 如果不是分享设备,默认有全部权限
|
||||||
|
if (!this.isSharedDevice) return true
|
||||||
|
return this.activePermissions.includes(permissionCode)
|
||||||
|
},
|
||||||
handleRightClick(item, s) {
|
handleRightClick(item, s) {
|
||||||
if (item && item.callback) {
|
if (item && item.callback) {
|
||||||
item.callback(item, s);
|
item.callback(item, s);
|
||||||
@ -847,28 +853,8 @@
|
|||||||
this.formData.sta_VoiceType = val;
|
this.formData.sta_VoiceType = val;
|
||||||
// 模式类型为7时才去判断
|
// 模式类型为7时才去判断
|
||||||
console.log(val, 'valllll');
|
console.log(val, 'valllll');
|
||||||
const voiceStrobeAlarm = this.deviceInfo?.voiceStrobeAlarm ?? 0; // 兜底0,避免undefined
|
|
||||||
const isVoiceOperate = val === '7' || val === '-1'; // 标记是否是语音开启/关闭操作
|
const isVoiceOperate = val === '7' || val === '-1'; // 标记是否是语音开启/关闭操作
|
||||||
if (voiceStrobeAlarm === 0 && isVoiceOperate) {
|
if (this.deviceInfo.voiceStrobeAlarm == 1) {
|
||||||
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('走到这里了没');
|
|
||||||
// 如果强制报警已经开启了,那么切换下面的模式需要时,需要触发报警指令
|
// 如果强制报警已经开启了,那么切换下面的模式需要时,需要触发报警指令
|
||||||
const data = {
|
const data = {
|
||||||
deviceIds: [this.deviceInfo.deviceId],
|
deviceIds: [this.deviceInfo.deviceId],
|
||||||
@ -889,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) {
|
sosSetting(item) {
|
||||||
|
|||||||
@ -216,7 +216,7 @@
|
|||||||
const res = await deviceShareAdd({
|
const res = await deviceShareAdd({
|
||||||
phonenumber: this.phone,
|
phonenumber: this.phone,
|
||||||
smsCode: this.code,
|
smsCode: this.code,
|
||||||
deviceId: this.itemInfo.id,
|
deviceId: this.itemInfo.id || this.itemInfo.deviceId,
|
||||||
permission: selectedPermissions.join(',')
|
permission: selectedPermissions.join(',')
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -250,8 +250,8 @@
|
|||||||
const eventChannel = this.getOpenerEventChannel();
|
const eventChannel = this.getOpenerEventChannel();
|
||||||
// 监听 'shareDevice' 事件,获取传过来的数据
|
// 监听 'shareDevice' 事件,获取传过来的数据
|
||||||
eventChannel.on('shareDevice', (data) => {
|
eventChannel.on('shareDevice', (data) => {
|
||||||
console.log(data, 'data1t111');
|
|
||||||
this.itemInfo = data.data;
|
this.itemInfo = data.data;
|
||||||
|
console.log(this.itemInfo,'this.itemInfo');
|
||||||
this.permissions=Common.getPermissions(this.itemInfo.persissonType);
|
this.permissions=Common.getPermissions(this.itemInfo.persissonType);
|
||||||
console.log(this.itemInfo.persissonType,'this.itemInfo.persissonType');
|
console.log(this.itemInfo.persissonType,'this.itemInfo.persissonType');
|
||||||
})
|
})
|
||||||
|
|||||||
@ -86,7 +86,9 @@
|
|||||||
},
|
},
|
||||||
getData(val) {
|
getData(val) {
|
||||||
let data = {
|
let data = {
|
||||||
deviceId: val
|
deviceId: val,
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 500
|
||||||
}
|
}
|
||||||
deviceShareList(data).then((res) => {
|
deviceShareList(data).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
@ -117,7 +119,7 @@
|
|||||||
eventChannel.on('shareManagement', (data) => {
|
eventChannel.on('shareManagement', (data) => {
|
||||||
console.log(data, 'data1t111');
|
console.log(data, 'data1t111');
|
||||||
this.itemInfo = data.data;
|
this.itemInfo = data.data;
|
||||||
this.getData(this.itemInfo.id)
|
this.getData(this.itemInfo.id ||this.itemInfo.deviceId)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user