feat: 新增地图不支持获取定位时使用ip定位

This commit is contained in:
augushong
2025-04-18 09:23:55 +08:00
parent ed013e3039
commit 0a577cb321

View File

@@ -145,7 +145,15 @@
mapContainer.find('.location-message').text('正在获取定位...').show();
map.locate();
if (window.location.protocol === 'http:') {
$.get('//location.tianditu.gov.cn/data/getCityName',function(r){
mapContainer.find('.location-message').html('您的城市位置:' + r.data.lat + ',' + r.data.lng + ' <div class="layui-btn layui-btn-xs location-me">我的定位</div>');
mapContainer.find('.location-me').data('latlng', [r.data.lat,r.data.lng]);
map.flyTo([r.data.lat,r.data.lng], 12);
})
} else {
map.locate();
}
if (options.locationLatitude && options.locationLongitude && $(options.locationLatitude).val() && $(options.locationLongitude).val()) {
var lat = $(options.locationLatitude).val();