<extend name="Public/promote_base"/>
<block name="css">
<link href="__CSS__/20180207/mixed.css" rel="stylesheet">
<link href="__CSS__/20180207/data.css" rel="stylesheet">
<style type="text/css">
	.trunk-list {position: relative;min-height: 66vh;}
	.pagenation{position: relative;line-height: 5vh;}
	.trunk-content {margin: 20px 2% 0;}
</style>
</block>

<block name="body">
    <div class="page-list normal_list siteGame-index-list">
      <div class="trunk-title">
      	<div class="location">
		<div class="location-container">当前位置:<span>联盟站点></span><span>游戏列表</span></div>
		</div>
      	<img src="__IMG__/20180207/icon_normal_youxi.png"><span class="title_main">游戏列表</span>
      </div>
      <div class="trunk-content article">
          <div class="trunk-search clearfix">
            <div class="tab clearfix">
              <a href="{:U('add')}" class="submit" >添加游戏</a>
            </div>
          <form action="{:U('index',array('row'=>I('get.row')))}" method="post" enctype="multipart/form-data" class="marg_top20">
              <div class="form-group normal_space fr">
                  <input type="submit" class="submit" value="查询">
              </div>
              <div class="form-group normal_space fr">
                  <select id="recommend_status" name="recommend_status" class="reselect select_gallery" style="min-width:200px;width: 175px;">
                      <option value="">推荐状态</option>
                      <option <eq name="Think.request.recommend_status" value="1">selected</eq> value="1">推荐</option>
                      <option <eq name="Think.request.recommend_status" value="2">selected</eq> value="2">热门</option>
                      <option <eq name="Think.request.recommend_status" value="3">selected</eq> value="3">最新</option>
                      <option <eq name="Think.request.recommend_status" value="0">selected</eq> value="0">不推荐</option>
                  </select>
              </div>
              <div class="form-group normal_space fr">
                  <input name="game_name" class="select_gallery txt normal_txt" placeholder="游戏名称" style="min-width:200px;width: 175px;" value="{$Think.request.game_name}">
              </div>
          </form>
          </div>
          <div class="trunk-list">
              <table class="table normal_table">
                  <tr class="odd">
                    <th>游戏名称</th>
                    <th>游戏平台</th>
                    <th>游戏类型</th>
                    <th>游戏大小</th>
                    <th>推荐状态</th>
                    <th>QQ群号</th>
                    <th>QQ群名称</th>
                    <th>加群人数</th>
                    <th>版本号</th>
                    <th>更新时间</th>
                    <th>操作</th>
                  </tr>
                  <empty name="data">
                  <tr><td colspan="10" style="text-align: center;height: 45vh;"><img src="__IMG__/20180207/icon_wushujv2.png"/><p style="line-height: 40px;color: #A5A5A5;">暂无数据</p></td></tr>
                  <else />
                  <volist name="data" id="vo" key="k">
                      <tr id ="{$vo['id']}">
                          <td>{$vo.game_name}</td>
                          <td><eq name="vo.sdk_version" value="1">安卓<else/>苹果</eq></td>
                          <td>{$vo.game_type}</td>
                          <td>{$vo.game_size} M</td>
                          <td><notempty name="vo.recommend_status">{:get_recommend_status_info($vo['recommend_status'])}<else />不推荐</notempty></td>
                          <td><notempty name="vo.group_code">{$vo.group_code}<else />--</notempty></td>
                          <td><notempty name="vo.group_name">{$vo.group_name}<else />--</notempty></td>
                          <td><notempty name="vo.in_num">{$vo.in_num}<else />--</notempty></td>
                          <td>{$vo.version}</td>
                          <td>
                              <if condition="$vo.update_time neq ''">
                                  {$vo.update_time|time_format}
                                  <else/>
                                  --
                              </if>
                          </td>
                          <td class="op">
                          <if condition="$vo['is_top'] eq '1'">
                              <a class="totop" href="{:U('endtop',['id'=>$vo['id']])}">取消置顶</a> 
                          </if>
                          <if condition="$vo['is_top']  neq '1'">
                              <a class="totop" href="{:U('top',['id'=>$vo['id']])}">置顶</a> 
                          </if>
                              <a class="edit" href="{:U('edit',['id'=>$vo['id'],'p'=>$p])}">编辑</a>
                              <a class="del_game" href="javascript:;" data-id ="{$vo['id']}">删除</a>
                          </td>
                      </tr>
                  </volist>
                  </empty>
              </table>
              <div class="pagenation clearfix">
								<a class="sch-btn" id="export_data" href="{:U('Export/sitegame',array(
									'game_name'=>I('game_name'),
									'recommend_status'=>I('recommend_status'),
									'xlsname'=>'联盟站点_游戏列表'
									))}" >导出</a>
								{$_page}
							</div>
          </div>
      </div>
    </div>
</block>
<block name="script">
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
  <script type="text/javascript">
	setValue('row','{:I("get.row",10)}');
  $(document).ready(function() {
  });
	//删除操作
	$('.del_game').click(function(){
		var val = $(this).attr("data-id");
		var url = "{:U('del')}";
		del_action(val,url);
	});
  var sub = true;
  function save() {
      if(!sub){
          return false;
      }
      var data = $("#data").serialize();
      sub = false;
      $.ajax({
          type: "post",
          url: "{:U('SiteBase/save')}",
          dataType: "json",
          data: data,
          success: function (res) {
              if (res.status != 0) {
                  layer.msg(res.info, {icon: 1});
              }
              else {
                  sub = true;
                  layer.msg(res.info, {icon: 2});
              }
          },
          error: function () {
              layer.msg('服务器故障', {icon: 5});
          }
      })
  }

$(".select_gallery").select2();
  </script>
</block>