<?php
  require __DIR__.'/head.html';
  require __DIR__.'/header.html';
  $File_Ming = 'webset';
  require __DIR__.'/nav.html';
  ?>
<!-- 主体 -->
<main class="app-content">
  <div class="app-title">
    <ul class="app-breadcrumb breadcrumb">
      <li class="breadcrumb-item"><i class="fa fa-home fa-lg"></i></li>
      <li class="breadcrumb-item">网站设置</li>
    </ul>
  </div>
  <div class="row">
    <div class="col-md-12">
      <form id="admin-webset">
        <div class="tile">
          <div class="row">
            <div class="col-lg-6">
              <div class="form-group">
                <label for="title">网站标题</label>
                <input class="form-control" id="title" type="text" aria-describedby="title" name="title"
                  value="<?php echo $web['title']; ?>" placeholder="请输入网站标题">
              </div>
              <div class="form-group">
                <label for="name">网站副标题</label>
                <input class="form-control" id="name" type="text" aria-describedby="name" name="name"
                  value="<?php echo $web['name']; ?>" placeholder="请输入网站副标题">
              </div>
              <div class="form-group">
                <label for="keywords">网站关键字</label>
                <input class="form-control" id="keywords" type="text" aria-describedby="keywords" name="keywords"
                  value="<?php echo $web['keywords']; ?>" placeholder="请输入网站关键字">
              </div>
              <div class="form-group">
                <label for="description">网站描述信息</label>
                <input class="form-control" id="description" type="text" aria-describedby="description"
                  name="description" value="<?php echo $web['description']; ?>" placeholder="请输入描述信息">
              </div>
              <div class="form-group">
                <label for="time">建站时间</label>
                <input class="form-control" id="time" type="text" aria-describedby="time" name="time"
                  value="<?php echo $web['time']; ?>" placeholder="2019/02/14 18:00:00">
              </div>
              <div class="form-group">
                <label for="ten">网站模板</label>
                <select class="form-control" name="template" id="ten">
                  <?php $ag = tenList(); $is = 0;
                  foreach ($ag as $key => $value) {
                    if ($value == $web['template']) {
                        $is = 1;
                        echo '<option value="' . $value . '">' . $value . '</option>';
                        foreach ($ag as $key => $val) {
                            if ($val != $web['template']) {
                                echo '<option value="' . $val . '">' . $val . '</option>';
                            }
                        }
                    }
                  }
                  if (!$is) {
                    foreach ($ag as $key => $val) {
                      echo '<option value="' . $val . '">' . $val . '</option>';
                    }
                  }
                	?>
                </select>
              </div>

              <div class="form-group">
                <label for="details">注册邮箱验证</label>
                <div class="toggle-flip">
                  <label>
                    <input type="checkbox" <?php if(isset($web['emailRegister']) &&
                      !empty($web['emailRegister'])){echo 'checked="checked"' ;}?>
                    value="1" name="emailRegister">
                    <span class="flip-indecator" data-toggle-on="ON" data-toggle-off="OFF"></span>
                  </label>
                </div>
              </div>
            </div>
            <div class="col-lg-6">
              <div class="form-group">
                <label for="url1">二维码地址一</label>
                <input class="form-control" id="url1" type="text" aria-describedby="url1" name="url1"
                  value="<?php echo $web['url1']; ?>" placeholder="请输入人地址">
              </div>
              <div class="form-group">
                <label for="url2">二维码地址二</label>
                <input class="form-control" id="url2" type="text" aria-describedby="url2" name="url2"
                  value="<?php echo $web['url2']; ?>" placeholder="请输入人地址">
              </div>
              <div class="form-group">
                <label for="icp">备案号</label>
                <textarea class="form-control" id="icp" name="icp" rows="2"
                  placeholder='请输入人备案号'><?php echo $web['icp']; ?></textarea>
              </div>
              <div class="form-group">
                <label for="about">关于</label>
                <textarea class="form-control" id="about" name="about" rows="3"
                  placeholder='关于'><?php echo $web['about']; ?></textarea>
              </div>
              <div class="form-group">
                <label for="about">公告</label>
                <textarea class="form-control" id="gg" name="gg" rows="2"
                  placeholder='公告内容留空不弹出，默认自动弹出'><?php echo $web['gg']; ?></textarea>
              </div>


            </div>
          </div>
          <div class="tile-footer">
            <input value="webinfo" name="target" style="display: none">
            <button type="button" class="btn btn-primary">保存</button>
          </div>
        </div>
      </form>
    </div>
  </div>
  <?php  require __DIR__.'/fooer.html'; ?>
  <script>
    $('#admin-webset button').click(function () {
      fd = new FormData(document.getElementById('admin-webset'));
      $.ajax({
        url: '/admin/webset',
        type: "POST",
        timeout: "5000",
        dataType: "json",
        contentType: 'application/x-www-form-urlencoded;charset=utf-8',
        data: fd,
        contentType: false,
        processData: false,
        success: function (data) {
          if (data.code == "200") {
            layer.msg(data.msg);
          } else {
            layer.msg(data.msg);
          }
        },
        error: function (XMLResponse) {
          layer.msg(XMLResponse.error);
        }
      });
    });
  </script>
  </body>

  </html>