优化100J管控页样式

This commit is contained in:
微微一笑
2026-03-30 17:20:48 +08:00
parent 56e85e5dba
commit d5269b02d0

View File

@ -173,10 +173,10 @@
<view class="line"></view> <view class="line"></view>
<view class="header paddingTop0"> <view class="header paddingTop0">
<text class="sliderTxt">频率</text> <text class="sliderTxt">频率</text>
<text class="sliderVal">{{ formData.strobeFrequency }}HZ</text> <text class="sliderVal">{{ strobeFrequencySlider }}HZ</text>
</view> </view>
<view class="slider-container"> <view class="slider-container">
<slider min="1" max="10" step="1" :disabled="false" :value="formData.strobeFrequency" <slider min="1" max="10" step="1" :disabled="false" :value="strobeFrequencySlider"
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>
@ -331,7 +331,7 @@
sta_VoiceType: '0', sta_VoiceType: '0',
volume: 10, volume: 10,
sta_LightType: '', sta_LightType: '',
strobeFrequency: 0.5, strobeFrequency: 1,
lightBrightness: 10, lightBrightness: 10,
sta_system: '', sta_system: '',
warnTime: 0, warnTime: 0,
@ -552,8 +552,9 @@
// 设备按键, app同步 // 设备按键, app同步
} else if (funcType == '14') { } else if (funcType == '14') {
// 调节亮度,音量,频率相关字段 // 调节亮度,音量,频率相关字段
these.formData.strobeFrequency = led_strobe.frequency || these.formData.strobeFrequency = these.normalizeStrobeFreq(
0.5; //频率 led_strobe.frequency != null ? led_strobe.frequency : 1
);
these.formData.volume = volume || 10; //音量 these.formData.volume = volume || 10; //音量
these.formData.lightBrightness = brightness.red || these.formData.lightBrightness = brightness.red ||
10; //亮度值 10; //亮度值
@ -693,6 +694,10 @@
this.$nextTick(() => this.sync100JBleUiFromHelper()); this.$nextTick(() => this.sync100JBleUiFromHelper());
}, },
computed: { computed: {
/** 与 slider min/max(1~10) 对齐;离线未拉到详情时避免 0.5 等非法值导致滑块渲染飞出 */
strobeFrequencySlider() {
return this.normalizeStrobeFreq(this.formData.strobeFrequency);
},
getbleStatu() { getbleStatu() {
if (this.formData.bleStatu === true) { if (this.formData.bleStatu === true) {
return '已连接'; return '已连接';
@ -711,6 +716,15 @@
}, },
methods: { methods: {
/** 警示灯频率 UIslider 为 1~10与协议 0~12 取交集 */
normalizeStrobeFreq(v) {
const n = Number(v);
if (!Number.isFinite(n)) return 1;
const r = Math.round(n);
if (r < 1) return 1;
if (r > 10) return 10;
return r;
},
/** 与 BleHelper 实际连接状态对齐(系统关蓝牙再开、从后台回前台等) */ /** 与 BleHelper 实际连接状态对齐(系统关蓝牙再开、从后台回前台等) */
sync100JBleUiFromHelper() { sync100JBleUiFromHelper() {
const mac = (this.device && this.device.deviceMac) || (this.deviceInfo && this.deviceInfo.deviceMac); const mac = (this.device && this.device.deviceMac) || (this.deviceInfo && this.deviceInfo.deviceMac);
@ -796,6 +810,7 @@
}) })
); );
Object.assign(this.formData, validData); Object.assign(this.formData, validData);
that.formData.strobeFrequency = that.normalizeStrobeFreq(that.formData.strobeFrequency);
that.deviceInfo = res.data; that.deviceInfo = res.data;
that.$nextTick(() => that.sync100JBleUiFromHelper && that.sync100JBleUiFromHelper()); that.$nextTick(() => that.sync100JBleUiFromHelper && that.sync100JBleUiFromHelper());
const strobeEnable = res.data.strobeEnable ?? 0; // 0=关闭1=开启 const strobeEnable = res.data.strobeEnable ?? 0; // 0=关闭1=开启
@ -1417,15 +1432,17 @@
else if (this.formData.sta_VoiceType === '7') this.formData.sta_VoiceType = '-1'; else if (this.formData.sta_VoiceType === '7') this.formData.sta_VoiceType = '-1';
} }
if (parsedData.volume !== undefined) this.formData.volume = parsedData.volume; if (parsedData.volume !== undefined) this.formData.volume = parsedData.volume;
if (parsedData.strobeFrequency !== undefined) this.formData.strobeFrequency = parsedData if (parsedData.strobeFrequency !== undefined) {
.strobeFrequency; this.formData.strobeFrequency = this.normalizeStrobeFreq(parsedData.strobeFrequency);
}
if (parsedData.redBrightness !== undefined) this.formData.lightBrightness = parsedData if (parsedData.redBrightness !== undefined) this.formData.lightBrightness = parsedData
.redBrightness; .redBrightness;
} }
// 0x09 音量、0x0D 亮度:单独响应时同步 // 0x09 音量、0x0D 亮度:单独响应时同步
if (fc === 0x09 && parsedData.volume !== undefined) this.formData.volume = parsedData.volume; if (fc === 0x09 && parsedData.volume !== undefined) this.formData.volume = parsedData.volume;
if (fc === 0x0B && parsedData.strobeFrequency !== undefined) this.formData.strobeFrequency = parsedData if (fc === 0x0B && parsedData.strobeFrequency !== undefined) {
.strobeFrequency; this.formData.strobeFrequency = this.normalizeStrobeFreq(parsedData.strobeFrequency);
}
if (fc === 0x0D && parsedData.redBrightness !== undefined) this.formData.lightBrightness = parsedData if (fc === 0x0D && parsedData.redBrightness !== undefined) this.formData.lightBrightness = parsedData
.redBrightness; .redBrightness;
}, },
@ -1932,6 +1949,9 @@
.slider-container { .slider-container {
padding: 0px; padding: 0px;
width: 100%;
overflow: hidden;
box-sizing: border-box;
} }
.addIco { .addIco {