<iframe id="mapPage" width="100%" height="700px" style="margin-top: 80px;display:none" frameborder=0
src="https://apis.map.qq.com/tools/locpicker?search=1&type=1&key=BBJBZ-N7L3O-IXPW2-SRPO4-2JRDH-FOFQ3&referer=120api" >
</iframe>
<div class="content" id ="btn-area">
<div id="photo_update">
<center>
<form enctype="multipart/form-data" method="post" name="upform" id="uploadForm">
<input type="file" style="display:none" id="p_u" onchange = "update_dll()" name = "upfile" accept="image/png,image/gif ,image/jpg,image/jpeg,image/png">
</form>
    <a href="javascript:void(0)" onclick="photo_update()" style="color: white">
	    <i class="fa fa-plus fa-3x"></i><br/>上传封面</center>
    </a>
</div>

    <div class="page-index">
        <div class="card">
    <form action="index.php?c=race&action=race_<?php echo $action; ?>&id=<?php echo $id; ?>" method="post"
      enctype="application/x-www-form-urlencoded" id="form" >
    <table class="table">
        <tr>
            <td width="50">标题</td>
            <td><input type="text" value="<?php echo $result[0]['race_title'] ?>" name="race_title"/></td>
        </tr>
        </table>
       </div>
       <div class="card"> 
        <table id="date">
            <tr>
            <td width="100"><i class="fa fa-clock-o"></i>活动时间</td>
            <td>
            <input type="hidden" value="" id="this_location" name = "location">
            <input type="text" value="<?php echo $result[0]['start_time'] ?>" name="start_time"  placeholder="开始" onclick="WdatePicker({dateFmt:'yyyy-MM-dd H:mm:ss'})" /> 至 
            <input type="text" value="<?php echo $result[0]['end_times'] ?>" name="end_times"  placeholder="结束" onclick="WdatePicker({dateFmt:'yyyy-MM-dd H:mm:ss'})"/></td>
        </tr>
        <tr>
            <td><i class="fa fa-clock-o"></i>报名时间</td>
            <td><input type="text" value="<?php echo $result[0]['sign_start_time'] ?>"   name="sign_start_time"  placeholder="开始" onclick="WdatePicker({dateFmt:'yyyy-MM-dd H:mm:ss'})"/>  至 
            <input type="text" value="<?php echo $result[0]['sign_end_time'] ?>" name="sign_end_time"  placeholder="结束" onclick="WdatePicker({dateFmt:'yyyy-MM-dd H:mm:ss'})"/></td>
        </tr>
        </table>
        </div>
        <div class="card">
        <table class="table">
        <tr>
            <td><i class="fa fa-map-marker"></i>举办地址</td>
            <td><input type="text" value="<?php echo $result[0]['place'] ?>" name="place"  id="this_address"  placeholder="请选择地址" onclick="c();"/></td>
        </tr>
        </table>

</div>
<div class="card">
用户信息<br/>
<div class="form_list">姓名</div>
<div class="form_list">电话</div>
<div class="form_list">证件类型</div>
<div class="form_list">证件号码</div>
<div class="form_list add"><i class="fa fa-plus"></i>增加</div>
</div>
<div class="card">
    <textarea name="contant" rows="5" cols="50" placeholder="活动简介" style="border: none; width:90%"><?php echo $result[0]['contant'] ?></textarea>
</div>
<!--
<div class="card">
   <h3>详细信息</h3>
    <script type="text/javascript" src="plug-in/utf8-php/ueditor.config.js"></script>
    <script type="text/javascript" src="plug-in/utf8-php/ueditor.all.js"></script>
    <script id="contant_c" name="contant_c" type="text/plain">
						<?php echo $result[0]['contant_c'] ?>

                </script>
    <textarea style="display:none" name="contant_c_texteare" id="contant_c_texteare"></textarea>
    <script type="text/javascript">
        var editor = UE.getEditor('contant_c');
        $("#form").submit(function () {
            $("#contant_c_texteare").val(UE.getEditor('contant_c').getContent());
        })
    </script>
    <br/>
    <div style="position:fixed;z-index:1000000;bottom:10px;width:100%;background: white;">
       
  
</div>

  <input type="submit" value="保存" style=" background-color: #00a0e9; width: 300px;"/>-->
</form>
</div>
<script language="javascript">
    function change(v)
    {
        $("#end_time").val(v);
    }

    function submit()
    {
        alert('填写');
        $("#form").submit();
    }

    function photo_update()
    {
		$('#p_u').click();
    }

    function update_dll()
    {
		$.ajax({
		    url:'plug-in/add_upload.php',
		    type: 'POST',
		    cache: false,
		    data: new FormData($('#uploadForm')[0]),
		    processData: false,
		    contentType: false
		}).done(function(res) {
			$('#photo_update').css('background','url('+res+')');
			$('#photo_update').css('background-size','contain');
		}).fail(function(res) {});
    }

	window.addEventListener('message', function(event) {
		// 接收位置信息，用户选择确认位置点后选点组件会触发该事件，回传用户的位置信息
		var loc = event.data;
		if (loc && loc.module == 'locationPicker') {//防止其他应用也会向该页面post信息，需判断module是否为'locationPicker'
			console.log('location', loc);
			loc_s = JSON.stringify(loc);
			loc_a = JSON.stringify(loc.poiaddress);
			loc_a = loc_a.replace('"','');
			loc_a = loc_a.replace('"','');
			document.getElementById("this_location").value = loc_s;
			document.getElementById("this_address").value = loc_a;
			b();
		}
		}, false);

			function c_check(){
				tel=$("#tel").val();
				this_location = $("#this_location").val();

		if(tel == '')
		{
			alert("请填写手机号码");
			return false
		}

		if(this_location == '')
		{
			alert("请定位");
			return false
		}

		$("#form").onsubmit();

		alert("感谢您信息的提交，现在将为您拨打120，如果系统未能自动拨打120，请您手动拨打");

		}

		function c()
		{
			$('#btn-area').css('display','none');
			$('#mapPage').css('display','block');
		}

		function b()
		{
			$('#btn-area').css('display','block');
			$('#mapPage').css('display','none');
		}
</script>
<style type="text/css">
table tr td{border-top:none;}
#photo_update{background:url(images/add_bg.jpg); width:100%; padding:10px; }
#date input{border:none; width:35%; border-bottom:1px solid #f0f0f0}
#date table tr td {float:right}
.form_list{padding:3px; background:#f9f9f9; margin:3px; }
.add{border:1px solid #333333}
</style>