Pārlūkot izejas kodu

fix:解决空调加时的功能

chenzhen2 4 mēneši atpakaļ
vecāks
revīzija
6a41f746d7
1 mainītis faili ar 9 papildinājumiem un 8 dzēšanām
  1. 9 8
      src/views/envmonitor/components/Air/manualIndex.vue

+ 9 - 8
src/views/envmonitor/components/Air/manualIndex.vue

@@ -53,7 +53,7 @@
     <template v-if="airData.boundPoint && (airData.boundPoint.tempSetBound || airData.boundPoint.gearSetBound || airData.boundPoint.modeSetBound)">
       <div class="line" v-if="airData.isOpen"></div>
       <div class="main-temp" v-if="navType == 'all' && airData.isOpen">
-          <div class="com-control com-control-padding" v-if="airData.boundPoint && airData.boundPoint.tempSetBound" >
+          <div class="com-control com-control-padding" v-show="airData.boundPoint && airData.boundPoint.tempSetBound" >
             <div class="temp-slider" id="sliderId">
               <div class="slider-bar" id="barId">
                 <div class="bar-temp">{{ realTemp }}℃</div>
@@ -449,7 +449,6 @@ export default defineComponent({
       },
       // 滑动
       endBoxSwiper() {
-        proxyData.swiperIinit = true;
         let handBox: any = document.querySelector("#handId");
         let barBox: any = document.querySelector("#barId");
         let sliderBox: any = document.querySelector("#sliderId");
@@ -469,11 +468,10 @@ export default defineComponent({
         if (!handBox) {
           return;
         }
+
         handBox.addEventListener("touchstart", function(e: any) {
-          let oldBarLeft=barBox && barBox.style && barBox.style.left || 0
-          barLeft = isNaN(parseInt(oldBarLeft))
-            ? 0
-            : parseInt(oldBarLeft);
+          let oldBarLeft = (barBox && barBox.style && barBox.style.left) || 0;
+          barLeft = isNaN(parseInt(oldBarLeft)) ? 0 : parseInt(oldBarLeft);
           isMove = true;
         });
         handBox.addEventListener("touchend", function(e: any) {
@@ -481,6 +479,7 @@ export default defineComponent({
           proxyData.changeZongAir("temp", proxyData.realTemp);
           proxyData.airTemp = proxyData.realTemp;
         });
+        proxyData.swiperIinit = true;
         swiper(handBox, {
           swipeLeft: function(e: any) {
             if (isMove) {
@@ -872,7 +871,7 @@ export default defineComponent({
         proxyData.loadingAir = true;
         // 操作空调后,先关闭定时刷新接口,等固定时间再更新空调状态
         proxyData.updateAirStatus();
-
+        proxyData.swiperIinit = false;
         if (proxyData.airData.isOpen) {
           nextTick(() => {
             proxyData.barSwiperInit();
@@ -904,7 +903,9 @@ export default defineComponent({
       // 初始化滚动
       async barSwiperInit() {
         if (proxyData.airData.isOpen && !proxyData.showChild) {
-          proxyData.endBoxSwiper();
+          if (!proxyData.swiperIinit) {
+            proxyData.endBoxSwiper();
+          }
           // debugger
           proxyData.setBarNowPerstion();
         }