<!doctype html>
<html>
<head>
<meta charset="gb2312">
<title>竞投小助手</title>
<link href="<?= STATIC_SOURCE_URL ?>/min/?g=zsbcss" rel="stylesheet" type="text/css">
<script type="text/javascript" src="<?= STATIC_SOURCE_URL ?>/min/?g=zsbjs"></script>
<!--[if lt IE 9]> 
<script type="text/javascript" src="<?= STATIC_SOURCE_URL ?>/min/?f=common/js/html5.js"></script>
<![endif]-->
<?=$css?>
<?=$js?>
<style type="text/css">
    .show_pop_zs_bd .text_nav .logined {
    color: #AAAAAA;
    cursor: not-allowed;
}
</style>
</head>

<body>
<div class="show_pop_zs_show_box radius5">
	<div class="show_pop_zs_hd"> <strong class="title">竞投小助手</strong><span class="tex">我已关注<strong class="num" id="attentionNumber"><?=$attentionNumber?></strong>项竞投</span> 
            <span class="upLoad_link">刷新战况</span> <span id="js_pop_hide_btn" title="收起" class="hide_pop">收起</span> </div>
	<div class="show_pop_zs_mod">
		<div class="inner">
			<dl class="list list_title">
				<dd class="item w160">竞投对象</dd>
				<dd class="item w61">投入房豆</dd>
				<dd class="item w148">竞投状态</dd>
				<dd class="item w70">最高房豆</dd>
				<dd class="item w70">最低房豆</dd>
				<dd class="item w110">操作</dd>
			</dl>
			<div class="list_scoll" id="js_list_scoll_pop">
                            <?php  foreach($attentionList as $value) { ?>
                            <dl class="list list_bg">
					<dd class="item w160">
					<?php if (isset($value['type']) && ($value['type'] == 2 
                            || $value['type'] == 3)) { ?>
                        【<?php if ($value['type'] == 2) {echo '二房源竞投';} else {echo '租房竞投';}?>】
						<?php 
						  if ($value['bidType'] == 1) {
							echo $value['blockshowname'];
						  } else {
							echo $value['hotsearch'][0]['keyword'];
						  }
						?>
					<?php } else if($value['type']==1){ ?>
						【小区专家】<?=$value['block_name']?>
					<?php }else if($value['type']==4){ ?>
					【学区专家】<?=$value['school_name']?>
					<?php }?>
					</dd>
					<dd class="item w61">
                                             <?php if(array_key_exists('my_score', $value)){echo $value['my_score'];}else {echo "— —";} ?>
                                        </dd>
					<dd class="item w148"><?=GrowthBidAttentionHelper::getStatusDescription($value['bid_status'],$value['winFlag'],STATIC_SOURCE_URL)?></dd>
					<dd class="item w70">
                                            <?php if($value['bid_status'] ==1) {
                                                echo '等你来抢';
                                            } else {
                                            ?>
                                            <?=GrowthBidAttentionHelper::MaxScore($value['record'])?>
                                            <?php } ?>
                                        </dd>
					<dd class="item w70"><?=GrowthBidAttentionHelper::MinScore($value['record'])?></dd>
					<dd class="item w110">
					<?php if (isset($value['type']) && ($value['type'] == 2 || $value['type'] == 3)) { 
                                            if($value['disabled_bid_link']) {
                                                echo '<span>竞投</span>';
                                            }else { 
                                                $bidUrl = $value['type'] == 2 ? $self->bidHouseUrl($value['bidType'],$value['id'])
                                                        : $self->bidRentUrl($value['bidType'],$value['id']);
                                                ?>
                                           <a href="<?=$bidUrl?>" target="_blank" class="link_fun">竞投</a>     
                                           <?php }?>
					<?php } else {
                                            if($value['disabled_bid_link']) {
                                        ?>
					      <span>竞投</span>
					<?php
                                            } else {
                                            ?>
					      <a href="<?=$self->bidBlockUrl($value['bid_id'])?>" target="_blank" class="link_fun">竞投</a>
					<?php
                                            }
                                        }?>
                               <?php $value['attention_id']['id'] = isset($value['attention_id']['id'])? $value['attention_id']['id'] : '';?>
                                            <a attention_id="<?=$value['attention_id']['id']?>" href="#" class="link_fun2 cancelAttention">取消关注</a>
                                        </dd>
				</dl>
                            <?php
                            } ?>
			</div>
		</div>
		<div class="show_pop_zs_bd"> 
                </div>
	</div>
</div>
<div id="notloginactivity"  class="dialog radius5" >
	<div class="hd">
		<h3 class="h3">提示</h3>
		<p class="close close-win" title="关闭">关闭 </p>
	</div>
	<div class="mod">
		<div class="text">您今天已经签到领过房豆了哦！<br>
			不能太贪心了，明天再来吧！</div>
	</div>
</div>
<div id="loginactivitysuccess"  class="dialog radius5">
	<div class="hd">
		<h3 class="h3">提示</h3>
		<p id="loginactivityclose" class="close close-win" title="关闭">关闭 </p>
	</div>
	<div class="mod">
		<div class="textMod_new"><img  alt="" src="<?= STATIC_SOURCE_URL ?>/zsb/images/v1.0/okBg.png" > 签到成功！</div>
		<div class="textHd_new">房豆<strong class="b_c" id="b_c_crdeit_b">+1</strong></div>
		<div class="textHd_new">成长值<strong class="b_c" id="b_c_exp_b">+1</strong></div>
		<div class="textHd_new">据说每天签到的人签单成功率会大大增加哦！</div>
	</div>
</div>
<script>
    $(function(){
        //倒计时
        $(".time").each(function() {
            var x = $(this).text();
            if(x.length) {
                $(this).countdown({
                htmlTemplate: " %d <span class='cd-time'>天</span> %h <span class='cd-time'>时</span> %i <span class='cd-time'>分</span> %s <span class='cd-time'>秒</span>",
                date: x,
                yearsText:'年',
                monthsText:'月',
                daysText:'天',
                hoursText:'时',
                minutesText:'分',
                secondsText:'秒',
                servertime:'<?=microtime(true)*1000?>'
                });
            }
        }); 
        //刷新战况
        $(".upLoad_link").click(function(){
            var func1 = function(){ alert('请重新登录'); }
            var func2 = function () { window.location.reload(); }
            checkLogin(func1,func2)
        });
        
        function checkLogin(cbNoLogin,cbLogin) {
            $.get('/login/check/',{},function(data){
                if(data&&data.errorCode==401) {
                    cbNoLogin();
                } else {
                    cbLogin();
                }
            },'json');
        }
        
        //取消关注事件
        $(".cancelAttention").click(function() {
            var cBtn = $(this);
            var attentionDiv = $(this).parents("dl");
            var nubObj = $("#attentionNumber");
            var pnubObj = $("#attentionNumber", window.parent.document); 
            $.get("/market_bid_attention/cancel",{attention_id:$(this).attr('attention_id'),action:'cancelAttention'},
            function(data){
                //console.log(data);
                if(data.errorCode==401) {
                    alert('请重新登录');
                    return ;
                }
                if(data.result==1) {
                    attentionDiv.hide();
                    nubObj.text(nubObj.text()-1);
                    pnubObj.text(pnubObj.text()-1);
                    window.parent.openWin("successTipa");
                } else {
                    //window.parent.openWin('atttention');
                    window.parent.openWin("successTip1");
                }
            },'json')
        })
    })
if(window.XMLHttpRequest)
{
	(function($){
		$(window).load(function(){
			if($("#js_list_scoll_pop").length>0)
			{
				$("#js_list_scoll_pop").mCustomScrollbar();
			}
		});
	})(jQuery);
}

var oInput = document.getElementById('js_pop_hide_btn');
oInput.onclick = function(){
	window.parent.document.getElementById('js_show_pop_zs_show_box').style.height = 0;
};
$("#loginactivity").click(function(){     
		var name = $(this).attr("name")      
       if(name==1){
            window.parent.openWin("notloginactivity");
		   return false;
		}
        var brokerid = $(this).attr("value");		
        $.post('login_activity.php',{id:brokerid},function(data) {
             if(data==0){		
			     alert("领房豆失败，重新领一次把！");				
             }else{
				 $('#loginactivity').attr('class','logined') ;
			     //data = data.split(",");
			     //$("#b_c_crdeit").text("+"+data[0]);
				// $("#b_c_exp").text("+"+data[1]);
				 var numregex = /^[0-9]*$/;              
			     data = data.split(",");
			     $("#b_c_crdeit_b").text("+"+data[0]);
				 if(numregex.test(data[1])){
				   $("#b_c_exp_b").text("+"+data[1]);
				 }else{
				  $("#b_c_exp_b").text(data[1]);
				 }
                 window.parent.openWin("loginactivitysuccess");			 
                 $("#loginactivity").attr("name",1);
                 $("#loginactivity").addClass("a_font_color");
                 
             }
             
               
            })
        })
</script>
</body>
</html>
