1
0
forked from dyf/APP

Compare commits

...

4 Commits

Author SHA1 Message Date
2db6ac47b7 频率数值调整 2026-03-04 14:25:01 +08:00
8c6bd79410 100Jbug修改 2026-03-04 09:58:06 +08:00
569c7cf0b4 100J分享接口bug修复 2026-03-03 17:19:14 +08:00
253733ad2b 100J4Gbug已修复完成 2026-03-02 18:51:38 +08:00
3 changed files with 51 additions and 42 deletions

View File

@ -163,7 +163,7 @@
<text class="sliderVal">{{ formData.strobeFrequency }}HZ</text> <text class="sliderVal">{{ formData.strobeFrequency }}HZ</text>
</view> </view>
<view class="slider-container"> <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" activeColor="#bbe600" backgroundColor="#686767" block-size="20" block-color="#ffffffde"
@change="onFreqChanging" @changing="onFreqChanging" class="custom-slider" /> @change="onFreqChanging" @changing="onFreqChanging" class="custom-slider" />
</view> </view>
@ -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,15 @@
}) })
}) })
console.log(data, 'datatatatat'); console.log(data, 'datatatatat');
// 分享接口
if (these.Status.apiType === 'listA') {
these.fetchDeviceDetail(data.data.id) 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(); 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) { handleRightClick(item, s) {
if (item && item.callback) { if (item && item.callback) {
item.callback(item, s); item.callback(item, s);
@ -847,28 +855,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 +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) { sosSetting(item) {

View File

@ -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');
}) })

View File

@ -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)
}) })
} }
} }
@ -179,12 +181,13 @@
border-radius: 32px; border-radius: 32px;
background: rgba(255, 200, 78, 0.06); background: rgba(255, 200, 78, 0.06);
display: inline-block; display: inline-block;
width: 152rpx; width: 100rpx;
height: 60rpx; height: 50rpx;
text-align: center; text-align: center;
line-height: 60rpx; line-height: 50rpx;
color: rgba(224, 52, 52, 1); color: rgba(224, 52, 52, 1);
cursor: pointer; cursor: pointer;
margin-top: 30rpx;
} }
.IMG { .IMG {