Selaa lähdekoodia

区域搜索修改

lijj 2 vuotta sitten
vanhempi
commit
0df3c2a298
2 muutettua tiedostoa jossa 13 lisäystä ja 6 poistoa
  1. 2 2
      miniapp/pages.json
  2. 11 4
      miniapp/pages/yuecai/search/index1.vue

+ 2 - 2
miniapp/pages.json

@@ -146,8 +146,8 @@
       "text": "发现",
       "pagePath": "pages/yuecai/search/index1"
     }, {
-      "iconPath": "@iconPath2",
-      "selectedIconPath": "@selectedIconPath2",
+      "iconPath": "@iconPath4",
+      "selectedIconPath": "@selectedIconPath4",
       "text": "我的",
       "pagePath": "pages/yuecai/usercenter/index"
     }]

+ 11 - 4
miniapp/pages/yuecai/search/index1.vue

@@ -65,7 +65,7 @@
             realtime: false,
             calculable: true,
             inRange: {
-              color: ['#ffffff', '#3FE6B8', '#9FE6B8','#96BFFF',  '#9d96f5', '#FFDB5C', '#ff9f7f', '#E062AE']
+              color: ['#ffffff', '#3FE6B8', '#9FE6B8', '#96BFFF', '#9d96f5', '#FFDB5C', '#ff9f7f', '#E062AE']
             }
           },
           series: [{
@@ -112,7 +112,7 @@
             }, {
               name: '揭阳市',
               value: 110
-            },{
+            }, {
               name: '湛江市',
               value: 120
             }, {
@@ -194,10 +194,17 @@
 
       clickMap(e) {
         let currentAcode;
-        if (e.dataIndex < 0) {
+        if (!(e.data && e.data.name)) {
           currentAcode = '';
         } else {
-          currentAcode = mapJson.features[e.dataIndex].properties.adcode;
+          /** 通过名称匹配 */
+          for (let i = 0; i < mapJson.features.length; i++) {
+            let p = mapJson.features[i].properties;
+            if (p.name == e.data.name) {
+              currentAcode = p.adcode.toString().substring(0, 4);
+              break;
+            }
+          }
         }
         if (this.currentTab != 3 && this.areaCode != currentAcode) {
           this.areaCode = currentAcode;