Compare commits
4 Commits
dd28640401
...
2db6ac47b7
| Author | SHA1 | Date | |
|---|---|---|---|
| 2db6ac47b7 | |||
| 8c6bd79410 | |||
| 569c7cf0b4 | |||
| 253733ad2b |
@ -163,7 +163,7 @@
|
||||
<text class="sliderVal">{{ formData.strobeFrequency }}HZ</text>
|
||||
</view>
|
||||
<view class="slider-container">
|
||||
<slider min="0.5" max="10" step="0.5" :disabled="false" :value="formData.strobeFrequency"
|
||||
<slider min="1" max="10" step="1" :disabled="false" :value="formData.strobeFrequency"
|
||||
activeColor="#bbe600" backgroundColor="#686767" block-size="20" block-color="#ffffffde"
|
||||
@change="onFreqChanging" @changing="onFreqChanging" class="custom-slider" />
|
||||
</view>
|
||||
@ -238,6 +238,7 @@
|
||||
data() {
|
||||
return {
|
||||
mqttClient: null,
|
||||
activePermissions: [], // 存储当前设备的权限数组
|
||||
Status: {
|
||||
isRightIconVisible: false,
|
||||
navTitle: '',
|
||||
@ -246,6 +247,7 @@
|
||||
curr: 0,
|
||||
total: 0,
|
||||
pageHide: false,
|
||||
|
||||
Pop: {
|
||||
showPop: false, //是否显示弹窗
|
||||
popType: 'custom',
|
||||
@ -454,16 +456,6 @@
|
||||
these.Status.apiType = data.apiType;
|
||||
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.connect(() => {
|
||||
@ -503,7 +495,7 @@
|
||||
.battery_remaining_time //续航时间
|
||||
// 设备按键, app同步
|
||||
} else if (funcType == '14') {
|
||||
// 调节相关字段
|
||||
// 调节亮度,音量,频率相关字段
|
||||
these.formData.strobeFrequency = led_strobe.frequency ||
|
||||
0.5; //频率
|
||||
these.formData.volume = volume || 10; //音量
|
||||
@ -587,7 +579,15 @@
|
||||
})
|
||||
})
|
||||
console.log(data, 'datatatatat');
|
||||
// 分享接口
|
||||
if (these.Status.apiType === 'listA') {
|
||||
these.fetchDeviceDetail(data.data.id)
|
||||
} else {
|
||||
this.activePermissions = data.data.permission ? data.data.permission.split(',') : [];
|
||||
console.log(this.activePermissions,'this.activePermissions');
|
||||
these.fetchDeviceDetail(data.data.deviceId)
|
||||
}
|
||||
|
||||
});
|
||||
this.createThrottledFunctions();
|
||||
|
||||
@ -639,6 +639,14 @@
|
||||
}
|
||||
})
|
||||
},
|
||||
// 检查权限的方法
|
||||
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) {
|
||||
item.callback(item, s);
|
||||
@ -847,28 +855,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],
|
||||
@ -889,8 +877,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) {
|
||||
|
||||
@ -216,7 +216,7 @@
|
||||
const res = await deviceShareAdd({
|
||||
phonenumber: this.phone,
|
||||
smsCode: this.code,
|
||||
deviceId: this.itemInfo.id,
|
||||
deviceId: this.itemInfo.id || this.itemInfo.deviceId,
|
||||
permission: selectedPermissions.join(',')
|
||||
})
|
||||
|
||||
@ -250,8 +250,8 @@
|
||||
const eventChannel = this.getOpenerEventChannel();
|
||||
// 监听 'shareDevice' 事件,获取传过来的数据
|
||||
eventChannel.on('shareDevice', (data) => {
|
||||
console.log(data, 'data1t111');
|
||||
this.itemInfo = data.data;
|
||||
console.log(this.itemInfo,'this.itemInfo');
|
||||
this.permissions=Common.getPermissions(this.itemInfo.persissonType);
|
||||
console.log(this.itemInfo.persissonType,'this.itemInfo.persissonType');
|
||||
})
|
||||
|
||||
@ -86,7 +86,9 @@
|
||||
},
|
||||
getData(val) {
|
||||
let data = {
|
||||
deviceId: val
|
||||
deviceId: val,
|
||||
pageNum: 1,
|
||||
pageSize: 500
|
||||
}
|
||||
deviceShareList(data).then((res) => {
|
||||
if (res.code == 200) {
|
||||
@ -117,7 +119,7 @@
|
||||
eventChannel.on('shareManagement', (data) => {
|
||||
console.log(data, 'data1t111');
|
||||
this.itemInfo = data.data;
|
||||
this.getData(this.itemInfo.id)
|
||||
this.getData(this.itemInfo.id ||this.itemInfo.deviceId)
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -179,12 +181,13 @@
|
||||
border-radius: 32px;
|
||||
background: rgba(255, 200, 78, 0.06);
|
||||
display: inline-block;
|
||||
width: 152rpx;
|
||||
height: 60rpx;
|
||||
width: 100rpx;
|
||||
height: 50rpx;
|
||||
text-align: center;
|
||||
line-height: 60rpx;
|
||||
line-height: 50rpx;
|
||||
color: rgba(224, 52, 52, 1);
|
||||
cursor: pointer;
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
|
||||
.IMG {
|
||||
|
||||
Reference in New Issue
Block a user