fix(地图插件): 调整样式

master
yin5th 2023-01-14 15:09:25 +08:00
parent 5c7d421225
commit 2ae0776281
2 changed files with 10 additions and 3 deletions

View File

@ -21,7 +21,7 @@
.ew-map-select-poi { .ew-map-select-poi {
height: 505px; height: 505px;
width: 250px; width: 240px;
overflow-x: hidden; overflow-x: hidden;
overflow-y: auto; overflow-y: auto;
float: left; float: left;

View File

@ -179,10 +179,12 @@ layui.define(['layer', 'locationX'], function (exports) {
// 搜索附近方法 // 搜索附近方法
var searchNearBy = function (lng, lat){ var searchNearBy = function (lng, lat){
console.log('ssss')
var point = new BMap.Point(lng, lat); var point = new BMap.Point(lng, lat);
var localSearch = new BMap.LocalSearch(point, { var localSearch = new BMap.LocalSearch(point, {
pageCapacity: 10, pageCapacity: 10,
onSearchComplete: function (result){ onSearchComplete: function (result){
console.log(result,'rrrrsss')
var htmlList = ''; var htmlList = '';
$.each(result,function (i,val){ $.each(result,function (i,val){
$.each(val.Hr,function (i,ad){ $.each(val.Hr,function (i,ad){
@ -251,7 +253,8 @@ layui.define(['layer', 'locationX'], function (exports) {
} }
var htmlList = ''; var htmlList = '';
// $.each(result.Ir,function (i,ad){ // $.each(result.Ir,function (i,ad){
$.each(result.Kr,function (i,ad){ // $.each(result.Kr,function (i,ad){
$.each(result.Yr,function (i,ad){
htmlList += '<div data-lng="' + ad.point.lng + '" data-lat="' + ad.point.lat + '" data-title="'+ ad.title +'" data-address="'+ ad.address +'" class="ew-map-select-search-list-item">'; htmlList += '<div data-lng="' + ad.point.lng + '" data-lat="' + ad.point.lat + '" data-title="'+ ad.title +'" data-address="'+ ad.address +'" class="ew-map-select-search-list-item">';
htmlList += ' <div class="ew-map-select-search-list-item-icon-search"><i class="layui-icon layui-icon-search"></i></div>'; htmlList += ' <div class="ew-map-select-search-list-item-icon-search"><i class="layui-icon layui-icon-search"></i></div>';
htmlList += ' <div class="ew-map-select-search-list-item-title">' + ad.title + '</div>'; htmlList += ' <div class="ew-map-select-search-list-item-title">' + ad.title + '</div>';
@ -259,7 +262,7 @@ layui.define(['layer', 'locationX'], function (exports) {
htmlList += '</div>'; htmlList += '</div>';
}); });
$selectTips.html(htmlList); $selectTips.html(htmlList);
if (result.Kr.length === 0) $('#ew-map-select-tips').addClass('layui-hide'); if (result.Yr.length === 0) $('#ew-map-select-tips').addClass('layui-hide');
else $('#ew-map-select-tips').removeClass('layui-hide'); else $('#ew-map-select-tips').removeClass('layui-hide');
} }
}); });
@ -372,6 +375,7 @@ layui.define(['layer', 'locationX'], function (exports) {
var localSearch = new T.LocalSearch(map, { var localSearch = new T.LocalSearch(map, {
pageCapacity: 10, pageCapacity: 10,
onSearchComplete: function (result){ onSearchComplete: function (result){
console.log(result,'tiandi search')
var htmlList = ''; var htmlList = '';
$.each(result.getPois(),function (i,ad){ $.each(result.getPois(),function (i,ad){
var lnglat = ad.lonlat.split(" "); var lnglat = ad.lonlat.split(" ");
@ -546,6 +550,8 @@ layui.define(['layer', 'locationX'], function (exports) {
}); });
var cpoint = [lng, lat]; var cpoint = [lng, lat];
placeSearch.searchNearBy('', cpoint, 1000, function (status, result) { placeSearch.searchNearBy('', cpoint, 1000, function (status, result) {
console.log(result, 'gaode 搜索')
console.log(status, 'gaode 搜索 status')
if (status === 'complete') { if (status === 'complete') {
var pois = result.poiList.pois; var pois = result.poiList.pois;
var htmlList = ''; var htmlList = '';
@ -559,6 +565,7 @@ layui.define(['layer', 'locationX'], function (exports) {
htmlList += '</div>'; htmlList += '</div>';
} }
} }
console.log(htmlList,'gaode 搜索结果 html')
$('#ew-map-select-poi').html(htmlList); $('#ew-map-select-poi').html(htmlList);
} }
}); });