<?php /* Smarty version 2.6.17, created on 2018-05-28 11:46:16
         compiled from events_try.html */ ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "header.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
<!--公用标题居中显示-->
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "common_header.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>


<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "events_top.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>

<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "events_infos.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>

<!--公用提示背景遮罩层-->
<div class="a_cover"></div>

<div class="v_tips_box v_tips_box2" id="error_tips_box">
    <div class="v_close_btn"></div>
    <p class="tips_msg" id="error_msg">错误信息</p>    
</div>

<!--活动结束提示+按钮-->
<div class="v_tips_box v_tips_box2" id="try_tips_box">
	<div class="v_close_btn"></div>
	<p>您的申请提交成功!</p>
    <p><a href="javascript:;" class="v2_close_btn submit_btn_style">确认</a></p>
</div>


<script>
var seconds = 2000;

function clearCover(){
	$('.a_cover').fadeOut(200);
}



function showOkMsg(){
	$('.a_cover').fadeIn(200);
	$('#try_tips_box').fadeIn(200);
}

var goUrl = '';
function go_page(){
	location.href = goUrl;
}

function showErrorMsg(data_msg){
	$('.v_close_btn').show();
	$('#error_msg').html(data_msg);
	$('#error_tips_box').fadeIn(200);
	$('.a_cover').fadeIn(200);
}


function showErrorMsgGoPage(data_msg){
	$('.v_close_btn').show();
	$('#error_msg').html(data_msg);
	$('#error_tips_box').fadeIn();
	$('.a_cover').fadeIn();
	setInterval("go_page();",seconds+100);
}


KISSY.use('node, io', function (S, Node, IO) {
	
	var $ = S.all;
	
	//视频自适应
	var screenWidth = $(window).width();
	var baseWidth = 510;
	var video_scale = screenWidth / baseWidth;
	$(".video_iframe").each(function () {
		var new_width = $(this).width() * video_scale;
		$(this).width(new_width - 20);
		var new_height = $(this).height() * video_scale;
		$(this).height(new_height - 20);
	});
	
	function showErrorMsgBox(msg){
		$(".v_tips_box").fadeOut();
		$("#error_msg").html(msg);
		$("#error_tips_box").show();
		
	}
	
	$(".v_close_btn,.v2_close_btn").on('click', function(){
		$(".v_tips_box,.a_cover").hide();
	});
	
	/*
	IO.on("send",function(){
		//$(".a_cover").css("opacity", 0);
		showErrorMsg('<i class="fa fa-spinner fa-pulse"></i>');
		$('.a_cover').fadeIn();
	});
	
	
	IO.on("complete",function(){
		//$("#error_tips_box").fadeOut();
	});
	*/
	
	$('#common_submit_btn').on('click', function () {
		var formData = IO.serialize('#ff');
		IO.post('<?php echo $this->_tpl_vars['web_cfg']['domain']; ?>
/?c=EventsTry&a=apply&events_id=<?php echo $this->_tpl_vars['tryInfo']['id']; ?>
'
			, formData
			, function (data) {
				if (data.ok) {
					//showOkMsg();
					toast('提交成功,请等待管理员审核');
				} else {
					if(data.msg.url){
						goUrl = '<?php echo $this->_tpl_vars['loginUrl']; ?>
';
						showErrorMsgGoPage('本活动需登录后才可以参与');
						return;
					}
					toast(data.msg, 1);
				}
			}
			, 'json'
		);
		return false;
	});
});
</script>

<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "bottom.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>