<?php 
	include './head.php';
?>
<div class="layui-row layui-col-space15">
        <div class="layui-col-md8 layui-col-md-offset2">
            <div class="layui-card" style="border-radius: 20px;">
              <div class="layui-card-header">
                <h3 style="padding-top: 3px;color: hsl(230,10%,40%);"><b>系统设置</b></h3>
              </div>
              <div class="layui-card-body">
                <div class="layui-form layui-form-pane">
                  <div class="layui-form-item">
                    <label class="layui-form-label">网站名称</label>
                    <div class="layui-input-block">
                      <input value="<?php echo conf('title') ?>" type="text" name="title" autocomplete="o" placeholder="请输入内容" class="layui-input">
                    </div>
                  </div>
                 <div class="layui-form-item">
                    <label class="layui-form-label">网站后缀</label>
                    <div class="layui-input-block">
                      <input value="<?php echo conf('title2');?>" type="text" name="title2" autocomplete="off" placeholder="请输入内容" class="layui-input">
                    </div>
                  </div>
                  <div class="layui-form-item">
                    <label class="layui-form-label">关键词</label>
                    <div class="layui-input-block">
                      <input value="<?php echo conf('keywords');?>" type="text" name="keywords" autocomplete="off" placeholder="请输入内容" class="layui-input">
                    </div>
                  </div>
                   <div class="layui-form-item">
                    <label class="layui-form-label">网站描述</label>
                    <div class="layui-input-block">
                      <input value="<?php echo conf('description');?>" type="text" name="description" autocomplete="off" placeholder="请输入内容" class="layui-input">
                    </div>
                  </div>
                  <div class="layui-form-item">
                      <label class="layui-form-label">客服QQ</label>
                      <div class="layui-input-block">
                        <input value="<?php echo conf('qq');?>" type="text" name="qq" autocomplete="off" placeholder="请输入内容" class="layui-input">
                      </div>
                  </div>
                  <div class="layui-form-item">
                      <label class="layui-form-label">微信号</label>
                      <div class="layui-input-block">
                        <input value="<?php echo conf('wx');?>" type="text" name="wx" autocomplete="off" placeholder="请输入内容" class="layui-input">
                      </div>
                  </div>
                 <div class="layui-form-item">
                      <label class="layui-form-label">头像链接</label>
                      <div class="layui-input-block">
                        <input value="<?php echo conf('wxImg');?>" type="text" name="wxImg" autocomplete="off" placeholder="请输入头像链接" class="layui-input">
                      </div>
                  </div>
                  <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">模板全局底部  | 可用变量：{随机页面链接}</label>
                    <div class="layui-input-block">
                      <textarea placeholder="设置后可在全局页面底部显示" name="footer" class="layui-textarea"><?php echo conf('footer');?></textarea>
                    </div>
                  </div>
                 <br><hr><br>
                  <div class="layui-form-item">
                      <label class="layui-form-label">后台密码</label>
                      <div class="layui-input-block">
                        <input value="<?php echo conf('password');?>" type="text" name="password" autocomplete="off" placeholder="请输入内容" class="layui-input">
                      </div>
                  </div>
                  <center><button class="layui-btn" lay-submit="" lay-filter="configEdit">确定保存</button></center>
          </div>
    </div>
<script src="../public/static/layuiadmin/layui/layui.all.js"></script>
  <script>
  layui.config({
      base: '../public/static/layuiadmin/' //静态资源所在路径
    }).extend({
      index: 'lib/index' //主入口模块
    }).use(['index','form','table'], function(){
      var $ = layui.$
      ,table = layui.table
      ,layedit = layui.layedit
      ,laydate = layui.laydate
      ,form = layui.form
      ,admin = layui.admin
      ,element = layui.element
      ,layer = layui.layer;
      element.render();

       form.on('submit(configEdit)', function(data){
          title = data.field.title;
          title2 = data.field.title2;
          keywords = data.field.keywords;
          description = data.field.description;
          qq = data.field.qq;
          wx = data.field.wx;
          wxImg = data.field.wxImg;
          footer = data.field.footer;
          password = data.field.password;
          var load = layer.load({time:false});
          $.ajax({
                url: "./ajax.php?act=configEdit",
                data: {title,title2,keywords,description,qq,wx,wxImg,footer,password},
                type: "POST",
                dataType: "json",
                success: function(data){
                    layer.close(load);
                    if(data.code==1){
                      layer.msg(data.msg,{icon:6});
                    }else{
                      layer.msg(data.msg,{icon:5});
                    }
                },
                error: function(data){
                    layer.close(load);
                    layer.msg("未知错误");
                }
            });
        });
  });
  </script>
<?php 
	include 'foot.php';
?>