11 changed files with 163 additions and 49 deletions
			
			
		
								
									Binary file not shown.
								
							
						
					| After Width: | Height: | Size: 42 KiB | 
| After Width: | Height: | Size: 118 KiB | 
| @ -0,0 +1,50 @@ | |||
| import React, { useEffect, useState } from 'react'; | |||
| 
 | |||
| let map = ''; | |||
| const Amap = (props) => { | |||
|     const [mapComplete, setMapComplete] = useState(false); | |||
| 
 | |||
|     useEffect(() => { | |||
|         drawMap(); | |||
|     }, []); | |||
|     const drawMap = () => { | |||
|         try { | |||
|             if (AMap) loadMap(); | |||
|         } catch (e) { | |||
|             var script = document.createElement("script"); | |||
|             script.src = "https://webapi.amap.com/maps?v=2.0&key=00f9a29dedcdbd8befec3dfe0cef5003&plugin=AMap.AutoComplete,AMap.PlaceSearch"; | |||
|             document.body.appendChild(script); | |||
|             loadMap(); | |||
|         } | |||
|     } | |||
| 
 | |||
|     const loadMap = () => { | |||
|         map = new AMap.Map("amapId", { | |||
|             resizeEnable: true, | |||
|             center: [115.934544, 28.664365], // 地图中心点,初始定位加载显示楼块
 | |||
|             // center: [115.857952, 28.683003],// 地图中心点
 | |||
|             zoom: 14, // 地图显示的缩放级别
 | |||
|             zooms: [3, 20], | |||
|             pitch: 0, // 地图俯仰角度,有效范围 0 度- 83 度
 | |||
|             viewMode: '3D', // 地图模式
 | |||
|             // rotation: 60
 | |||
|             // showLabel: false
 | |||
|         }); | |||
|         // 主题样式
 | |||
|         map.setMapStyle("amap://styles/fb26776387242721c2fc32e2cb1daccc"); | |||
| 
 | |||
|         map.on('complete', function () { | |||
|             console.log("map-complete") | |||
|             setMapComplete(true); | |||
|         }); | |||
|         window.onload = function () { | |||
|             console.log("window.onload") | |||
|         } | |||
|     }; | |||
| 
 | |||
|     return <div style={{ width: '100%', height: '100%', }}> | |||
|         <div id='amapId' style={{ width: '100%', height: '100%', background: "#101824" }} /> | |||
|     </div> | |||
| } | |||
| 
 | |||
| export default Amap; | |||
| @ -0,0 +1,19 @@ | |||
| .super-screen-body { | |||
|     position: absolute; | |||
|     top: 174px; | |||
|     width: 20%; | |||
|     height: calc(100% - 174px); | |||
|     z-index: 5; | |||
|     // background: linear-gradient(to right, #001624 0%, rgba(0, 22, 36, 0.9) 80%, rgba(0, 22, 36, 0.6) 100%); | |||
|     padding-left: 1.5vw; | |||
|     padding-top: 8px; | |||
|     color: #fff; | |||
| } | |||
| 
 | |||
| .left { | |||
|     left: 0; | |||
| } | |||
| 
 | |||
| .right { | |||
|     right: 0; | |||
| } | |||
| @ -0,0 +1,31 @@ | |||
| .map { | |||
|     width: 100%; | |||
|     height: 100%; | |||
|     overflow: hidden; | |||
|     position: absolute; | |||
|     top: 0; | |||
|     left: 0; | |||
| } | |||
| 
 | |||
| .super-screen-top { | |||
|     position: absolute; | |||
|     top: 0; | |||
|     left: 0; | |||
|     width: 100%; | |||
|     height: 130px; | |||
|     z-index: 6; | |||
| } | |||
| 
 | |||
| .super-screen-bottom { | |||
|     position: absolute; | |||
|     bottom: 0; | |||
|     left: 0; | |||
|     width: 100%; | |||
|     z-index: 6; | |||
| } | |||
| 
 | |||
| .header { | |||
|     position: absolute; | |||
|     width: 100%; | |||
|     z-index: 6; | |||
| } | |||
					Loading…
					
					
				
		Reference in new issue