Browse Source

设置按键的优化

master
maochaoying 2 years ago
parent
commit
ffcaf515b2
  1. 2
      src/components/LiquidHandle.vue
  2. 84
      src/components/Setting/components/Device.vue

2
src/components/LiquidHandle.vue

@ -79,7 +79,6 @@
<van-field
type="number"
v-model="addLiquidVal"
:maxlength="6"
readonly
:formatter="formatter"
@click.stop="handleClickInput"
@ -152,7 +151,6 @@
v-model="addLiquidVal"
:show="numberKeyboardShow"
@input="handleInput"
:maxlength="6"
@blur="numberKeyboardShow = false"
/>
</div>

84
src/components/Setting/components/Device.vue

@ -8,7 +8,6 @@
v-model="sprayLiquidConfigVal"
:clickable="true"
:formatter="formatter7"
:maxlength="4"
readonly
@click.stop="hideClickKey(2)"
/>
@ -22,7 +21,6 @@
v-model="stoped_gs"
:clickable="true"
:formatter="formatter1"
:maxlength="4"
readonly
@click.stop="hideClickKey(3)"
/>
@ -35,7 +33,6 @@
type="number"
v-model="continued_gs"
:clickable="true"
:maxlength="4"
:formatter="formatter2"
readonly
@click.stop="hideClickKey(4)"
@ -49,7 +46,6 @@
type="number"
v-model="stoped_humi"
:clickable="true"
:maxlength="3"
:formatter="formatter9"
readonly
@click.stop="hideClickKey(9)"
@ -63,7 +59,6 @@
type="number"
v-model="continued_humi"
:clickable="true"
:maxlength="3"
:formatter="formatter10"
readonly
@click.stop="hideClickKey(10)"
@ -78,7 +73,6 @@
:formatter="formatter3"
v-model="stoped_satur"
:clickable="true"
:maxlength="3"
readonly
@click.stop="hideClickKey(5)"
/>
@ -92,7 +86,6 @@
:formatter="formatter4"
v-model="continued_satur"
:clickable="true"
:maxlength="3"
readonly
@click.stop="hideClickKey(6)"
/>
@ -106,7 +99,6 @@
type="number"
v-model="max_humidity"
:clickable="true"
:maxlength="3"
readonly
@click.stop="hideClickKey(7)"
/>
@ -129,7 +121,7 @@
v-model="addLiquidConfigVal"
:title="addLiquidConfigVal"
:show="addLiquidConfigValShow"
:maxlength="4"
@input="val => handleInput(val, 1)"
theme="custom"
close-button-text="配置"
@close="setAddliquidVal"
@ -137,9 +129,9 @@
/>
<van-number-keyboard
v-model="sprayLiquidConfigVal"
@input="val => handleInput(val, 2)"
:title="sprayLiquidConfigVal"
:show="sprayLiquidConfigValShow"
:maxlength="4"
theme="custom"
@close="setSprayLiquidVal"
close-button-text="配置"
@ -147,9 +139,9 @@
/>
<van-number-keyboard
v-model="stoped_gs"
@input="val => handleInput(val, 3)"
:title="stoped_gs"
:show="stoped_gsShow"
:maxlength="4"
theme="custom"
@close="setStopedGsVal"
close-button-text="配置"
@ -157,40 +149,40 @@
/>
<van-number-keyboard
v-model="continued_gs"
@input="val => handleInput(val, 4)"
:title="continued_gs"
@close="setcontinuedGsVal"
:show="continued_gsShow"
:maxlength="4"
theme="custom"
close-button-text="配置"
@blur="continued_gsShow = false"
/>
<van-number-keyboard
v-model="stoped_satur"
@input="val => handleInput(val, 5)"
:title="stoped_satur"
@close="setstopedSaturVal"
:show="stoped_saturShow"
:maxlength="3"
theme="custom"
close-button-text="配置"
@blur="stoped_saturShow = false"
/>
<van-number-keyboard
v-model="continued_satur"
@input="val => handleInput(val, 6)"
:title="continued_satur"
@close="setContinuedSaturVal"
:show="continued_saturShow"
:maxlength="3"
theme="custom"
close-button-text="配置"
@blur="continued_saturShow = false"
/>
<van-number-keyboard
v-model="max_humidity"
@input="val => handleInput(val, 7)"
:title="max_humidity"
@close="setMaxHumidityVal"
:show="max_humidityShow"
:maxlength="3"
theme="custom"
close-button-text="配置"
@blur="max_humidityShow = false"
@ -198,6 +190,7 @@
<van-number-keyboard
theme="custom"
close-button-text="配置"
@input="val => handleInput(val, 8)"
@close="setHeat_timeVal"
v-model="pre_heat_time_s"
:title="pre_heat_time_s"
@ -205,6 +198,7 @@
@blur="pre_heat_time_sShow = false"
/>
<van-number-keyboard
@input="val => handleInput(val, 9)"
theme="custom"
close-button-text="配置"
@close="setstoped_humiVal"
@ -215,6 +209,7 @@
/>
<van-number-keyboard
theme="custom"
@input="val => handleInput(val, 10)"
close-button-text="配置"
@close="setcontinued_humiVal"
v-model="continued_humi"
@ -260,7 +255,10 @@ const max_humidityShow = ref(false)
const stoped_humiShow = ref(false)
const continued_humiShow = ref(false)
const isFirstClick = ref(true)
const hideClickKey = flag => {
isFirstClick.value = true
stoped_humiShow.value = false
continued_humiShow.value = false
pre_heat_time_sShow.value = false
@ -303,6 +301,62 @@ const hideClickKey = flag => {
}
}
const handleInput = (value, index) => {
if (isFirstClick.value) {
if (index == 1) {
setTimeout(() => {
addLiquidConfigVal.value = value + ''
})
}
if (index == 2) {
setTimeout(() => {
sprayLiquidConfigVal.value = value + ''
})
}
if (index == 3) {
setTimeout(() => {
stoped_gs.value = value + ''
})
}
if (index == 4) {
setTimeout(() => {
continued_gs.value = value + ''
})
}
if (index == 5) {
setTimeout(() => {
stoped_satur.value = value + ''
})
}
if (index == 6) {
setTimeout(() => {
continued_satur.value = value + ''
})
}
if (index == 7) {
setTimeout(() => {
max_humidity.value = value + ''
})
}
if (index == 8) {
setTimeout(() => {
pre_heat_time_s.value = value + ''
})
}
if (index == 9) {
setTimeout(() => {
stoped_humi.value = value + ''
})
}
if (index == 10) {
setTimeout(() => {
continued_humi.value = value + ''
})
}
isFirstClick.value = false
}
}
const formatter1 = value => {
if (parseInt(value) == 0) {
return '0'

Loading…
Cancel
Save