Grasp.Today

腾讯地图api接收坐标提交坐标

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>账户管理</title>
    <link href='<!--{$resource_path}-->resource/member/css/style.css' rel="stylesheet" type="text/css" />
    <script src="<!--{$resource_path}-->resource/member/js/jquery.min.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="http://developer.amap.com/Public/css/demo.Default.css" />

    <script type="text/javascript">
        $(document).ready(function () {
            $(".ctmenu").click(function () {
                $(".l_con").toggleClass("l_con1");
                $(".r_con").toggleClass("r_con1");
                $(this).toggleClass("ctmenu1");
            });
        });
</script>
<script>
$(function(){
    function tabs(tabTit,on,tabCon){
        $(tabTit).children().hover(function(){
            $(this).addClass(on).siblings().removeClass(on);
            var index = $(tabTit).children().index(this);
               $(tabCon).children().eq(index).show().siblings().hide();
        });
    };
    tabs(".tab-hd","active",".tab-bd");
});
</script>
</head>
<body onload="initialize()">
<div class="content">
    <div class="l_con">
        <a class="ctmenu"></a>
        <div class="nav_tit">机构详情</div>
        <div class="nav_link"><a href="list" target="r_frame" class="sel">机构信息</a></div>
    </div>
    <div class="r_con">
        <div class="r_tit"><h5>机构信息</h5></div>
        <div class="di_p">请完善以下信息,方便我们更好的为您服务。</div>
        <div class="r_box">
            <form action="/adm/department/saveedit" method="post" id="submitform" name="form1">
            <table class="user_tab">
            <tr>
            <th>机构全称:</th>
            <td><input type="text" value="<!--{$departmentInfo.name}-->" class="user_input" name ="name">&nbsp;<span>*</span></td>
            </tr>
            <tr>
            <th>机构简称:</th>
            <td><input type="text" value="<!--{$departmentInfo.shortname}-->" class="user_input" name ="shortname">&nbsp;<span>*</span></td>
            </tr>    
            <tr>
            <th height="58">组织机构代码:</th>
            <td height="58"><input type="text" value="<!--{$departmentInfo.jigoucode}-->" class="user_input" name ="jigoucode">&nbsp;<span>*</span>
            <p>请正确填写9位组织机构代码证号。</p>
            </td>
            </tr>            
            <tr>
            <th height="58">办公时间:</th>
            <td height="58">
               <input type="text" value="<!--{$departmentInfo.officehours}-->" class="user_input" name ="officehours">&nbsp;<span>*</span><p>
            示例:上午 8:30-11:30 下午 13:30-17:30</p>        
            </td>
            </tr>            
            <tr>
            <th>办公电话:</th>
            <td><input type="text" value="<!--{$departmentInfo.officetel}-->" class="user_input" name ="officetel"></td>
            </tr>  
            <tr>
            <th>办公传真:</th>
            <td><input type="text" value="<!--{$departmentInfo.officefax}-->" class="user_input" name ="officefax">&nbsp;<span>*</span></td>
            </tr>  
            <tr>
            <th>电子邮箱:</th>
            <td> 
                <input type="text" value=" <!--{$departmentInfo.email}-->" class="user_input" name ="email">&nbsp;<span>*</span>
            </td>            
            </tr>            
            <tr>
            <th>邮政编码:</th>
            <td><input type="text" value="<!--{$departmentInfo.postcode}-->" class="user_input" name ="postcode">&nbsp;<span>*</span></td>
            </tr>            
            <tr>
            <th height="58">网站名称及网址:</th>
            <td height="58"><input type="text" value="<!--{$departmentInfo.site}-->" class="user_input" name ="site">&nbsp;-&nbsp;<input type="text" value="<!--{$departmentInfo.url}-->" class="user_input" name ="url">
            <p>示例:中国滨州-http://www.binzhou.gov.cn,如果单位没有网站请填写”无“</p>
            </td>
            </tr>  
            <tr>
            <th>办公地点:</th>
            <td><input type="text" value="<!--{$departmentInfo.address}-->" class="user_input" name ="address">
            </td>
            </tr>  
            <tr>
            <th>交通指引:</th>
            <td>
            <textarea  class="textarea" cols="48" rows="5" name ="traffic"><!--{$departmentInfo.traffic}--></textarea><p>示例:滨州市人民政府</p><p>黄河五路与渤海十五路交叉路北100米西侧;101路、102路公交车市政大楼站</p>
            </td>
            </tr>
            <tr>
                <th>地图标记:</th>
                <td colspan="3">
                    <input type="hidden" name="map_marker" value="<!--{$departmentInfo.maplabes}-->" class="tstyle" />
                    <input type="hidden" name="map_marker_ls" value="" class="tstyle" />
                    <div class="mapview" id="container" style="width:60%; height:300px;"></div>
                    <!--<p id="info" style="margin-top:10px;"></p>-->
                    <div class="mapsave">
                        <input type="button" name="set_marker" id="set_marker" value="设置标记" /><br/>
                        <input type="button" name="set_marker" id="save_marker" value="设置完成" />
                    </div>
                    <div class="clear"></div>
                <span class="intro">说明:1.点击设置标记按钮,操作地图(拖动、缩放)找到对应单位地址单击。
                <br/>   2.点击设置完成按钮。</span>
                </td>
            </tr>
            <tr>
            <th></th>
            <td>
                <input type="hidden" name="id" value="<!--{$departmentInfo.id}-->" />
                <input class="submit" type="submit" name="Submit" value="保存"></td>
            </tr>       
            </table>
            </form>
            <div id="iCenter" style="width: 540px; height: 300px;">
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" src="http://map.qq.com/api/js?v=1"></script>
<script type="text/javascript">
    $(function() {
        var sub = $("input#fabu_submit");//提示显示在该对象后面
        var timer = 1500;//提示显示时间
        var map_marker = $("input[name=map_marker]");
        var map_marker_ls = $("input[name=map_marker_ls]");
        var map_marker_val = map_marker.val();
        var Lng = "<!--{$departmentInfo.y}-->";
        var Lat = "<!--{$departmentInfo.x}-->";
        var str = '';

        //地图部分
        if(map_marker_val != '' && map_marker_val.toString().search(",") > 0){
            var map_val = map_marker.val();
            var map_val2 = map_val.split(",");
            Lng = map_val2[1];
            Lat = map_val2[0];
        }
        var center = new soso.maps.LatLng(Lng,Lat);
        var map = new soso.maps.Map(document.getElementById('container'),{
            center: center,
            zoomLevel: 16,
            scrollWheel: false,
            draggable: false
        });
        var marker = new soso.maps.Marker({
            position: center,
            draggable: false,
            map: map
        });

        //鼠标点击地图时事件
        soso.maps.Event.addListener(map, "click", function(e) {
            var gl=e.latLng;
            if(map.getDraggable()){
                marker.setPosition(gl);
                var ll = gl.getLng() + ',' + gl.getLat();
                map_marker_ls.val(ll);
            }
            //gl.getLat() + ',' + gl.getLng();
            //var ll = marker.getPosition().getLng() + ',' + marker.getPosition().getLat();
            //map_marker_ls.val(ll);
        });

        //创建一个导航控件
        var navControl = new soso.maps.NavigationControl({
            //导航控件的位置
            align: soso.maps.ALIGN.TOP_RIGHT,
            //偏移
            margin: new soso.maps.Size(5, 15),
            //作用对象
            map: map
        });
        $("input#set_marker").bind('click', function(){
            $(this).css('background-color','#CCC');
            $("input#save_marker").css('background-color','#FFF');
            map.setScrollWheel(true);
            map.setDraggable(true);
        });
        $("input#save_marker").bind('click', function(){
            $(this).css('background-color','#CCC');
            $("input#set_marker").css('background-color','#FFF');
            var map_ls_v = map_marker_ls.val();
            map_marker.val(map_ls_v);
            map.setScrollWheel(false);
            map.setDraggable(false);
            marker.setDraggable(false);
        });

        var ws = $("#jgmessage input[name=web_site]");
        //判断网址是否为空,为空自动加http://
        (trim(ws.val()) == '') ? ws.val('http://') : "";

        //页面信息验证部分
        sub.bind('click', function() {
            var agency_name = trim($("#jgmessage input[name=agency_name]").val());
            var agency_short_name = trim($("#jgmessage input[name=agency_short_name]").val());
            var agency_code = trim($("#jgmessage input[name=agency_code]").val());
            var office_time = trim($("#jgmessage input[name=office_time]").val());
            var office_phone = trim($("#jgmessage input[name=office_phone]").val());
            var email_address = trim($("#jgmessage input[name=email_address]").val());
            var post_code = trim($("#jgmessage input[name=post_code]").val());
            var web_name = trim($("#jgmessage input[name=web_name]").val());
            var web_site = trim($("#jgmessage input[name=web_site]").val());
            var office_address = trim($("#jgmessage input[name=office_address]").val());

            var err = '';
            var reg = new RegExp("^[0-9a-zA-Z]{9}$");//字母数字验证

            if(agency_name == ''){
                err += '机构全称不能为空\n\n';
            }

            if(agency_short_name == ''){
                err += '机构简称不能为空\n\n';
            }

            if(agency_code == ''){
                err += '组织机构代码不能为空\n\n';
            } else if(agency_code.length != 9 || reg.test(agency_code) == false) {
                err += '组织机构代码格式输入有误\n\n';
            }

            if(office_time == ''){
                err += '办公时间不能为空\n\n';
            }

            if(office_phone == ''){
                err += '办公电话不能为空\n\n';
            }

            if(email_address == ''){
                err += '电子邮箱不能为空\n\n';
            }

            if(post_code == ''){
                err += '邮政编码不能为空\n\n';
            }

            if(web_name == ''){
                err += '网站名称不能为空\n\n';
            }

            if(web_site == '' || web_site == 'http://'){
                err += '网址不能为空\n\n';
            }

            if(office_address == ''){
                err += '办公地点不能为空\n\n';
            }

            if (err != '') {
                alert(err);
                return false;
            }
        });
    });

</script>
</body>
</html>

 

posted @ 2015-11-26 17:33  gaohj  阅读(3376)  评论(0编辑  收藏  举报