100J提交
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
const config = {
|
||||
// 开发环境
|
||||
development: {
|
||||
BASE_URL: 'http://192.168.110.57:8000',//http://139.224.253.23:8000
|
||||
BASE_URL: 'http://192.168.2.34:8000',//http://139.224.253.23:8000
|
||||
API_PREFIX: '',
|
||||
// MQTT 配置
|
||||
MQTT_HOST: '47.120.79.150',
|
||||
|
||||
@ -607,6 +607,8 @@
|
||||
// 开启状
|
||||
these.deviceInfo.voiceStrobeAlarm = 1;
|
||||
these.formData.sta_VoiceType = mode_alarm + ''
|
||||
} else if (mode_alarm == 7) {
|
||||
these.formData.sta_VoiceType !== 7
|
||||
} else {
|
||||
// 关闭状态:赋值-1,表示关闭
|
||||
these.deviceInfo.voiceStrobeAlarm = -1;
|
||||
@ -771,7 +773,9 @@
|
||||
this.formData.bleStatu = 'connecting';
|
||||
bleTool.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(() => {
|
||||
this.formData.bleStatu = true;
|
||||
this.bleStateRecovry({ deviceId: f.deviceId });
|
||||
this.bleStateRecovry({
|
||||
deviceId: f.deviceId
|
||||
});
|
||||
}).catch(() => {
|
||||
this.formData.bleStatu = 'err';
|
||||
});
|
||||
@ -809,7 +813,7 @@
|
||||
// 关闭状态
|
||||
that.formData.sta_LightType = '-1';
|
||||
}
|
||||
if (this.formData.sta_VoiceType === '7' || this.formData.sta_VoiceType === 7) {
|
||||
if (this.formData.sta_VoiceType === '7' || res.data.alarmMode == 7) {
|
||||
this.formData.sta_VoiceType = (res.data.voiceStrobeAlarm ?? 0) + '';
|
||||
} else {
|
||||
this.formData.sta_VoiceType = res.data.alarmMode + ''
|
||||
@ -1028,18 +1032,18 @@
|
||||
item = this.dic.sta_VoiceType[index];
|
||||
}
|
||||
let val = item.key;
|
||||
const prevVoiceType = this.formData.sta_VoiceType;
|
||||
if (this.formData.sta_VoiceType === val) {
|
||||
val = '-1';
|
||||
}
|
||||
this.formData.sta_VoiceType = val;
|
||||
// 模式类型为7时才去判断
|
||||
console.log(val, 'valllll');
|
||||
const isVoiceOperate = val === '7' || val === '-1'; // 标记是否是语音开启/关闭操作
|
||||
if (this.deviceInfo.voiceStrobeAlarm == 1) {
|
||||
// 如果强制报警已经开启了,那么切换下面的模式需要时,需要触发报警指令
|
||||
// 仅「播放语音」7 的开关走播报接口;-1 只有从 7 取消时才视为关播报,避免取消内置音色选中误调播报接口
|
||||
const isVoiceOperate = val === '7' || (val === '-1' && prevVoiceType === '7');
|
||||
if (this.deviceInfo.voiceStrobeAlarm === 1) {
|
||||
// 强制报警已开启:切换下方模式需带报警下发
|
||||
const data = {
|
||||
deviceIds: [this.deviceInfo.deviceId],
|
||||
// 声光报警开关开启传1
|
||||
voiceStrobeAlarm: 1,
|
||||
mode: this.formData.sta_VoiceType
|
||||
};
|
||||
@ -1055,7 +1059,7 @@
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
} else if (isVoiceOperate) {
|
||||
const data = {
|
||||
deviceId: this.deviceInfo.deviceId,
|
||||
@ -1075,25 +1079,38 @@
|
||||
});
|
||||
}
|
||||
}).catch(() => {
|
||||
uni.showToast({ title: '下发失败,请检查蓝牙或网络', icon: 'none' });
|
||||
uni.showToast({
|
||||
title: '下发失败,请检查蓝牙或网络',
|
||||
icon: 'none'
|
||||
});
|
||||
} else {
|
||||
// 非强制报警态下选择内置音色:原先仅改 UI 未下发,设备无播报
|
||||
});
|
||||
} else if (prevVoiceType === '7' && val !== '7' && val !== '-1') {
|
||||
// 从「播放语音」切到其它内置音色:先关播报;报警未开启时不走 forceAlarm,仅 UI 预选音色
|
||||
const data = {
|
||||
deviceIds: [this.deviceInfo.deviceId],
|
||||
voiceStrobeAlarm: 0,
|
||||
deviceId: this.deviceInfo.deviceId,
|
||||
voiceBroadcast: 0,
|
||||
mode: val
|
||||
};
|
||||
deviceForceAlarmActivation(data).then((res) => {
|
||||
if (res.code === 200) {
|
||||
uni.showToast({ title: res.msg || '已切换', icon: 'none' });
|
||||
deviceVoiceBroadcast(data).then((res) => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
title: res.msg || '已切换',
|
||||
icon: 'none'
|
||||
});
|
||||
} else {
|
||||
uni.showToast({ title: res.msg || '操作失败', icon: 'none' });
|
||||
}
|
||||
}).catch(() => {
|
||||
uni.showToast({ title: '下发失败,请检查蓝牙或网络', icon: 'none' });
|
||||
uni.showToast({
|
||||
title: res.msg || '操作失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}).catch(() => {
|
||||
uni.showToast({
|
||||
title: '下发失败,请检查蓝牙或网络',
|
||||
icon: 'none'
|
||||
});
|
||||
});
|
||||
}
|
||||
// 未开启强制报警时,在 0–6 内置音色间切换或取消选中:只改按钮选中,不下发
|
||||
},
|
||||
// 报警模式
|
||||
sosSetting(item) {
|
||||
@ -1280,7 +1297,8 @@
|
||||
const last6 = target.slice(-6);
|
||||
const item = bleTool.data.LinkedList.find((v) => {
|
||||
const m = macNorm(v.macAddress || '');
|
||||
return v.deviceId === res.deviceId && (m === target || (m.length >= 6 && m.slice(-6) === last6));
|
||||
return v.deviceId === res.deviceId && (m === target || (m.length >= 6 && m.slice(-6) ===
|
||||
last6));
|
||||
});
|
||||
return !!item;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user