```
## 行政区域选择+定位+弹出框


> html代码部分
```html
```
> js代码部分
```js
$(document).ready(function () {
var area = $('#map-box').gaodeArea().data('map.gaode.area');
$('#save-btn').click(function () {
area.getValues(function (values) {
//字段转换
var map = {
province: 'provinceCode',
provinceText: 'province',
city: 'cityCode',
cityText: 'city',
district: 'districtCode',
districtText: 'district',
address: 'address',
location: 'geo'
};
//生成地理酒店地理位置信息的隐藏字段
var html = '';
for (var p in values) {
var val = values[p];
if (map[p])
html += '';
}
$('#hiddenArea').html(html);
//组合完整地址
$('#full-addr').html(
values['provinceText'] +
values['cityText'] +
values['districtText'] +
values['address']);
});
//查询酒店周边的信息,并生成隐藏字段
area.searchNearBy('地铁站|机场|景点|公交站', function (pois) {
$('#hiddenNearby').html($.map(pois, function (item) {
var lng = item.location.lng;
var lat = item.location.lat;
var geo = '{"lng":' + lng + ',"lat":' + lat + '}';
return "";
}).join(''));
});
});
$('form').submit(function () {
//如果直接提交表单,return true
//如果ajax提交表单,在这里编写异步提交。return false
return false;
});
});
```
MIT License
Copyright (c) 2018 顿刚
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.