Browse Source

finish

master
maochaoying 2 years ago
parent
commit
3631b1d9c9
  1. 9
      src/components/LiquidHandle.vue
  2. 55
      src/components/Setting/components/Device.vue
  3. 9
      src/components/info/DisinfectantLiquidInfo.vue
  4. 7
      src/socket/index.js

9
src/components/LiquidHandle.vue

@ -98,10 +98,15 @@
<div <div
class="liquid_column" class="liquid_column"
:style="{ :style="{
'--height': `${(disinfectantCapacity / 5000) * 427}px`,
'--height': `${
((disinfectantCapacity <= 0 ? 0 : disinfectantCapacity) / 5000) *
427
}px`,
}" }"
> >
<p class="indicator">{{ disinfectantCapacity }}g</p>
<p class="indicator">
{{ disinfectantCapacity <= 0 ? 0 : disinfectantCapacity }}g
</p>
</div> </div>
</div> </div>
<LiquidModal <LiquidModal

55
src/components/Setting/components/Device.vue

@ -10,7 +10,7 @@
:formatter="formatter6" :formatter="formatter6"
:maxlength="4" :maxlength="4"
readonly readonly
@touchstart.stop="addLiquidConfigValShow = true"
@touchstart.stop="hideClickKey(1)"
/> />
</p> </p>
<div class="btn" @click="setAddliquidVal">设置</div> <div class="btn" @click="setAddliquidVal">设置</div>
@ -25,7 +25,7 @@
:formatter="formatter7" :formatter="formatter7"
:maxlength="4" :maxlength="4"
readonly readonly
@touchstart.stop="sprayLiquidConfigValShow = true"
@touchstart.stop="hideClickKey(2)"
/> />
</p> </p>
<div class="btn" @click="setSprayLiquidVal">设置</div> <div class="btn" @click="setSprayLiquidVal">设置</div>
@ -40,7 +40,7 @@
:formatter="formatter1" :formatter="formatter1"
:maxlength="4" :maxlength="4"
readonly readonly
@touchstart.stop="stoped_gsShow = true"
@touchstart.stop="hideClickKey(3)"
/> />
</p> </p>
<div class="btn" @click="setStopedGsVal">设置</div> <div class="btn" @click="setStopedGsVal">设置</div>
@ -55,7 +55,7 @@
:maxlength="4" :maxlength="4"
:formatter="formatter2" :formatter="formatter2"
readonly readonly
@touchstart.stop="continued_gsShow = true"
@touchstart.stop="hideClickKey(4)"
/> />
</p> </p>
<div class="btn" @click="setcontinuedGsVal">设置</div> <div class="btn" @click="setcontinuedGsVal">设置</div>
@ -70,7 +70,7 @@
:clickable="true" :clickable="true"
:maxlength="3" :maxlength="3"
readonly readonly
@touchstart.stop="stoped_saturShow = true"
@touchstart.stop="hideClickKey(5)"
/> />
</p> </p>
<div class="btn" @click="setstopedSaturVal">设置</div> <div class="btn" @click="setstopedSaturVal">设置</div>
@ -85,7 +85,7 @@
:clickable="true" :clickable="true"
:maxlength="3" :maxlength="3"
readonly readonly
@touchstart.stop="continued_saturShow = true"
@touchstart.stop="hideClickKey(6)"
/> />
</p> </p>
<div class="btn" @click="setContinuedSaturVal">设置</div> <div class="btn" @click="setContinuedSaturVal">设置</div>
@ -100,12 +100,12 @@
:clickable="true" :clickable="true"
:maxlength="3" :maxlength="3"
readonly readonly
@touchstart.stop="max_humidityShow = true"
@touchstart.stop="hideClickKey(7)"
/> />
</p> </p>
<div class="btn" @click="setMaxHumidityVal">设置</div> <div class="btn" @click="setMaxHumidityVal">设置</div>
</div> </div>
<div class="row_wrap" style="margin-bottom: 20px">
<div class="row_wrap">
<p class="title">预热时间(s)</p> <p class="title">预热时间(s)</p>
<p class="num"> <p class="num">
<van-field <van-field
@ -114,7 +114,7 @@
v-model="pre_heat_time_s" v-model="pre_heat_time_s"
:clickable="true" :clickable="true"
readonly readonly
@touchstart.stop="pre_heat_time_sShow = true"
@touchstart.stop="hideClickKey(8)"
/> />
</p> </p>
<div class="btn" @click="setHeat_timeVal">设置</div> <div class="btn" @click="setHeat_timeVal">设置</div>
@ -199,6 +199,41 @@ const stoped_saturShow = ref(false)
const continued_saturShow = ref(false) const continued_saturShow = ref(false)
const max_humidityShow = ref(false) const max_humidityShow = ref(false)
const hideClickKey = flag => {
pre_heat_time_sShow.value = false
addLiquidConfigValShow.value = false
sprayLiquidConfigValShow.value = false
stoped_gsShow.value = false
continued_gsShow.value = false
stoped_saturShow.value = false
continued_saturShow.value = false
max_humidityShow.value = false
if (flag == 1) {
addLiquidConfigValShow.value = true
}
if (flag == 2) {
sprayLiquidConfigValShow.value = true
}
if (flag == 3) {
stoped_gsShow.value = true
}
if (flag == 4) {
continued_gsShow.value = true
}
if (flag == 5) {
stoped_saturShow.value = true
}
if (flag == 6) {
continued_saturShow.value = true
}
if (flag == 7) {
max_humidityShow.value = true
}
if (flag == 8) {
pre_heat_time_sShow.value = true
}
}
const formatter1 = value => { const formatter1 = value => {
let arr = settingStore.allSettingList.filter(item => item.name == 'stoped_gs') let arr = settingStore.allSettingList.filter(item => item.name == 'stoped_gs')
if (arr && arr.length > 0) { if (arr && arr.length > 0) {
@ -378,7 +413,7 @@ const setSprayLiquidVal = () => {
.device_container { .device_container {
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 100%;
height: 100%;
height: 580px;
padding: 20px; padding: 20px;
display: grid; display: grid;
overflow: scroll; overflow: scroll;

9
src/components/info/DisinfectantLiquidInfo.vue

@ -24,12 +24,17 @@
<div <div
class="pro" class="pro"
:style="{ :style="{
'--height': `${(disinfectantCapacity / 500) * 100}px`,
'--height': `${
((disinfectantCapacity <= 0 ? 0 : disinfectantCapacity) / 5000) *
100
}px`,
}" }"
></div> ></div>
</div> </div>
</div> </div>
<div class="bottom">{{ disinfectantCapacity }} (g)</div>
<div class="bottom">
{{ disinfectantCapacity <= 0 ? 0 : disinfectantCapacity }} (g)
</div>
</div> </div>
</template> </template>

7
src/socket/index.js

@ -3,8 +3,9 @@ export default class Socket {
this.url = url this.url = url
this.protocols = protocols this.protocols = protocols
this.ws = null this.ws = null
this.reconnectTimeout = 1000
this.maxReconnectTimes = 20
this.reconnectTimeout = 2000
this.maxReconnectTimes = 100
this.reconnectTimes = 0
} }
connect() { connect() {
@ -28,9 +29,9 @@ export default class Socket {
this.connect() this.connect()
this.reconnectTimes++ this.reconnectTimes++
}, this.reconnectTimeout) }, this.reconnectTimeout)
this.reconnectTimeout *= 2
} else { } else {
console.log('WebSocket重连超过最大次数,放弃重连') console.log('WebSocket重连超过最大次数,放弃重连')
// window.location.href = 'http://127.0.0.1/#/login'
} }
} }

Loading…
Cancel
Save