230320a303 2 years ago
parent
commit
310b79f947
1 changed files with 18 additions and 5 deletions
  1. 18 5
      src/pagesOther/map/plan.jsx

+ 18 - 5
src/pagesOther/map/plan.jsx

@@ -94,25 +94,28 @@ class Index extends Component {
           fillColor
         })
         let calloutContent = item.text
+        let display = 'BYCLICK'
         if (item.estateObj && item.estateObj.length > 10) {
           const estateObj = JSON.parse(item.estateObj)
           calloutContent = `${item.text}(¥${estateObj.price_range})`
+          display = 'ALWAYS'
         } else if (item.schoolObj && item.schoolObj.length > 10) {
           calloutContent += '>'
+          display = 'ALWAYS'
         }
         markerData.push({
           latitude: op.latitude,
           longitude: op.longitude,
           id: 20000 + index,
-          iconPath: 'https://icon.honglouplus.com/icon_1px.png',
-          width: 0,
-          height: 0,
+          iconPath: display === 'ALWAYS' ? 'https://icon.honglouplus.com/icon_1px.png' : 'https://img2.honglounews.com/20220110041435-6276.png',
+          width: display === 'ALWAYS' ? 0 : 20,
+          height: display === 'ALWAYS' ? 0 : 20,
           zIndex: 99,
           callout: {
             content: calloutContent,
             color: item.fillColor === '#ff0' ? '#ff0000' : '#fff',
             bgColor: item.fillColor || '#369af7',
-            display: 'ALWAYS',
+            display,
             padding: '6px 10px',
             textAlign: 'center',
             borderRadius: '10',
@@ -169,7 +172,16 @@ class Index extends Component {
       }
     }
   }
-  markerTap (e) {}
+  markerDiyTap (e) {
+    const { markerId } = e.detail
+    const curIndex = markerId - 20000
+    const { polygonsTextArr } = this.state
+    let markerData = JSON.parse(JSON.stringify(polygonsTextArr))
+    markerData[curIndex].callout.display = markerData[curIndex].callout.display === 'ALWAYS' ? 'BYCLICK' : 'ALWAYS'
+    this.setState({
+      polygonsTextArr: markerData
+    })
+  }
 
 
 
@@ -375,6 +387,7 @@ class Index extends Component {
           min-scale="13"
           max-scale="20"
           subkey="Y7PBZ-FPZRP-4DXDL-VXQ3B-7DFL7-UXBK4"
+          onMarkerTap={this.markerDiyTap.bind(this)}
           onCalloutTap={this.calloutTap.bind(this)}
           onRegionChange={this.regionChange.bind(this)} 
           className="scoped-map"/>