mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-08 19:12:48 +08:00
feat: 新增地图不支持获取定位时使用ip定位
This commit is contained in:
@@ -145,7 +145,15 @@
|
|||||||
|
|
||||||
mapContainer.find('.location-message').text('正在获取定位...').show();
|
mapContainer.find('.location-message').text('正在获取定位...').show();
|
||||||
|
|
||||||
|
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();
|
map.locate();
|
||||||
|
}
|
||||||
|
|
||||||
if (options.locationLatitude && options.locationLongitude && $(options.locationLatitude).val() && $(options.locationLongitude).val()) {
|
if (options.locationLatitude && options.locationLongitude && $(options.locationLatitude).val() && $(options.locationLongitude).val()) {
|
||||||
var lat = $(options.locationLatitude).val();
|
var lat = $(options.locationLatitude).val();
|
||||||
|
|||||||
Reference in New Issue
Block a user