<extend name="Public/promote_base"/>
<block name="css">
<link href="__CSS__/20180207/mixed.css" rel="stylesheet">
</block>

<block name="body">
    <div class="page-form normal_list siteServer-add-form">
      <div class="trunk-title">
      	<div class="location">
		<div class="location-container">当前位置:<span>联盟站点></span><span>区服列表></span><span>添加区服</span></div>
		</div>
      	<img src="__IMG__/20180207/icon_normal_qufu.png"><span class="title_main">{$meta_title}</span>
      </div>
      <div class="trunk-content article">
        <div class="trunk-list">
          <form action="" novalidate="novalidate" method="post" id="data">
              <table class="table2">
                  <tr>
                      <td class="l"><span class="must_style">*</span>游戏名称:</td>
                      <td class="r">
                          <select name="game_id" id="game_id" class="reselect select_gallery" style="width:262px;">
                              <option value="">请选择游戏</option>
                              <volist name="game" id="vo">
                              <option value="{$vo.id}">{$vo.game_name}<eq name='vo.sdk_version' value='1'>(安卓版)<else/><eq name='vo.sdk_version' value='2'>(苹果版)</eq></eq><eq name='vo.game_source' value='1'>(平台)<else /><eq name='vo.game_source' value='2'>(第三方)</eq></eq></option>
                              </volist>
                          </select>
                      </td>
                  </tr>
									<tr style="height: 34px;">
                      <td class="l">运行系统:</td>
											<td class="r form-radio jspayradio" id="server_version">
												<label><input type="radio" name="server_version" class="ggg" value="1" disabled><i></i><span>安卓</span></label>
                        <label><input type="radio" name="server_version" class="ggg" value="2" disabled><i></i><span>苹果</span></label>
											</td>
									</tr>
                  <tr>
                      <td class="l"><span class="must_style">*</span>显示状态:</td>
                      <td class="r form-radio jspayradio">
                          <label><input type="radio" name="status" class="name" value="1" checked="checked"><i></i><span>开启</span></label>
                          <label><input type="radio" name="status" class="name" value="2" ><i></i><span>关闭</span></label>
                      </td>
                  </tr>
                  <tr>
                      <td class="l"><span class="must_style">*</span>区服名称:</td>
                      <td class="r">
                          <input name="server_name" class="name txt" id="server_name">
                      </td>
                  </tr>
                  <tr>
                      <td class="l"><span class="must_style">*</span>开服时间:</td>
                      <td class="r">
                          <input name="start_time" class="name txt date" id="start_time">
                      </td>
                  </tr>
                  <tr>
                      <td class="l"></td>
                      <td class="r">
                          <button type="button" class="tjbnt btn" onclick="save()">保存</button>
                          <a class="back_btn " alt="返回上一页" title="返回上一页" href="javascript:window.history.back();">返回</a>
                      </td>
                  </tr>  
              </table>
          </form>
        </div>
      </div>
    </div>
</block>
<block name="script">
    <link rel="stylesheet" type="text/css" href="__STATIC__/jquery-ui/jquery-ui.css">
    <script type="text/javascript" src="__STATIC__/jquery-ui/jquery-ui.js"></script>

       
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<link href="__CSS__/dropdown171205.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>

       
       <script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
  <script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
  <script type="text/javascript">

      $(function() {
					$("#game_id").change(function () {
							var sd = 1;
							
              if($(this).find('option:selected').text().indexOf('(苹果版)')>-1) {
								sd = 2;
							}
							
							$('#server_version input').prop('checked',false).prop('disabled',true).siblings('i').removeClass('current');
							$('#server_version input[value='+sd+']').prop('disabled',false).prop('checked',true).siblings('i').addClass('current');
                  
              
          });
      
          $('.date').datetimepicker({
              format: 'yyyy-mm-dd hh:ii',
              language:"zh-CN",
              minView:0,
              autoclose:true
          });
          
          $(".select_gallery").select2();
          
          $('.jspayradio input:checked').siblings('i').addClass('current');
    
          $('.jspayradio input').click(function() {
              var that=$(this);
              that.closest('.jspayradio').find('i').removeClass('current');
              if (that.prop('checked')) {
                  that.siblings('i').addClass('current');
              }
          });

      });
  var sub = true;
  function save() {
      if(!sub){
          return false;
      }
      var data = $("#data").serialize();
      sub = false;
      $.ajax({
          type: "post",
          url: "{:U('add')}",
          dataType: "json",
          data: data,
          success: function (res) {
              if (res.status != 0) {
                  layer.msg(res.info, {icon: 1});
                  setTimeout(function () {
                      location.href = "{:U('SiteServer/index')}";
                  },1000)
              }
              else {
                  sub = true;
                  layer.msg(res.info, {icon: 2});
              }
          },
          error: function () {
              layer.msg('服务器故障', {icon: 5});
          }
      })
  }


  //导航高亮
  highlight_subnav('{:U('index')}');
  </script>
</block>