<?php /* Smarty version 2.6.17, created on 2018-05-28 12:10:52
         compiled from events_turntable.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' => "nav.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>

<!--====================提示层样式5种,分别选择使用 begin===========================-->
<!--通用文字提示层-->
<div class="v_tips_box" id="vtips_1">
	<div class="v_close_btn"></div>
    <p>{{message}}</p>    
</div>

<!--通用文字提示层+按钮-->
<div class="v_tips_box v_tips_box2" id="vtips_2">
	<div class="v_close_btn"></div>
	<p>{{message}}</p>
    <p><a href="<?php echo $this->_tpl_vars['listUrl']; ?>
" class="submit_btn_style">返回列表</a></p>
</div>

<!--活动结束提示+按钮-->
<div class="v_tips_box v_tips_box2" id="vtips_3">
	<div class="v_close_btn"></div>
	<p>活动已结束!</p>
    <p><a href="<?php echo $this->_tpl_vars['listUrl']; ?>
" class="submit_btn_style">其它活动</a></p>
</div>


<!--领取奖品提示层+按钮-->
<div class="v_tips_box v_tips_box3" id="vtips_4">
	<div class="v_close_btn close_btn_href" url="<?php echo $this->_tpl_vars['giftsUrl']; ?>
"></div>
    <div class="pro_list_box pro_list_box2 pro_list_box3">
        <dl>
            <dt>
                <img src="<?php echo $this->_tpl_vars['web_cfg']['cdn']; ?>
/public/static/img/item_img.jpg">
                <p class="img_cover" style="background-image:url({{img_url}});"></p>
            </dt>
            <dd>
                <p class="pro_name">{{prize_name}}</p>
            </dd>
        </dl>
    </div>
	<p class="v_gray">请点击领取奖品,并填写配送地址</p>
    <p><a class="submit_btn_style" href="<?php echo $this->_tpl_vars['web_cfg']['domain']; ?>
/?c=Express&lottery_data_id={{lottery_data_id}}">领取奖品</a></p>
</div>


<!--查看奖品提示层+按钮-->
<div class="v_tips_box v_tips_box3" id="vtips_5">
	<div class="v_close_btn close_btn_href"  url="<?php echo $this->_tpl_vars['giftsUrl']; ?>
"></div>
    <div class="pro_list_box tips_list_box pro_list_box3">
        <dl>
            <dt><img src="{{img_url}}"></dt>
            <dd>
                <p class="pro_name">{{prize_name}}</p>
                <p class="pro_num">{{virtual_data}}</p>
            </dd>
        </dl>
    </div>
    <p><a class="submit_btn_style" href="<?php echo $this->_tpl_vars['giftsUrl']; ?>
">查看奖品</a></p>
</div>

<!--====================提示层样式5种,分别选择使用 end===========================-->

<!-- 显示 -->
<div class="v_tips_box v_tips_box3" id="ks-tips"></div>

<script>

$("#award_btn").on('click', function(){
	var time = 2000;//设置抽奖loading时间
	$("#luck_show").hide();
	$("#luck_loading").show()/*.delay(time).fadeOut(0)*/;
	//$(".loading_img").css({height:"0px"}).animate({height:"70px"},time);
});

//通用弹出提示层
function v_tips_show(){
	$(".v_tips_box").fadeIn(200);
	$(".a_cover").fadeIn(200);
}

//点击关闭提示层---通用
$(".v_close_btn").live('click', function() {
	$(".v_tips_box").fadeOut(.2);
	$(".a_cover").fadeOut(.2);
});

// 点击关闭按钮
$(".close_btn_href").live('click', function() {
	var url =  $(this).attr('url');
	location.href = url;
});

KISSY.use('node, io, xtemplate, anim', function (S, Node, IO, XTemplate, Anim) {
	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);
	});
	
	var drawResult = {};
	var drawAnim = new Anim(".loading_img", {'height':'70px'}, {
		duration: 2,
		complete: function () {
			var id = setInterval(function () {
				if (!S.isUndefined(drawResult.ok)) {
					run_result_anim(drawResult);
					clearInterval(id);
				}
			}, 100);
		}
	});
	
	//点击抽奖按钮切换抽奖效果
	$("#award_btn").on('click', function () {
		drawAnim.run();
		new IO({
			type: "get"
			, url: '<?php echo $this->_tpl_vars['web_cfg']['domain']; ?>
/?c=EventsTurntable&a=Rotation'
			, data: {events_id: '<?php echo $this->_tpl_vars['turntableData']['events']['id']; ?>
'}
			, success: function (data) {
				drawResult = data;
				return false;
			}
			, error: function (NULL, textStatus) {
				alert("请求服务器失败,原因:"+textStatus);
			}
			, dataType: "json"
		});
	});
	
	function run_result_anim(data) {
		if (data.ok) { //ok
			if(data.msg == 'NoPrize'){
				$("#luck_loading").hide();
				$("#luck_result").show();
			} else {
				if(data.msg.express == 1){//领奖
					var tpl = $("#vtips_4").html();
				} else {//查看奖品
					var tpl = $("#vtips_5").html();
				}
				
				var render = new XTemplate(tpl).render(data.msg);
				$("#ks-tips").html(render).fadeIn(.2);
				$(".a_cover").fadeIn(.2);
			}
			
		} else {
			if(data.msg == 'NoPrize'){
				$("#luck_loading").hide();
				$("#luck_result").show();
			} else {
				var tpl = $("#vtips_2").html();
				var render = new XTemplate(tpl).render({'message':data.msg});
				$("#ks-tips").html(render).fadeIn(.2);
				$(".a_cover").fadeIn(.2);
				$(".v_close_btn").on('click', function() {
					$(".v_tips_box").hide();
					$(".a_cover").hide();
				});
			}
		}
	}
});

//有产品列表时添加整体body背景色
$(body).addClass("bg_white");


</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);
 ?>