Signed-off-by: gaoyuheng <gaoyuheng@yuheng.hl.cn>

This commit is contained in:
2025-04-04 21:54:50 +08:00
parent 094c3ea04d
commit a4f8ba4440
157 changed files with 7732 additions and 0 deletions

52
admin/map.php Normal file
View File

@@ -0,0 +1,52 @@
<?php
include_once("../common/init.php");
check_login();
$tb_name = "cars";
$page = $_REQUEST["page"]?$_REQUEST["page"]:1;
$list = db_get_all("select * from $tb_name order by id desc");
?>
<?php include_once("base.php");?>
<style>
.map_box{height: 600px;}
</style>
<body>
<div id="mapBox" class="map_box"></div>
<script type="text/javascript" src="http://webapi.amap.com/maps?v=1.4.6&key=ea1a7b8b8265fda0230e7235809a6037"></script>
<script>
var list = <?php echo json_encode($list)?>;
console.log(list)
var map = new AMap.Map('mapBox', {
resizeEnable: true,
mapStyle: 'amap://styles/c94e78bbbdccdee5a21c45f18da575b1'//样式URL
});
map.plugin('AMap.Geolocation', function() {
geolocation = new AMap.Geolocation({
enableHighAccuracy: true,//是否使用高精度定位,默认:true
timeout: 10000, //超过10秒后停止定位默认无穷大
buttonOffset: new AMap.Pixel(10, 20),//定位按钮与设置的停靠位置的偏移量默认Pixel(10, 20)
zoomToAccuracy: true, //定位成功后调整地图视野范围使定位位置及精度范围视野内可见默认false
buttonPosition:'RB'
});
map.addControl(geolocation);
geolocation.getCurrentPosition();
});
for (var i=0;i<list.length;i++){
if(list[i].lat > 0 && list[i].lng >0){
var marker = new AMap.Marker({
icon: "http://webapi.amap.com/theme/v1.3/markers/n/mark_r.png",
position: [list[i].lat,list[i].lng], //基点位置
draggable: true, //是否可拖动
});
marker.setMap(map);
marker.setLabel({//label默认蓝框白底左上角显示样式className为amap-marker-label
offset: new AMap.Pixel(-40, -25),//修改label相对于maker的位置
content: "车牌号:"+list[i].title
});
}
}
</script>
</body>
</html>