<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>系统设置</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
</head>
<body>

  <div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body" pad15>
        <div class="layui-row layui-col-space15">
          <div class="layui-col-md12">

              <table class="layui-table">
                    <tr>
                        <td class="cell" width="120">隐私声明：</td>
                        <td class="cell">
                            <button class="layui-btn" id="btn_privacy_statement">设置</button>
                        </td>
                    </tr>
                </table>

              <form class="layui-form" action="" lay-filter="component-form-element">
                <table class="layui-table">
                    <tr>
                        <td class="cell" width="120">短信SIGN：</td>
                        <td class="cell">
                            <input type="text" id="id_sms_sign" name="sms_sign" lay-verify="required" autocomplete="off" class="layui-input">
                        </td>
                    </tr>
                    <tr>
                        <td class="cell">短信TOKEN：</td>
                        <td class="cell">
                            <input type="text" id="id_sms_token" name="sms_token" lay-verify="required" autocomplete="off" class="layui-input">
                        </td>
                    </tr>
                    <tr>
                        <td class="cell"></td>
                        <td class="cell">
                            <button class="layui-btn" lay-submit lay-filter="component-form-element">保存设置</button>
                        </td>
                    </tr>
                </table>
              </form>
          </div>
        </div>
        </div>
    </div>
  </div>

  <script src="../../layuiadmin/layui/layui.js?t=1"></script>
  <script>
  layui.config({
    base: '../../../layuiadmin/'
  }).extend({
    index: 'lib/index'
  }).use(['index', 'form'], function(){
    var $ = layui.$
    ,form = layui.form
    ,admin = layui.admin;

    admin.req({
      url: '/wechat/'
      ,type: 'get'
      ,done: function(res){
        var data = res.data;
        for (var k in data) {
            var v = data[k];
            $('#id_' + k).val(v);
        }
        form.render();
      }
    });

    form.on('submit(component-form-element)', function(data){
      admin.req({
        url: '/wechat/'
        ,data: data.field
        ,type: 'put'
        ,done: function(res){
            layer.msg('保存成功！', {icon: 6});
        }
    });

      return false;
    });


    $('#btn_privacy_statement').on('click', function(){
        layer.open({
          type: 2,
          title: '隐私声明',
          shadeClose: false,
          area: ['70%', '95%'],
          btn: ['保存', '取消'],
          yes: function (index, dom) {
            layui.onSubmitChild = function (data) {
                layer.close(index);
              };
              layui.submitChild();
          },
          btn2: function(index, layero){
            layer.close(index);//关闭当前按钮
          },
          content: 'privacy_statement.html'
        });
    });

  });
  </script>
</body>
</html>

