<extend name="Public/bases" />
<block name="css">
  <link href="__CSS__/user.css" rel="stylesheet" >
  <link href="__CSS__/gift.css" rel="stylesheet" >
</block>
<block name="body" >
  <body class="user">
    <header class="header">
      <div class="">
        <a href="{:U('User/index')}" class="hbtn back"><i class="iconfont icon-drop-left"></i></a>
        <h1 class="caption">我的收藏</h1>
      </div>
    </header>
    <div class="occupy"></div>
    <section class="trunker">
      <section class="container">
        <div class="trunker-section user-collection-list">
          <ul class="t-content clearfix" id="ajaxContainer" currentpage="1">
            <volist name="data" id="vo">
            <li>
              <a href="{:U('Game/detail',array('id'=>$vo['id']))}" class="za_icongift">
                
				<img src="{$vo['icon']}" class="icon" onerror="this.src='__IMG__/empty.jpg';this.onerror=null">
				
               
              </a>
              <div class="btnbox" data-game_id="{$vo.id}"><a href="javaScript:" class="btn">取消收藏</a></div>
              <div class="text">
                <div class="namebox">
                  <a href="{:U('Game/detail',array('id'=>$vo['id']))}" class="name">{$vo.game_name}</a>
                  <p class="stars"><i style="width:{:$vo['game_score']*10}%;"></i></p>
                </div>
                <div class="info">
                  <span class="size">{$vo.game_size}</span>
                  <span class="dlnumber">{$vo.dow_num}人下载</span>
                </div>
                <p class="description">{$vo.features}</p>
              </div>
            </li>
            </volist>
          </ul>
        </div>
      </section>
    </section>
    <div class="popmsg pop-dialog"></div>
    <div class="loading ms-none hidden" id="moreBtn"><a href="javascript:" class="link"></a></div>
    <script src="__JS__/ajaxload.js"></script>
    <script src="__JS__/pop.lwx.min.js"></script>
    <script>
      $(function() {
          $(".btnbox").click(function(){
            var pmsg = $('.popmsg').pop();
           
            var game_id = $(this).attr("data-game_id");
            $.ajax({
              url:"{:U('User/set_collection')}",
              type:"post",
              dataType:"json",
              data:{game_id:game_id,status:2},
              success:function(result){
                pmsg.msg(result.info);
                if(result.url !=''){
                  setTimeout(function () {
                    window.location.href = result.url;
                  }, 2000);  
                }
              },
              error:function(){

              }
            })
          })
          var pmsg = $('.popmsg').pop();
          <?php if(!$data){?>
            pmsg.msg('暂无数据');
          <?php }?>
          var ac = $('#ajaxContainer');
          var popmsg = $('.loading').pop();
          ajaxload('{:U("ajaxUserCollection")}',{},function(data) {
            if (data.status == 1) {
                ac.attr('currentpage',data.page);
                var html = '',d = data.lists;
                for (var i in d) {
                    var item = d[i];
                    html += '<li> <a href="">'+
                    '  <img src="'+item.icon+'" class="icon" onerror="this.src=\'__IMG__/empty.jpg\';this.onerror=null">'+
                    ' </a>'+
                    '  <div class="btnbox" data-game_id="'+item.id+'"><a href="javaScript:" class="btn">取消收藏</a></div>'+
                    '  <div class="text">'+
                    '    <div class="namebox">'+
                    '      <a href="" class="name">'+item.game_name+'</a>';
                    var game_score_html = '<p class="stars"><i style="width:'+item.game_score+'0%;"></i></p>';
                    html += game_score_html;
                    html += '    </div>'+
                            '    <div class="info">'+
                            '      <span class="size">'+item.game_size+'</span>'+
                            '      <span class="dlnumber">'+item.dow_num+'人下载</span>'+
                            '    </div>'+
                            '    <p class="description">'+item.features+'</p>'+
                            '  </div>'+
                            '</li>';                        
                }
                ac.append(html);
                $('.loading').addClass('ms-none');
                $('#moreBtn').removeClass('ms-none');loads = false;
            } else {
                $('.loading').removeClass('hidden').addClass('ms-none');
                pmsg.msg('已经到底了~');
            }
          })
      });
    </script>
  </body>
</block>
<block name="footer"></block>