瀏覽代碼

地图在地州市无法下转问题

wangcc 2 年之前
父節點
當前提交
1e34e348f4
共有 1 個文件被更改,包括 24 次插入16 次删除
  1. 24 16
      src/views/index.vue

+ 24 - 16
src/views/index.vue

@@ -3,7 +3,7 @@
  * @Author: wangcc
  * @Date: 2022-07-06 15:56:45
  * @LastEditors: wangcc
- * @LastEditTime: 2022-08-03 15:29:03
+ * @LastEditTime: 2022-08-11 11:33:09
  * @FilePath: \castgroup_bigscreen\src\views\index.vue
  * @Copyright: Copyright (c) 2016~2022 by wangcc, All Rights Reserved. 
 -->
@@ -357,6 +357,7 @@ export default {
     },
     '$store.state.addr.mapLevel': {
       handler(val) {
+        console.log(val);
         if (val === 'city') {
           this.jumpDistrict();
         }
@@ -1085,21 +1086,26 @@ export default {
       smallClassDetail(param).then((res) => {
         this.changeSearchSmallClass(res.data);
         console.log(res.data);
-        this.alarData = res.data
-        this.vuexCityList.forEach((element) => {
-          if (res.data.cityId === element.areaId) {
-            this.changeSelectCity({
-              value: element.areaCode,
-              label: res.data.cityName,
-              areaId: element.areaId
-            });
-            this.$store.dispatch('searchArea', {
-              parentId: element.areaCode.substring(0, 6),
-              name: res.data.cityName,
-              mapLevel: 'city'
-            });
-          }
-        });
+        this.alarData = res.data;
+        console.log(this.$store.state.addr.mapLevel);
+        if (this.$store.state.addr.mapLevel == 'city') {
+          this.jumpDistrict();
+        } else {
+          this.vuexCityList.forEach((element) => {
+            if (res.data.cityId === element.areaId) {
+              this.changeSelectCity({
+                value: element.areaCode,
+                label: res.data.cityName,
+                areaId: element.areaId
+              });
+              this.$store.dispatch('searchArea', {
+                parentId: element.areaCode.substring(0, 6),
+                name: res.data.cityName,
+                mapLevel: 'city'
+              });
+            }
+          });
+        }
       });
     },
     jumpDistrict() {
@@ -1111,6 +1117,8 @@ export default {
               label: this.alarData.cityName,
               areaId: element.areaId
             });
+            console.log(element.areaCode.substring(0, 6));
+            console.log(element.areaName);
             this.$store.dispatch('searchArea', {
               parentId: element.areaCode.substring(0, 6),
               name: element.areaName,