Ver código fonte

坐标选择器插件,应用方法

lizhen 1 semana atrás
pai
commit
13e201d207

+ 1 - 0
addons/address/.addonrc

@@ -0,0 +1 @@
+{"files":["public\\assets\\addons\\address\\js\\gcoord.min.js","public\\assets\\addons\\address\\js\\jquery.autocomplete.js"],"license":"regular","licenseto":"19079","licensekey":"KB8nHif6deVtJQOX ps5VOd\/lBI5BJFvG6RZQjQ==","domains":["shequ.com"],"licensecodes":[],"validations":["f3dae4d9846343538fa9ff48f78d7f00"]}

+ 32 - 0
addons/address/Address.php

@@ -0,0 +1,32 @@
+<?php
+
+namespace addons\address;
+
+use think\Addons;
+
+/**
+ * 地址选择
+ * @author [MiniLing] <[laozheyouxiang@163.com]>
+ */
+class Address extends Addons
+{
+
+    /**
+     * 插件安装方法
+     * @return bool
+     */
+    public function install()
+    {
+        return true;
+    }
+
+    /**
+     * 插件卸载方法
+     * @return bool
+     */
+    public function uninstall()
+    {
+        return true;
+    }
+
+}

+ 34 - 0
addons/address/bootstrap.js

@@ -0,0 +1,34 @@
+require([], function () {
+    //绑定data-toggle=addresspicker属性点击事件
+
+    $(document).on('click', "[data-toggle='addresspicker']", function () {
+        var that = this;
+        var callback = $(that).data('callback');
+        var input_id = $(that).data("input-id") ? $(that).data("input-id") : "";
+        var lat_id = $(that).data("lat-id") ? $(that).data("lat-id") : "";
+        var lng_id = $(that).data("lng-id") ? $(that).data("lng-id") : "";
+        var zoom_id = $(that).data("zoom-id") ? $(that).data("zoom-id") : "";
+        var lat = lat_id ? $("#" + lat_id).val() : '';
+        var lng = lng_id ? $("#" + lng_id).val() : '';
+        var zoom = zoom_id ? $("#" + zoom_id).val() : '';
+        var url = "/addons/address/index/select";
+        url += (lat && lng) ? '?lat=' + lat + '&lng=' + lng + (input_id ? "&address=" + $("#" + input_id).val() : "") + (zoom ? "&zoom=" + zoom : "") : '';
+        Fast.api.open(url, '位置选择', {
+            callback: function (res) {
+                input_id && $("#" + input_id).val(res.address).trigger("change");
+                lat_id && $("#" + lat_id).val(res.lat).trigger("change");
+                lng_id && $("#" + lng_id).val(res.lng).trigger("change");
+                zoom_id && $("#" + zoom_id).val(res.zoom).trigger("change");
+
+                try {
+                    //执行回调函数
+                    if (typeof callback === 'function') {
+                        callback.call(that, res);
+                    }
+                } catch (e) {
+
+                }
+            }
+        });
+    });
+});

+ 132 - 0
addons/address/config.php

@@ -0,0 +1,132 @@
+<?php
+
+return [
+    [
+        'name' => 'maptype',
+        'title' => '默认地图类型',
+        'type' => 'radio',
+        'content' => [
+            'baidu' => '百度地图',
+            'amap' => '高德地图',
+            'tencent' => '腾讯地图',
+        ],
+        'value' => 'amap',
+        'rule' => 'required',
+        'msg' => '',
+        'tip' => '',
+        'ok' => '',
+        'extend' => '',
+    ],
+    [
+        'name' => 'zoom',
+        'title' => '默认缩放级别',
+        'type' => 'string',
+        'content' => [],
+        'value' => '11',
+        'rule' => 'required',
+        'msg' => '',
+        'tip' => '',
+        'ok' => '',
+        'extend' => '',
+    ],
+    [
+        'name' => 'lat',
+        'title' => '默认Lat',
+        'type' => 'string',
+        'content' => [],
+        'value' => '39.919990',
+        'rule' => 'required',
+        'msg' => '',
+        'tip' => '',
+        'ok' => '',
+        'extend' => '',
+    ],
+    [
+        'name' => 'lng',
+        'title' => '默认Lng',
+        'type' => 'string',
+        'content' => [],
+        'value' => '116.456270',
+        'rule' => 'required',
+        'msg' => '',
+        'tip' => '',
+        'ok' => '',
+        'extend' => '',
+    ],
+    [
+        'name' => 'baidukey',
+        'title' => '百度地图KEY',
+        'type' => 'string',
+        'content' => [],
+        'value' => '',
+        'rule' => '',
+        'msg' => '',
+        'tip' => '',
+        'ok' => '',
+        'extend' => '',
+    ],
+    [
+        'name' => 'amapkey',
+        'title' => '高德地图KEY',
+        'type' => 'string',
+        'content' => [],
+        'value' => '749be8919c0d8ac113b4df13c14b319b',
+        'rule' => '',
+        'msg' => '',
+        'tip' => '',
+        'ok' => '',
+        'extend' => '',
+    ],
+    [
+        'name' => 'amapsecurityjscode',
+        'title' => '高德地图安全密钥',
+        'type' => 'string',
+        'content' => [],
+        'value' => '',
+        'rule' => '',
+        'msg' => '',
+        'tip' => '',
+        'ok' => '',
+        'extend' => '',
+    ],
+    [
+        'name' => 'tencentkey',
+        'title' => '腾讯地图KEY',
+        'type' => 'string',
+        'content' => [],
+        'value' => '',
+        'rule' => '',
+        'msg' => '',
+        'tip' => '',
+        'ok' => '',
+        'extend' => '',
+    ],
+    [
+        'name' => 'coordtype',
+        'title' => '坐标系类型',
+        'type' => 'select',
+        'content' => [
+            'DEFAULT' => '默认(使用所选地图默认坐标系)',
+            'GCJ02' => 'GCJ-02',
+            'BD09' => 'BD-09',
+        ],
+        'value' => 'DEFAULT',
+        'rule' => 'required',
+        'msg' => '',
+        'tip' => '',
+        'ok' => '',
+        'extend' => '',
+    ],
+    [
+        'name' => '__tips__',
+        'title' => '温馨提示',
+        'type' => '',
+        'content' => [],
+        'value' => '请先申请对应地图的Key,配置后再使用',
+        'rule' => '',
+        'msg' => '',
+        'tip' => '',
+        'ok' => '',
+        'extend' => 'alert-danger-light',
+    ],
+];

+ 64 - 0
addons/address/controller/Index.php

@@ -0,0 +1,64 @@
+<?php
+
+namespace addons\address\controller;
+
+use think\addons\Controller;
+use think\Config;
+use think\Hook;
+
+class Index extends Controller
+{
+
+    // 首页
+    public function index()
+    {
+        // 语言检测
+        $lang = $this->request->langset();
+        $lang = preg_match("/^([a-zA-Z\-_]{2,10})\$/i", $lang) ? $lang : 'zh-cn';
+
+        $site = Config::get("site");
+
+        // 配置信息
+        $config = [
+            'site'           => array_intersect_key($site, array_flip(['name', 'cdnurl', 'version', 'timezone', 'languages'])),
+            'upload'         => null,
+            'modulename'     => 'addons',
+            'controllername' => 'index',
+            'actionname'     => 'index',
+            'jsname'         => 'addons/address',
+            'moduleurl'      => '',
+            'language'       => $lang
+        ];
+        $config = array_merge($config, Config::get("view_replace_str"));
+
+        // 配置信息后
+        Hook::listen("config_init", $config);
+        // 加载当前控制器语言包
+        $this->view->assign('site', $site);
+        $this->view->assign('config', $config);
+
+        return $this->view->fetch();
+    }
+
+    // 选择地址
+    public function select()
+    {
+        $config = get_addon_config('address');
+        $zoom = (int)$this->request->get('zoom', $config['zoom']);
+        $lng = (float)$this->request->get('lng');
+        $lat = (float)$this->request->get('lat');
+        $address = $this->request->get('address');
+        $lng = $lng ?: $config['lng'];
+        $lat = $lat ?: $config['lat'];
+        $this->view->assign('zoom', $zoom);
+        $this->view->assign('lng', $lng);
+        $this->view->assign('lat', $lat);
+        $this->view->assign('address', $address);
+        $maptype = $config['maptype'];
+        if (!isset($config[$maptype . 'key']) || !$config[$maptype . 'key']) {
+            $this->error("请在配置中配置对应类型地图的密钥");
+        }
+        return $this->view->fetch('index/' . $maptype);
+    }
+
+}

+ 10 - 0
addons/address/info.ini

@@ -0,0 +1,10 @@
+name = address
+title = 地址位置选择插件
+intro = 地图位置选择插件,可返回地址和经纬度
+author = FastAdmin
+website = https://www.fastadmin.net
+version = 1.1.8
+state = 1
+url = /addons/address
+license = regular
+licenseto = 19079

+ 258 - 0
addons/address/view/index/amap.html

@@ -0,0 +1,258 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+    <title>地址选择器</title>
+    <link rel="stylesheet" href="__CDN__/assets/css/frontend.min.css"/>
+    <link rel="stylesheet" href="__CDN__/assets/libs/font-awesome/css/font-awesome.min.css"/>
+    <style type="text/css">
+        body {
+            margin: 0;
+            padding: 0;
+        }
+
+        #container {
+            position: absolute;
+            left: 0;
+            top: 0;
+            right: 0;
+            bottom: 0;
+        }
+
+        .confirm {
+            position: absolute;
+            bottom: 30px;
+            right: 4%;
+            z-index: 99;
+            height: 50px;
+            width: 50px;
+            line-height: 50px;
+            font-size: 15px;
+            text-align: center;
+            background-color: white;
+            background: #1ABC9C;
+            color: white;
+            border: none;
+            cursor: pointer;
+            border-radius: 50%;
+        }
+
+        .search {
+            position: absolute;
+            width: 400px;
+            top: 0;
+            left: 50%;
+            padding: 5px;
+            margin-left: -200px;
+        }
+
+        .amap-marker-label {
+            border: 0;
+            background-color: transparent;
+        }
+
+        .info {
+            padding: .75rem 1.25rem;
+            margin-bottom: 1rem;
+            border-radius: .25rem;
+            position: fixed;
+            top: 2rem;
+            background-color: white;
+            width: auto;
+            min-width: 22rem;
+            border-width: 0;
+            left: 1.8rem;
+            box-shadow: 0 2px 6px 0 rgba(114, 124, 245, .5);
+        }
+    </style>
+</head>
+<body>
+<div class="search">
+    <div class="input-group">
+        <input type="text" id="place" name="q" class="form-control" placeholder="输入地点"/>
+        <span class="input-group-btn">
+            <button type="submit" name="search" id="search-btn" class="btn btn-success">
+                <i class="fa fa-search"></i>
+            </button>
+        </span>
+    </div>
+</div>
+<div class="confirm">确定</div>
+<div id="container"></div>
+<script type="text/javascript">
+    window._AMapSecurityConfig = {
+        securityJsCode: "{$config.amapsecurityjscode|default=''}",
+    }
+</script>
+<script type="text/javascript" src="//webapi.amap.com/maps?v=1.4.11&key={$config.amapkey|default=''}&plugin=AMap.ToolBar,AMap.Autocomplete,AMap.PlaceSearch,AMap.Geocoder"></script>
+<!-- UI组件库 1.0 -->
+<script src="//webapi.amap.com/ui/1.0/main.js?v=1.0.11"></script>
+<script src="__CDN__/assets/libs/jquery/dist/jquery.min.js"></script>
+<script src="__CDN__/assets/addons/address/js/gcoord.min.js"></script>
+<script type="text/javascript">
+    $(function () {
+        var as, map, geocoder, address, fromtype, totype;
+        address = "{$address|htmlentities}";
+        var lng = Number("{$lng}");
+        var lat = Number("{$lat}");
+        fromtype = "GCJ02";
+        totype = "{$config.coordtype|default='DEFAULT'}"
+        totype = totype === 'DEFAULT' ? "GCJ02" : totype;
+
+        if (lng && lat && fromtype !== totype) {
+            var result = gcoord.transform([lng, lat], gcoord[totype], gcoord[fromtype]);
+            lng = result[0] || lng;
+            lat = result[1] || lat;
+        }
+
+        var init = function () {
+            AMapUI.loadUI(['misc/PositionPicker', 'misc/PoiPicker'], function (PositionPicker, PoiPicker) {
+                //加载PositionPicker,loadUI的路径参数为模块名中 'ui/' 之后的部分
+                map = new AMap.Map('container', {
+                    zoom: parseInt('{$zoom}'),
+                    center: [lng, lat]
+                });
+                geocoder = new AMap.Geocoder({
+                    radius: 1000 //范围,默认:500
+                });
+                var positionPicker = new PositionPicker({
+                    mode: 'dragMarker',//设定为拖拽地图模式,可选'dragMap'、'dragMarker',默认为'dragMap'
+                    map: map//依赖地图对象
+                });
+                //输入提示
+                var autoOptions = {
+                    input: "place"
+                };
+
+                var relocation = function (lnglat, addr) {
+                    lng = lnglat.lng;
+                    lat = lnglat.lat;
+                    map.panTo([lng, lat]);
+                    positionPicker.start(lnglat);
+                    if (addr) {
+                        // var label = '<div class="info">地址:' + addr + '<br>经度:' + lng + '<br>纬度:' + lat + '</div>';
+                        var label = '<div class="info">地址:' + addr + '</div>';
+                        positionPicker.marker.setLabel({
+                            content: label //显示内容
+                        });
+                    } else {
+                        geocoder.getAddress(lng + ',' + lat, function (status, result) {
+                            if (status === 'complete' && result.regeocode) {
+                                var address = result.regeocode.formattedAddress;
+                                // var label = '<div class="info">地址:' + address + '<br>经度:' + lng + '<br>纬度:' + lat + '</div>';
+                                var label = '<div class="info">地址:' + address + '</div>';
+                                positionPicker.marker.setLabel({
+                                    content: label //显示内容
+                                });
+                            } else {
+                                console.log(JSON.stringify(result));
+                            }
+                        });
+                    }
+                };
+                var auto = new AMap.Autocomplete(autoOptions);
+
+                //构造地点查询类
+                var placeSearch = new AMap.PlaceSearch({
+                    map: map
+                });
+                //注册监听,当选中某条记录时会触发
+                AMap.event.addListener(auto, "select", function (e) {
+                    placeSearch.setCity(e.poi.adcode);
+                    placeSearch.search(e.poi.name, function (status, result) {
+                        $(map.getAllOverlays("marker")).each(function (i, j) {
+                            j.on("click", function () {
+                                relocation(j.De.position);
+                            });
+                        });
+                    });  //关键字查询查询
+                });
+                AMap.event.addListener(map, 'click', function (e) {
+                    relocation(e.lnglat);
+                });
+
+                //加载工具条
+                var tool = new AMap.ToolBar();
+                map.addControl(tool);
+
+                var poiPicker = new PoiPicker({
+                    input: 'place',
+                    placeSearchOptions: {
+                        map: map,
+                        pageSize: 6 //关联搜索分页
+                    }
+                });
+                poiPicker.on('poiPicked', function (poiResult) {
+                    poiPicker.hideSearchResults();
+                    $('.poi .nearpoi').text(poiResult.item.name);
+                    $('.address .info').text(poiResult.item.address);
+                    $('#address').val(poiResult.item.address);
+                    $("#place").val(poiResult.item.name);
+
+                    relocation(poiResult.item.location);
+                });
+
+                positionPicker.on('success', function (positionResult) {
+                    console.log(positionResult);
+                    as = positionResult.position;
+                    address = positionResult.address;
+                    lat = as.lat;
+                    lng = as.lng;
+                });
+                positionPicker.on('fail', function (positionResult) {
+                    address = '';
+                });
+                positionPicker.start();
+
+                if (address) {
+                    // 添加label
+                    var label = '<div class="info">地址:' + address + '</div>';
+                    positionPicker.marker.setLabel({
+                        content: label //显示内容
+                    });
+                }
+
+                //点击搜索按钮
+                $(document).on('click', '#search-btn', function () {
+                    if ($("#place").val() == '')
+                        return;
+                    placeSearch.search($("#place").val(), function (status, result) {
+                        $(map.getAllOverlays("marker")).each(function (i, j) {
+                            j.on("click", function () {
+                                relocation(j.De.position);
+                            });
+                        });
+                    });
+                });
+            });
+        };
+
+        //点击确定后执行回调赋值
+        var close = function (data) {
+            var index = parent.Layer.getFrameIndex(window.name);
+            var callback = parent.$("#layui-layer" + index).data("callback");
+            //再执行关闭
+            parent.Layer.close(index);
+            //再调用回传函数
+            if (typeof callback === 'function') {
+                callback.call(undefined, data);
+            }
+        };
+
+        //点击搜索按钮
+        $(document).on('click', '.confirm', function () {
+            var zoom = map.getZoom();
+            var data = {lat: lat, lng: lng, zoom: zoom, address: address};
+            if (fromtype !== totype) {
+                var result = gcoord.transform([data.lng, data.lat], gcoord[fromtype], gcoord[totype]);
+                data.lng = (result[0] || data.lng).toFixed(5);
+                data.lat = (result[1] || data.lat).toFixed(5);
+                console.log(data, result, fromtype, totype);
+            }
+            close(data);
+        });
+        init();
+    });
+</script>
+</body>
+</html>

+ 243 - 0
addons/address/view/index/baidu.html

@@ -0,0 +1,243 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+    <title>地址选择器</title>
+    <link rel="stylesheet" href="__CDN__/assets/css/frontend.min.css"/>
+    <link rel="stylesheet" href="__CDN__/assets/libs/font-awesome/css/font-awesome.min.css"/>
+    <style type="text/css">
+        body {
+            margin: 0;
+            padding: 0;
+        }
+
+        #container {
+            position: absolute;
+            left: 0;
+            top: 0;
+            right: 0;
+            bottom: 0;
+        }
+
+        .confirm {
+            position: absolute;
+            bottom: 30px;
+            right: 4%;
+            z-index: 99;
+            height: 50px;
+            width: 50px;
+            line-height: 50px;
+            font-size: 15px;
+            text-align: center;
+            background-color: white;
+            background: #1ABC9C;
+            color: white;
+            border: none;
+            cursor: pointer;
+            border-radius: 50%;
+        }
+
+        .search {
+            position: absolute;
+            width: 400px;
+            top: 0;
+            left: 50%;
+            padding: 5px;
+            margin-left: -200px;
+        }
+
+        label.BMapLabel {
+            max-width: inherit;
+            padding: .75rem 1.25rem;
+            margin-bottom: 1rem;
+            background-color: white;
+            width: auto;
+            min-width: 22rem;
+            border: none;
+            box-shadow: 0 2px 6px 0 rgba(114, 124, 245, .5);
+        }
+
+    </style>
+</head>
+<body>
+<div class="search">
+    <div class="input-group">
+        <input type="text" id="place" name="q" class="form-control" placeholder="输入地点"/>
+        <div id="searchResultPanel" style="border:1px solid #C0C0C0;width:150px;height:auto; display:none;"></div>
+        <span class="input-group-btn">
+            <button type="button" name="search" id="search-btn" class="btn btn-success">
+                <i class="fa fa-search"></i>
+            </button>
+        </span>
+    </div>
+</div>
+<div class="confirm">确定</div>
+<div id="container"></div>
+<script type="text/javascript" src="//api.map.baidu.com/api?v=2.0&ak={$config.baidukey|default=''}"></script>
+<script src="__CDN__/assets/libs/jquery/dist/jquery.min.js"></script>
+<script src="__CDN__/assets/addons/address/js/gcoord.min.js"></script>
+<script type="text/javascript">
+    $(function () {
+        var map, marker, point, fromtype, totype;
+        var zoom = parseInt("{$zoom}");
+        var address = "{$address|htmlentities}";
+        var lng = Number("{$lng}");
+        var lat = Number("{$lat}");
+        fromtype = "BD09";
+        totype = "{$config.coordtype|default='DEFAULT'}"
+        totype = totype === 'DEFAULT' ? "BD09" : totype;
+
+        if (lng && lat && fromtype !== totype) {
+            var result = gcoord.transform([lng, lat], gcoord[totype], gcoord[fromtype]);
+            lng = result[0] || lng;
+            lat = result[1] || lat;
+        }
+
+        var geocoder = new BMap.Geocoder();
+
+        var addPointMarker = function (point, addr) {
+            deletePoint();
+            addPoint(point);
+
+            if (addr) {
+                addMarker(point, addr);
+            } else {
+                geocoder.getLocation(point, function (rs) {
+                    addMarker(point, rs.address);
+                });
+            }
+
+        };
+
+        var addPoint = function (point) {
+            lng = point.lng;
+            lat = point.lat;
+            marker = new BMap.Marker(point);
+            map.addOverlay(marker);
+            map.panTo(point);
+        };
+
+        var addMarker = function (point, addr) {
+            address = addr;
+            // var labelhtml = '<div class="info">地址:' + address + '<br>经度:' + point.lng + '<br>纬度:' + point.lat + '</div>';
+            var labelhtml = '<div class="info">地址:' + address + '</div>';
+            var label = new BMap.Label(labelhtml, {offset: new BMap.Size(16, 20)});
+            label.setStyle({
+                border: 'none',
+                padding: '.75rem 1.25rem'
+            });
+            marker.setLabel(label);
+        };
+
+        var deletePoint = function () {
+            var allOverlay = map.getOverlays();
+            for (var i = 0; i < allOverlay.length; i++) {
+                map.removeOverlay(allOverlay[i]);
+            }
+        };
+
+        var init = function () {
+            map = new BMap.Map("container"); // 创建地图实例
+            var point = new BMap.Point(lng, lat); // 创建点坐标
+            map.enableScrollWheelZoom(true); //开启鼠标滚轮缩放
+            map.centerAndZoom(point, zoom); // 初始化地图,设置中心点坐标和地图级别
+
+            var size = new BMap.Size(10, 20);
+            map.addControl(new BMap.CityListControl({
+                anchor: BMAP_ANCHOR_TOP_LEFT,
+                offset: size,
+            }));
+
+            if ("{$lng}" != '' && "{$lat}" != '') {
+                addPointMarker(point, address);
+            }
+
+            ac = new BMap.Autocomplete({"input": "place", "location": map}); //建立一个自动完成的对象
+            ac.addEventListener("onhighlight", function (e) {  //鼠标放在下拉列表上的事件
+                var str = "";
+                var _value = e.fromitem.value;
+                var value = "";
+                if (e.fromitem.index > -1) {
+                    value = _value.province + _value.city + _value.district + _value.street + _value.business;
+                }
+                str = "FromItem<br />index = " + e.fromitem.index + "<br />value = " + value;
+
+                value = "";
+                if (e.toitem.index > -1) {
+                    _value = e.toitem.value;
+                    value = _value.province + _value.city + _value.district + _value.street + _value.business;
+                }
+                str += "<br />ToItem<br />index = " + e.toitem.index + "<br />value = " + value;
+                $("#searchResultPanel").html(str);
+            });
+            ac.addEventListener("onconfirm", function (e) {    //鼠标点击下拉列表后的事件
+                var _value = e.item.value;
+                myValue = _value.province + _value.city + _value.district + _value.street + _value.business;
+                $("#searchResultPanel").html("onconfirm<br />index = " + e.item.index + "<br />myValue = " + myValue);
+                setPlace();
+            });
+
+            function setPlace(text) {
+                map.clearOverlays();    //清除地图上所有覆盖物
+                function myFun() {
+                    var results = local.getResults();
+                    var result = local.getResults().getPoi(0);
+                    var point = result.point;    //获取第一个智能搜索的结果
+                    map.centerAndZoom(point, 18);
+                    // map.addOverlay(new BMap.Marker(point));    //添加标注
+                    if (result.type != 0) {
+                        address = results.province + results.city + result.address;
+                    } else {
+                        address = result.address;
+                    }
+                    addPointMarker(point, address);
+                }
+
+                var local = new BMap.LocalSearch(map, { //智能搜索
+                    onSearchComplete: myFun
+                });
+                local.search(text || myValue);
+            }
+
+            map.addEventListener("click", function (e) {
+                //通过点击百度地图,可以获取到对应的point, 由point的lng、lat属性就可以获取对应的经度纬度
+                addPointMarker(e.point);
+            });
+
+            //点击搜索按钮
+            $(document).on('click', '#search-btn', function () {
+                if ($("#place").val() == '')
+                    return;
+                setPlace($("#place").val());
+            });
+        };
+
+        var close = function (data) {
+            var index = parent.Layer.getFrameIndex(window.name);
+            var callback = parent.$("#layui-layer" + index).data("callback");
+            //再执行关闭
+            parent.Layer.close(index);
+            //再调用回传函数
+            if (typeof callback === 'function') {
+                callback.call(undefined, data);
+            }
+        };
+
+        //点击确定后执行回调赋值
+        $(document).on('click', '.confirm', function () {
+            var zoom = map.getZoom();
+            var data = {lat: lat, lng: lng, zoom: zoom, address: address};
+            if (fromtype !== totype) {
+                var result = gcoord.transform([data.lng, data.lat], gcoord[fromtype], gcoord[totype]);
+                data.lng = (result[0] || data.lng).toFixed(5);
+                data.lat = (result[1] || data.lat).toFixed(5);
+                console.log(data, result, fromtype, totype);
+            }
+            close(data);
+        });
+
+        init();
+    });
+</script>
+</body>
+</html>

+ 132 - 0
addons/address/view/index/index.html

@@ -0,0 +1,132 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
+    <title>地图位置(经纬度)选择插件</title>
+    <link rel="stylesheet" href="__CDN__/assets/css/frontend.min.css"/>
+    <link rel="stylesheet" href="__CDN__/assets/libs/font-awesome/css/font-awesome.min.css"/>
+</head>
+<body>
+<div class="container">
+
+    <div class="bs-docs-section clearfix">
+        <div class="row">
+            <div class="col-lg-12">
+                <div class="page-header">
+                    <h2>地图位置(经纬度)选择示例</h2>
+                </div>
+
+                <div class="bs-component">
+                    <form action="" method="post" role="form">
+                        <div class="form-group">
+                            <label for=""></label>
+                            <input type="text" class="form-control" name="" id="address" placeholder="地址">
+                        </div>
+                        <div class="form-group">
+                            <label for=""></label>
+                            <input type="text" class="form-control" name="" id="lng" placeholder="经度">
+                        </div>
+                        <div class="form-group">
+                            <label for=""></label>
+                            <input type="text" class="form-control" name="" id="lat" placeholder="纬度">
+                        </div>
+                        <div class="form-group">
+                            <label for=""></label>
+                            <input type="text" class="form-control" name="" id="zoom" placeholder="缩放">
+                        </div>
+
+                        <button type="button" class="btn btn-primary" data-toggle='addresspicker' data-input-id="address" data-lng-id="lng" data-lat-id="lat" data-zoom-id="zoom">点击选择</button>
+                    </form>
+                </div>
+
+                <div class="page-header">
+                    <h2 id="code">调用代码</h2>
+                </div>
+                <div class="bs-component">
+                        <textarea class="form-control" rows="17">
+                            <form action="" method="post" role="form">
+                                <div class="form-group">
+                                    <label for=""></label>
+                                    <input type="text" class="form-control" name="" id="address" placeholder="地址">
+                                </div>
+                                <div class="form-group">
+                                    <label for=""></label>
+                                    <input type="text" class="form-control" name="" id="lng" placeholder="经度">
+                                </div>
+                                <div class="form-group">
+                                    <label for=""></label>
+                                    <input type="text" class="form-control" name="" id="lat" placeholder="纬度">
+                                </div>
+                                <div class="form-group">
+                                    <label for=""></label>
+                                    <input type="text" class="form-control" name="" id="zoom" placeholder="缩放">
+                                </div>
+
+                                <button type="button" class="btn btn-primary" data-toggle='addresspicker' data-input-id="address" data-lng-id="lng" data-lat-id="lat" data-zoom-id="zoom">点击选择</button>
+                            </form>
+                        </textarea>
+                </div>
+                <div class="page-header">
+                    <h2>参数说明</h2>
+                </div>
+
+                <div class="bs-component" style="background:#fff;">
+                    <table class="table table-bordered">
+                        <thead>
+                        <tr>
+                            <th>参数</th>
+                            <th>释义</th>
+                        </tr>
+                        </thead>
+                        <tbody>
+                        <tr>
+                            <td>data-input-id</td>
+                            <td>填充地址的文本框ID</td>
+                        </tr>
+                        <tr>
+                            <td>data-lng-id</td>
+                            <td>填充经度的文本框ID</td>
+                        </tr>
+                        <tr>
+                            <td>data-lat-id</td>
+                            <td>填充纬度的文本框ID</td>
+                        </tr>
+                        <tr>
+                            <td>data-zoom-id</td>
+                            <td>填充缩放的文本框ID</td>
+                        </tr>
+                        </tbody>
+                    </table>
+                </div>
+
+            </div>
+        </div>
+    </div>
+
+</div>
+<!--@formatter:off-->
+<script type="text/javascript">
+    var require = {
+        config: {$config|json_encode}
+    };
+</script>
+<!--@formatter:on-->
+
+<script>
+    require.callback = function () {
+        define('addons/address', ['jquery', 'bootstrap', 'frontend', 'template'], function ($, undefined, Frontend, Template) {
+            var Controller = {
+                index: function () {
+                }
+            };
+            return Controller;
+        });
+        define('lang', function () {
+            return [];
+        });
+    }
+</script>
+
+<script src="__CDN__/assets/js/require.min.js" data-main="__CDN__/assets/js/require-frontend.min.js?v={$site.version}"></script>
+</body>
+</html>

+ 291 - 0
addons/address/view/index/tencent.html

@@ -0,0 +1,291 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+    <title>地址选择器</title>
+    <link rel="stylesheet" href="__CDN__/assets/css/frontend.min.css"/>
+    <link rel="stylesheet" href="__CDN__/assets/libs/font-awesome/css/font-awesome.min.css"/>
+    <style type="text/css">
+        body {
+            margin: 0;
+            padding: 0;
+        }
+
+        #container {
+            position: absolute;
+            left: 0;
+            top: 0;
+            right: 0;
+            bottom: 0;
+        }
+
+        .confirm {
+            position: absolute;
+            bottom: 30px;
+            right: 4%;
+            z-index: 99;
+            height: 50px;
+            width: 50px;
+            line-height: 50px;
+            font-size: 15px;
+            text-align: center;
+            background-color: white;
+            background: #1ABC9C;
+            color: white;
+            border: none;
+            cursor: pointer;
+            border-radius: 50%;
+        }
+
+        .search {
+            position: absolute;
+            width: 400px;
+            top: 0;
+            left: 50%;
+            padding: 5px;
+            margin-left: -200px;
+        }
+
+        .autocomplete-search {
+            text-align: left;
+            cursor: default;
+            background: #fff;
+            border-radius: 2px;
+            -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
+            -moz-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
+            box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
+            background-clip: padding-box;
+            position: absolute;
+            display: none;
+            z-index: 1036;
+            max-height: 254px;
+            overflow: hidden;
+            overflow-y: auto;
+            box-sizing: border-box;
+        }
+
+        .autocomplete-search .autocomplete-suggestion {
+            padding: 5px;
+        }
+
+        .autocomplete-search .autocomplete-suggestion:hover {
+            background: #f0f0f0;
+        }
+    </style>
+</head>
+<body>
+<div class="search">
+    <div class="input-group">
+        <input type="text" id="place" name="q" class="form-control" placeholder="输入地点"/>
+        <span class="input-group-btn">
+            <button type="button" name="search" id="search-btn" class="btn btn-success">
+                <i class="fa fa-search"></i>
+            </button>
+        </span>
+    </div>
+</div>
+<div class="confirm">确定</div>
+<div id="container"></div>
+
+<script charset="utf-8" src="//map.qq.com/api/js?v=2.exp&libraries=place&key={$config.tencentkey|default=''}"></script>
+<script src="__CDN__/assets/libs/jquery/dist/jquery.min.js"></script>
+<script src="__CDN__/assets/addons/address/js/gcoord.min.js"></script>
+<script src="__CDN__/assets/addons/address/js/jquery.autocomplete.js"></script>
+
+<script type="text/javascript">
+    $(function () {
+        var map, marker, geocoder, infoWin, searchService, keyword, address, fromtype, totype;
+        address = "{$address|htmlentities}";
+        var lng = Number("{$lng}");
+        var lat = Number("{$lat}");
+        fromtype = "GCJ02";
+        totype = "{$config.coordtype|default='DEFAULT'}"
+        totype = totype === 'DEFAULT' ? "GCJ02" : totype;
+
+        if (lng && lat && fromtype !== totype) {
+            var result = gcoord.transform([lng, lat], gcoord[totype], gcoord[fromtype]);
+            lng = result[0] || lng;
+            lat = result[1] || lat;
+        }
+
+        var init = function () {
+            var center = new qq.maps.LatLng(lat, lng);
+            map = new qq.maps.Map(document.getElementById('container'), {
+                center: center,
+                zoom: parseInt("{$config.zoom}")
+            });
+
+            //实例化信息窗口
+            infoWin = new qq.maps.InfoWindow({
+                map: map
+            });
+
+            geocoder = {
+                getAddress: function (latLng) {
+                    $.ajax({
+                        url: "https://apis.map.qq.com/ws/geocoder/v1/?location=" + latLng.lat + "," + latLng.lng + "&key={$config.tencentkey|default=''}&output=jsonp",
+                        dataType: "jsonp",
+                        type: 'GET',
+                        cache: true,
+                        crossDomain: true,
+                        success: function (ret) {
+                            console.log("getAddress:", ret)
+                            if (ret.status === 0) {
+                                var component = ret.result.address_component;
+                                if (ret.result.formatted_addresses && ret.result.formatted_addresses.recommend) {
+                                    var recommend = ret.result.formatted_addresses.recommend;
+                                    var standard_address = ret.result.formatted_addresses.standard_address;
+                                    var address = component.province !== component.city ? component.province + component.city : component.province;
+
+                                    address = address + (recommend.indexOf(component.district) === 0 ? '' : component.district) + recommend;
+                                } else {
+                                    address = ret.result.address;
+                                }
+                                showMarker(ret.result.location, address);
+                                showInfoWin(ret.result.location, address);
+                            }
+                        },
+                        error: function (e) {
+                            console.log(e, 'error')
+                        }
+                    });
+                }
+            };
+
+            //初始化marker
+            showMarker(center);
+            if (address) {
+                showInfoWin(center, address);
+            } else {
+                geocoder.getAddress(center);
+            }
+
+            var place = $("#place");
+            place.autoComplete({
+                minChars: 1,
+                cache: 0,
+                menuClass: 'autocomplete-search',
+                source: function (term, response) {
+                    try {
+                        xhr.abort();
+                    } catch (e) {
+                    }
+                    xhr = $.ajax({
+                        url: "https://apis.map.qq.com/ws/place/v1/suggestion?keyword=" + term + "&key={$config.tencentkey|default=''}&output=jsonp",
+                        dataType: "jsonp",
+                        type: 'GET',
+                        cache: true,
+                        success: function (ret) {
+                            if (ret.status === 0) {
+                                if(ret.data.length === 0){
+                                    $(".autocomplete-suggestions.autocomplete-search").html('');
+                                }
+                                response(ret.data);
+                            } else {
+                                console.log(ret);
+                            }
+                        }
+                    });
+                },
+                renderItem: function (item, search) {
+                    search = search.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
+                    var regexp = new RegExp("(" + search.replace(/[\,|\u3000|\uff0c]/, ' ').split(' ').join('|') + ")", "gi");
+                    return "<div class='autocomplete-suggestion' data-item='" + JSON.stringify(item) + "' data-title='" + item.title + "' data-val='" + item.title + "'>" + item.title.replace(regexp, "<b>$1</b>") + "</div>";
+                },
+                onSelect: function (e, term, sel) {
+                    e.preventDefault();
+                    var item = $(sel).data("item");
+                    //调用获取位置方法
+                    geocoder.getAddress(item.location);
+
+                    var position = new qq.maps.LatLng(item.location.lat, item.location.lng);
+                    map.setCenter(position);
+                }
+            });
+
+            //地图点击
+            qq.maps.event.addListener(map, 'click', function (event) {
+                    try {
+                        //调用获取位置方法
+                        geocoder.getAddress(event.latLng);
+                    } catch (e) {
+                        console.log(e);
+                    }
+                }
+            );
+        };
+
+        //显示info窗口
+        var showInfoWin = function (latLng, title) {
+            var position = new qq.maps.LatLng(latLng.lat, latLng.lng);
+            infoWin.open();
+            infoWin.setContent(title);
+            infoWin.setPosition(position);
+        };
+
+        //实例化marker和监听拖拽结束事件
+        var showMarker = function (latLng, title) {
+            console.log("showMarker", latLng, title)
+            var position = new qq.maps.LatLng(latLng.lat, latLng.lng);
+            marker && marker.setMap(null);
+            marker = new qq.maps.Marker({
+                map: map,
+                position: position,
+                draggable: true,
+                title: title || '拖动图标选择位置'
+            });
+
+            //监听拖拽结束
+            qq.maps.event.addListener(marker, 'dragend', function (event) {
+                //调用获取位置方法
+                geocoder.getAddress(event.latLng);
+            });
+        };
+
+        var close = function (data) {
+            var index = parent.Layer.getFrameIndex(window.name);
+            var callback = parent.$("#layui-layer" + index).data("callback");
+            //再执行关闭
+            parent.Layer.close(index);
+            //再调用回传函数
+            if (typeof callback === 'function') {
+                callback.call(undefined, data);
+            }
+        };
+
+        //点击确定后执行回调赋值
+        $(document).on('click', '.confirm', function () {
+            var zoom = map.getZoom();
+            var data = {lat: infoWin.position.lat.toFixed(5), lng: infoWin.position.lng.toFixed(5), zoom: zoom, address: infoWin.content};
+            if (fromtype !== totype) {
+                var result = gcoord.transform([data.lng, data.lat], gcoord[fromtype], gcoord[totype]);
+                data.lng = (result[0] || data.lng).toFixed(5);
+                data.lat = (result[1] || data.lat).toFixed(5);
+                console.log(data, result, fromtype, totype);
+            }
+
+            close(data);
+        });
+
+        //点击搜索按钮
+        $(document).on('click', '#search-btn', function () {
+            if ($("#place").val() === '')
+                return;
+            var first = $(".autocomplete-search > .autocomplete-suggestion:first");
+            if (!first.length) {
+                return;
+            }
+            var item = first.data("item");
+
+            //调用获取位置方法
+            geocoder.getAddress(item.location);
+
+            var position = new qq.maps.LatLng(item.location.lat, item.location.lng);
+            map.setCenter(position);
+        });
+
+        init();
+    });
+</script>
+</body>
+</html>

+ 6 - 0
application/admin/view/store/add.html

@@ -65,6 +65,12 @@
         </div>
     </div>
     <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">坐标选择器:</label>
+        <div class="col-xs-12 col-sm-8">
+            <button type="button" class="btn btn-primary" data-toggle="addresspicker" data-input-id="address" data-lng-id="c-longitude" data-lat-id="c-latitude">选择</button>
+        </div>
+    </div>
+    <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Longitude')}:</label>
         <div class="col-xs-12 col-sm-8">
             <input id="c-longitude" class="form-control" name="row[longitude]" type="text" value="0">

+ 6 - 0
application/admin/view/store/edit.html

@@ -65,6 +65,12 @@
         </div>
     </div>
     <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">坐标选择器:</label>
+        <div class="col-xs-12 col-sm-8">
+            <button type="button" class="btn btn-primary" data-toggle="addresspicker" data-input-id="address" data-lng-id="c-longitude" data-lat-id="c-latitude">选择</button>
+        </div>
+    </div>
+    <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Longitude')}:</label>
         <div class="col-xs-12 col-sm-8">
             <input id="c-longitude" class="form-control" name="row[longitude]" type="text" value="{$row.longitude|htmlentities}">

Diferenças do arquivo suprimidas por serem muito extensas
+ 5 - 0
public/assets/addons/address/js/gcoord.min.js


+ 215 - 0
public/assets/addons/address/js/jquery.autocomplete.js

@@ -0,0 +1,215 @@
+/*
+	jQuery autoComplete v1.0.7
+    Copyright (c) 2014 Simon Steinberger / Pixabay
+    GitHub: https://github.com/Pixabay/jQuery-autoComplete
+	License: http://www.opensource.org/licenses/mit-license.php
+*/
+
+(function ($) {
+    $.fn.autoComplete = function (options) {
+        var o = $.extend({}, $.fn.autoComplete.defaults, options);
+
+        // public methods
+        if (typeof options == 'string') {
+            this.each(function () {
+                var that = $(this);
+                if (options == 'destroy') {
+                    $(window).off('resize.autocomplete', that.updateSC);
+                    that.off('blur.autocomplete focus.autocomplete keydown.autocomplete keyup.autocomplete');
+                    if (that.data('autocomplete'))
+                        that.attr('autocomplete', that.data('autocomplete'));
+                    else
+                        that.removeAttr('autocomplete');
+                    $(that.data('sc')).remove();
+                    that.removeData('sc').removeData('autocomplete');
+                }
+            });
+            return this;
+        }
+
+        return this.each(function () {
+            var that = $(this);
+            // sc = 'suggestions container'
+            that.sc = $('<div class="autocomplete-suggestions ' + o.menuClass + '"></div>');
+            that.data('sc', that.sc).data('autocomplete', that.attr('autocomplete'));
+            that.attr('autocomplete', 'off');
+            that.cache = {};
+            that.last_val = '';
+
+            that.updateSC = function (resize, next) {
+                that.sc.css({
+                    top: that.offset().top + that.outerHeight() - (that.sc.css("position") == "fixed" ? $(window).scrollTop() : 0),
+                    left: that.offset().left,
+                    width: that.outerWidth()
+                });
+                if (!resize) {
+                    that.sc.show();
+                    if (!that.sc.maxHeight) that.sc.maxHeight = parseInt(that.sc.css('max-height'));
+                    if (!that.sc.suggestionHeight) that.sc.suggestionHeight = $('.autocomplete-suggestion', that.sc).first().outerHeight();
+                    if (that.sc.suggestionHeight)
+                        if (!next) that.sc.scrollTop(0);
+                        else {
+                            var scrTop = that.sc.scrollTop(), selTop = next.offset().top - that.sc.offset().top;
+                            if (selTop + that.sc.suggestionHeight - that.sc.maxHeight > 0)
+                                that.sc.scrollTop(selTop + that.sc.suggestionHeight + scrTop - that.sc.maxHeight);
+                            else if (selTop < 0)
+                                that.sc.scrollTop(selTop + scrTop);
+                        }
+                }
+            }
+            $(window).on('resize.autocomplete', that.updateSC);
+
+            that.sc.appendTo('body');
+
+            that.on('click', function () {
+                if ($(this).val().length > 0 && that.sc.is(":hidden")) {
+                    setTimeout(function () {
+                        that.sc.show();
+                    }, 100);
+                }
+            });
+
+            that.sc.on('mouseleave', '.autocomplete-suggestion', function () {
+                $('.autocomplete-suggestion.selected').removeClass('selected');
+            });
+
+            that.sc.on('mouseenter', '.autocomplete-suggestion', function () {
+                $('.autocomplete-suggestion.selected').removeClass('selected');
+                $(this).addClass('selected');
+            });
+
+            that.sc.on('mousedown click', '.autocomplete-suggestion', function (e) {
+                var item = $(this), v = item.data('val');
+                if (v || item.hasClass('autocomplete-suggestion')) { // else outside click
+                    that.val(v);
+                    o.onSelect(e, v, item);
+                    that.sc.hide();
+                }
+                return false;
+            });
+
+            that.on('blur.autocomplete', function () {
+                try {
+                    over_sb = $('.autocomplete-suggestions:hover').length;
+                } catch (e) {
+                    over_sb = 0;
+                } // IE7 fix :hover
+                if (!over_sb) {
+                    that.last_val = that.val();
+                    that.sc.hide();
+                    setTimeout(function () {
+                        that.sc.hide();
+                    }, 350); // hide suggestions on fast input
+                } else if (!that.is(':focus')) setTimeout(function () {
+                    that.focus();
+                }, 20);
+            });
+
+            if (!o.minChars) that.on('focus.autocomplete', function () {
+                that.last_val = '\n';
+                that.trigger('keyup.autocomplete');
+            });
+
+            function suggest(data) {
+                var val = that.val();
+                that.cache[val] = data;
+                if (data.length && val.length >= o.minChars) {
+                    var s = '';
+                    if (data.length > 0) {
+                        s += typeof o.header === 'function' ? o.header.call(data, o, that) : o.header;
+                        for (var i = 0; i < data.length; i++) s += o.renderItem(data[i], val);
+                        s += typeof o.footer === 'function' ? o.footer.call(data, o, that) : o.footer;
+                    }
+                    that.sc.html(s);
+                    that.updateSC(0);
+                } else
+                    that.sc.hide();
+            }
+
+            that.on('keydown.autocomplete', function (e) {
+                // down (40), up (38)
+                if ((e.which == 40 || e.which == 38) && that.sc.html()) {
+                    var next, sel = $('.autocomplete-suggestion.selected', that.sc);
+                    if (!sel.length) {
+                        next = (e.which == 40) ? $('.autocomplete-suggestion', that.sc).first() : $('.autocomplete-suggestion', that.sc).last();
+                        that.val(next.addClass('selected').data('val'));
+                    } else {
+                        next = (e.which == 40) ? sel.next('.autocomplete-suggestion') : sel.prev('.autocomplete-suggestion');
+                        if (next.length) {
+                            sel.removeClass('selected');
+                            that.val(next.addClass('selected').data('val'));
+                        } else {
+                            sel.removeClass('selected');
+                            that.val(that.last_val);
+                            next = 0;
+                        }
+                    }
+                    that.updateSC(0, next);
+                    return false;
+                }
+                // esc
+                else if (e.which == 27) that.val(that.last_val).sc.hide();
+                // enter or tab
+                else if (e.which == 13 || e.which == 9) {
+                    var sel = $('.autocomplete-suggestion.selected', that.sc);
+                    if (sel.length && that.sc.is(':visible')) {
+                        o.onSelect(e, sel.data('val'), sel);
+                        setTimeout(function () {
+                            that.sc.hide();
+                        }, 20);
+                    }
+                }
+            });
+
+            that.on('keyup.autocomplete', function (e) {
+                if (!~$.inArray(e.which, [13, 27, 35, 36, 37, 38, 39, 40])) {
+                    var val = that.val();
+                    if (val.length >= o.minChars) {
+                        if (val != that.last_val) {
+                            that.last_val = val;
+                            clearTimeout(that.timer);
+                            if (o.cache) {
+                                if (val in that.cache) {
+                                    suggest(that.cache[val]);
+                                    return;
+                                }
+                                // no requests if previous suggestions were empty
+                                for (var i = 1; i < val.length - o.minChars; i++) {
+                                    var part = val.slice(0, val.length - i);
+                                    if (part in that.cache && !that.cache[part].length) {
+                                        suggest([]);
+                                        return;
+                                    }
+                                }
+                            }
+                            that.timer = setTimeout(function () {
+                                o.source(val, suggest)
+                            }, o.delay);
+                        }
+                    } else {
+                        that.last_val = val;
+                        that.sc.hide();
+                    }
+                }
+            });
+        });
+    }
+
+    $.fn.autoComplete.defaults = {
+        source: 0,
+        minChars: 3,
+        delay: 150,
+        cache: 1,
+        menuClass: '',
+        header: '',
+        footer: '',
+        renderItem: function (item, search) {
+            // escape special characters
+            search = search.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
+            var re = new RegExp("(" + search.split(' ').join('|') + ")", "gi");
+            return '<div class="autocomplete-suggestion" data-val="' + item + '">' + item.replace(re, "<b>$1</b>") + '</div>';
+        },
+        onSelect: function (e, term, item) {
+        }
+    };
+}(jQuery));

+ 36 - 1
public/assets/js/addons.js

@@ -1,5 +1,40 @@
 define([], function () {
-    require.config({
+    require([], function () {
+    //绑定data-toggle=addresspicker属性点击事件
+
+    $(document).on('click', "[data-toggle='addresspicker']", function () {
+        var that = this;
+        var callback = $(that).data('callback');
+        var input_id = $(that).data("input-id") ? $(that).data("input-id") : "";
+        var lat_id = $(that).data("lat-id") ? $(that).data("lat-id") : "";
+        var lng_id = $(that).data("lng-id") ? $(that).data("lng-id") : "";
+        var zoom_id = $(that).data("zoom-id") ? $(that).data("zoom-id") : "";
+        var lat = lat_id ? $("#" + lat_id).val() : '';
+        var lng = lng_id ? $("#" + lng_id).val() : '';
+        var zoom = zoom_id ? $("#" + zoom_id).val() : '';
+        var url = "/addons/address/index/select";
+        url += (lat && lng) ? '?lat=' + lat + '&lng=' + lng + (input_id ? "&address=" + $("#" + input_id).val() : "") + (zoom ? "&zoom=" + zoom : "") : '';
+        Fast.api.open(url, '位置选择', {
+            callback: function (res) {
+                input_id && $("#" + input_id).val(res.address).trigger("change");
+                lat_id && $("#" + lat_id).val(res.lat).trigger("change");
+                lng_id && $("#" + lng_id).val(res.lng).trigger("change");
+                zoom_id && $("#" + zoom_id).val(res.zoom).trigger("change");
+
+                try {
+                    //执行回调函数
+                    if (typeof callback === 'function') {
+                        callback.call(that, res);
+                    }
+                } catch (e) {
+
+                }
+            }
+        });
+    });
+});
+
+require.config({
     paths: {
         'designer': '../addons/poster/js/designer',
         'jquery.contextMenu': '../addons/poster/js/jquery.contextMenu',

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff