<!DOCTYPE html>
<html>
	<head>
		<meta charset="gbk">
		<title></title>
		<link rel="stylesheet" href="http://pic.house365.com/static/css/reset.css" />
		<link rel="stylesheet" type="text/css" href="../css/choujiang.css">
		<title>365发房有礼第七季</title>
		<meta name="description" content="发房源通过权属验证 好礼享不停">
	</head>
<style>
    #new_login_error {
        font-size: 16px; text-align: left;
        height: 32px;
        border: 1px solid #ff5050;
        padding-left: 33px;
        padding-right: 6px;
        line-height: 32px;
        width: 300px; margin: 0 auto;
        background: #fff0f1 url(<?php echo USER_CENTER;?>images/new_login.gif) no-repeat 10px -256px;
        color: #ff3737;
    }
    .get_code {
        float: left;
        margin-left: 167px;
        width: 104px;
        height: 34px;
        text-align: center;
        background: url(<?php echo USER_CENTER;?>images/new_login.gif) no-repeat 0 0;
        border: none;
        cursor: pointer;
        color: #666;
    }
</style>
	<body>

		<div class="wap">
			<div class="topbtn">
				<a class="btno" target="_blank" href="http://www.house365.com/publish/?kind=2"></a>
				<a class="btnt" target="_blank" href="http://www.house365.com/publish/?kind=2"></a>
			</div>
			<div class="info clearfix">
				<div class="rotary">
					<img class="hand" id="handnow" src="../css/images/arr.png" width="100%" height="100%" />
				</div>
				<!--中奖弹窗-->
				<div class="pop" style="display: none;">
					<div class="popwap">
					</div>
					<a class="popbtn" onclick="HidePop('pop')" target="_blank"></a>
				</div>
				<!--没有抽奖机会弹窗-->
				<div class="popt" style="display: none;">
					<div class="popwap"> &nbsp;
					</div>
					<a class="popbtn" onclick="HidePop('popt')" target="_blank"></a>
				</div>
				<!--中奖记录弹窗-->
				<div class="poph" style="display: none;">
					<div class="popwap">
					</div>
					<a class="popbtn" onclick="HidePop('poph')" target="_blank"></a>
				</div>
                <!--登录弹窗-->
                <div class="poplogin" style="display: none;">
                    <div class="popwap">
                        <div class="logtit">登录</div>
                        <div class="item" style="display:none">
                            <div id="new_login_error"></div>
                        </div>
                        <div class="loginput clearfix"><span>*</span><label>手机号：</label><input id="new_login_name" type="text"><input type="button" id="getcode" value="获取验证码"> </div>
                        <div class="loginput clearfix"><span>*</span><label>验证码：</label><input type="text" id="new_login_code_input"></div>
                        <input  type="hidden" name="kind" id="kind" value="1">
                        <input  type="hidden" name="yztelno" id="yztelno" value="1">
                        <?php
                        $rand_num = rand(100000,200000);
                        $_SESSION[GB_CITY.'_register_num'] = $rand_num;
                        ?>
                        <input  type="hidden" name="security_key" id='security_key' value="<?php echo md5('HOUSE365_Reg_KEY_'.$rand_num);?>">
                    </div>
                    <div class="logbtn"> <a id="new_login_submit">确认</a><a onclick="HidePop('poplogin')">取消</a></div>
                </div>
                <form name="subform" id="subform" action="/login" method="post">
                    <input name="telnotj" id="telnotj" type="hidden" value="" >
                    <input name="passwordtj" id="passwordtj" type="hidden" value="" >
                    <input name="telcodetj" id="telcodetj" type="hidden" value="" >
                    <input name="loginkindtj" id="loginkindtj" type="hidden" value="" >

                </form>
				<div class="list">
					<div class="listcon" id="demo">
						<div id="demo1">
                         <?php foreach($record as $key =>$value ){ ?>
							<p class="clearfix">
								<label class="fl"><?php echo $value['telno'];?></label>
								<span class="fr">获得<?php echo $value['prize_name'];?></span>
							</p>
                         <?php } ?>
						</div>
						<div id="demo2"></div>
					</div>
					<div class="listbtn">
						<a class="btns" id="getrecord" href="javascript:void(0)" ></a>
					</div>
				</div>
                <input type="hidden" id="uid" value="<?php echo $uid;?>">
			</div>
			<div class="rule">
				<div>
					<h1>活动规则</h1>
					<p>1.本次活动仅限于房东（产权人）本人参与，二房东、托管公司、经纪人不可参与<br/> 2.房东发布出租信息时，填写真实有效齐全的权属资料及房源信息，符合网站房源发布规则，并且通过房源审核的都可以参与本次抽奖。
						<br/> 3.一个号码只有一次中奖机会。
						<br/> 4.中奖者会收到365工作人员的电话通知领取奖品的时间。
					</p>
				</div>
				<div class="rulet">
					<h1>领奖方式</h1>
					<p>1.每个奖品需自行领取，不兑换成现金，不支持邮寄，在获奖公布7个工作日内领取奖品，逾期视为自动放弃。<br/> 2.联系方式：025-84645315,025-83247162。建邺区省建大厦B幢6楼信息中心。
					</p>

				</div>
				<div class="ruleh">
					<h1>奖项设置</h1>
					<p>小米手环 飞利浦剃须刀 九阳榨汁机 精美马克杯 电热水壶<br/> （以上奖品以具体实物为准，若有变动，不另行通知） </p>
				</div>
			</div>
		</div>
		<!--<div class="cover"></div>-->

		<script type="text/javascript" src="../js/jquery-1.8.3.min.js"></script>
		<script type="text/javascript" src="../js/jquery.rotate.min.js"></script>
		<script>
			$(function() {

				var $hand = $('#handnow');

				$hand.click(function() {
                    var bool = checkLogin();
                    if(bool){
                        // var data = [1, 2, 3, 4, 5, 6];
                        // data = data[Math.floor(Math.random() * data.length)];
                        $.ajax({
                            url:'http://user.house365.com/lucky_prize/getLuckyPrize',
                            type :'post',
                            dataType : 'json',
                            data : {},
                            success: function(res) {
                                switch (res.status) {
                                    case 1:
                                        rotateFunc(1, 60, '小米手环','pop');
                                        break;
                                    case 2:
                                        rotateFunc(2, 120, '感谢参与','poph');
                                        break;
                                    case 3:
                                        rotateFunc(3, 180, '飞利浦剃须刀','pop');
                                        break;
                                    case 4:
                                        rotateFunc(4, 240, '九阳榨汁机','pop');
                                        break;
                                    case 5:
                                        rotateFunc(5, 300, '电热水壶','pop');
                                        break;
                                    case 6:
                                        rotateFunc(6, 360, '精美马克杯','pop');
                                        break;
                                    case 7:
                                        ShowPop('poplogin');
                                        break;
                                    case 8:
                                        ShowPop('poph',res.msg);
                                        break;
                                    case 9:
                                        ShowPop('pop',res.msg);
                                        break;
                                    case 10:
                                        ShowPop('popt',res.msg);
                                        break;
                                }
                            }
                        });
                    }


				});

				var rotateFunc = function(awards, angle, text,obj) {
					$hand.stopRotate();
					$hand.rotate({
						angle: 0,
						duration: 5000,
						animateTo: angle + 1440,
						callback: function() {
							ShowPop(obj, text);
						}
					});
				};

				//不间断向上滚动
				var speed = 50
				demo2.innerHTML = demo1.innerHTML

				function Marquee() {
					if(demo2.offsetTop - demo.scrollTop <= 0)
						demo.scrollTop -= demo1.offsetHeight
					else {
						demo.scrollTop++
					}
				}
				var MyMar = setInterval(Marquee, speed)
				demo.onmouseover = function() {
					clearInterval(MyMar)
				}
				demo.onmouseout = function() {
					MyMar = setInterval(Marquee, speed)
				}
			})
			//弹出提示
			function ShowPop(show, obj) {
				var bh = $(window).height();
				var bw = $(window).width();
				$(".cover").css({
					height: 2 * bh,
					width: bw,
					display: "block"
				});
				var name = show;
				var t = $("." + name).height();
				var l = $("." + name).width();
				/*
				$("." + name).css({ 
					"top":(bh-t)/2,
					"left":(bw-l)/2
				}); */
				$("." + name+" .popwap").html(obj);
				$("." + name).fadeIn(500);
			}
			//关闭提示
			function HidePop(show) {
				$(".cover").fadeOut(100);
				$("." + show).fadeOut(500);
				if(show == "popt") {
					console.log(1);
					$("html,body").animate({
						scrollTop: '1817px'
					}, 500);
				}
			}

			function checkLogin(){
                var uid = $("#uid").val();
                if(uid <= 0){
                    ShowPop('poplogin');
                    return false;
                }
                return true;
            }
			$("#getrecord").on('click',function(){
			    //验证登录
                var bool = checkLogin();
                if(bool){
                    $.ajax({
                        url:'http://user.house365.com/lucky_prize/getMyRecord',
                        type :'get',
                        dataType : 'json',
                        success: function(res) {
                            switch (res.status) {
                                case '-1': //没有抽奖记录
                                    ShowPop('poph',res.msg);
                                    break;
                                case '-2':  //没中奖
                                    ShowPop('poph',res.msg);
                                    break;
                                case '-3':  //中奖，
                                    ShowPop('pop',res.msg);
                                    break;
                                case '-4':  //没登录
                                    ShowPop('poplogin');
                                    break;
                            }
                        }
                    });
                }
            })

		</script>
    <script>
        //发送验证码
        $(function(){
            $('#getcode').getVnum();
        })
    </script>
    <script>
        //发送验证码
        (function($){
            var defaults={
            };
            $.fn.getVnum = function(){

                var self = $(this);
                var time = 0;
                self.bind("click",function(){

                    var kind = $("#kind").val();
                    var telno = $("#new_login_name").val();
                    var security_key = $("#security_key").val();
                    var yztelno = $("#yztelno").val();
                    if(time == 0)
                    {
                        var partten = /^1[0-9]{10}$/;//手机号码
                        if(partten.test(telno))
                        {
                            $("#new_login_error").parent().hide();
                            $.post('http://user.house365.com/register/getyzm',{act:'getyzm',telno:telno,kind:kind,security_key:security_key},
                                function(data){

                                    if(data == '1'){
                                        time = 60;
                                        var oTime = null;
                                        $('#getcode').css({ 'background-color':'#ccc'});
                                        $('#getcode').css({cursor:"default"});
                                        $("#getcode").val('重新获取('+time+')');
                                        oTime = setInterval(function(){if(time>0){time--;$("#getcode").val('重新获取('+time+')');}else{clearInterval(oTime);$("#getcode").val('获取验证码');$('#getcode').css({ 'background-color':'#0071ff'});$('#getcode').css({cursor:"pointer"})}} ,1000);
                                    }else if(data=='400'){
                                        $("#new_login_error").html("出错了,请刷新重试");
                                    }
                                }
                            );
                        }
                        else
                        {
                            $("#new_login_error").html("请正确填写手机号");
                            errorCom("new_login_name");
                        }
                    }
                })
            }
        })(jQuery);
    </script>
    <script>
        function errorCom(obj){//错误时显示样式
            $("#new_login_error").parent().show();
            $("#"+obj).addClass("inputTextError");
            return false;
        };
    </script>
    <script>
        $("#new_login_submit").on('click',function(){
            var _error   = $("#new_login_error");
            var new_login_name = $("#new_login_name").val();
            var new_login_code_input = $("#new_login_code_input").val();
            var regBox   = /^1[0-9]{10}$/;
            if( space_none(new_login_name) == "" )// 手机号为空时
            {
                _error.text("请输入手机号");
                errorCom("new_login_name");
                return;
            }
            else if(space(new_login_name))// 手机号有空格时
            {
                _error.text("手机号不能有空格");
                errorCom("new_login_name");
                return;
            }
            else if(!regBox.test(new_login_name))// 手机号格式
            {
                _error.text("请正确填写手机号");
                errorCom("new_login_name");
                return;
            }
            else if( space_none(new_login_code_input) == "" )// 验证码为空时
            {
                _error.text("请输入手机验证码");
                errorCom("new_login_code_input");
                return;
            }
            $.ajax({
                type: 'post',
                url : 'http://user.house365.com/login',
                data: "action=loginyz"+"&telno="+new_login_name.replace(/[ ]/g,"")+"&loginkind=1&telCode="+new_login_code_input+"&ajaxyz=1",
                dataType:'html',
                success: function(msg){
                    if(msg=='N_USER')
                    {
                        $("#new_login_error").html("请先注册  <a target='_blank' href='http://user.house365.com/register'>注册>></a>");
                        // _error.text("号码未注册，请立即注册。");
                        errorCom("new_login_code_input");
                        $("#new_login_name").focus();
                        return;
                    }else if(msg=='N_PASS')
                    {
                        _error.text("动态验证码不正确。");
                        errorCom("new_login_code_input");
                        $("#new_login_name").focus();
                        return;
                    }else if(msg=='Y')
                    {
                        $("#new_login_name").show();
                        $("#telnotj").val(new_login_name);
                        $("#telcodetj").val(new_login_code_input);
                        $("#loginkindtj").val(1);
                        $("#subform").submit();
                    }
                }
            });

        })
        function space_none(v){ //去除空格
            var s = v;
            s = s.replace(/[ ]/g,"");//s.replace(/\s/g, "")
            return s;
        };
        function space(v) { //判断是否有空格
            var s = v;
            if(s.indexOf(" ") >=0)
                return true;
        };
    </script>
	</body>
</html>