浏览代码

返回按钮功能优化

songxy 2 月之前
父节点
当前提交
7a8cb95c53
共有 1 个文件被更改,包括 20 次插入12 次删除
  1. 20 12
      web_ui/src/views/znzt-land/AiZtzsDetail.vue

+ 20 - 12
web_ui/src/views/znzt-land/AiZtzsDetail.vue

@@ -132,7 +132,7 @@
           v-if="showQuery"
         >
           <div class="left-panel-content">
-            <span class="back_icon" v-if="false" @click="onBackHandle"></span>
+            <span class="back_icon" @click="onBackHandle"></span>
             <div v-for="(item, index) in hzData" :key="index">
               <div class="title" @click="resetAnswer(index)">
                 {{ item.name }}
@@ -307,6 +307,8 @@ import landMethods from "@/api/land";
 import AIBtn from "@/components/AIBtn.vue";
 import LC from "@/assets/layerConfig.js";
 import xsq from '@/assets/xsq.json'
+
+const _timers1 = [], _timers2 = []
 export default {
   components: {
     industrialTop,
@@ -426,7 +428,6 @@ export default {
     this.$nextTick(() => {
       this.activeIndex = 0;
       this.initMap();
-      // this.openYjjbnt();
       // this.addXzqLayer();
       // this.bindPopup();
       // this.closeXzqLayer();
@@ -955,11 +956,13 @@ export default {
                 }]
                 this.showResult = true
                 this.openYjjbnt();
+                _timers2.push(timer2)
                 clearTimeout(timer2)
               }, 5000)
               clearInterval(timer1);
             }
           }, 50 * index);
+           _timers1.push(timer1)
           return;
         }else if (this.listType === '3') {
           const str1 = 'Question: 请帮统计萧山区永久基本农田规模,Thought: 用户的需求是统计萧山区永久基本农田总面积。首先我要先打开永久基本农田图层';
@@ -1015,13 +1018,26 @@ export default {
             }
             clearTimeout(timer2)
           }, 5000)
+          _timers2.push(timer2)
           clearInterval(timer1);
         }
       }, 50 * index);
+      _timers1.push(timer1)
     },
     onBackHandle () {
-      this.showQuery = false;
+      this.showResult = this.showQuery = false;
       this.hzData = []
+      this.listType = ''
+      this.inputText = ''
+      this.closeXzqLayer();
+      _timers1.forEach((timer1,index) => {
+        clearInterval(timer1)
+        _timers1.splice(index, 1)
+      })
+      _timers2.forEach((timer2, index) => {
+        clearTimeout(timer2)
+        _timers2.splice(index, 1)
+      })
     },
     toggleZw() {
       this.zhuiwen = !this.zhuiwen;
@@ -1059,7 +1075,7 @@ export default {
         this.map.removeLayer(this.xzqLayer);
         this.xzqLayer = null;
       }
-      let layer = L.geoJSON(xsq, {
+      let layer= L.geoJSON(xsq, {
           style: function (feature) {
             return { color: "blue", fillOpacity: 0 };
           },
@@ -1082,7 +1098,6 @@ export default {
         this.xzqLayer.closePopup();
         this.map.removeLayer(this.xzqLayer);
         this.xzqLayer = null;
-        this.closeYjjbnt();
       }
     },
     locationByGeojson(geojson, name) {
@@ -1370,13 +1385,6 @@ export default {
         this.switchMapLayer(yjjbntLayer);
       }
     },
-    closeYjjbnt() {
-      let yjjbntLayer =  this.layers[5].layers[0];
-      if(yjjbntLayer.checked) {
-        yjjbntLayer.checked = false;
-        this.switchMapLayer(yjjbntLayer);
-      }
-    },
     //所有地块仿百度地图绘制
     showXgdkCenterPoint() {
       if (this.dkMarkerLayer) {