{{# settings}}
<!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, maximum-scale=1">
    <link rel="stylesheet" href="{{resource}}/mini/lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="{{resource}}/mini/css/public.css" media="all">
    <style>
        .layui-form-item .layui-input-company {
            width: auto;
            padding-right: 10px;
            line-height: 38px;
        }
    </style>
</head>

<body>
    <div class="layuimini-container">
        <div class="layuimini-main">

            <div class="layui-form">
                <div class="layui-form-item">
                    <label class="layui-form-label required">网站名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="sitename" lay-verify="required" lay-reqtext="网站名称不能为空"
                            placeholder="请输入网站名称" value="{{site_title}}" class="layui-input">
                        <tip>填写自己部署网站的名称。</tip>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label required">网站域名</label>
                    <div class="layui-input-block">
                        <input type="text" name="domain" readonly lay-verify="required" lay-reqtext="网站域名不能为空"
                            placeholder="请输入网站域名" value="{{domain}}" class="layui-input">
                        <tip>系统将自动识别域名，不支持手动设置。</tip>

                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">缓存时间</label>
                    <div class="layui-input-inline" style="width: 80px;">
                        <input type="number" name="cache" lay-verify="number" value="{{site_cache_time}}"
                            class="layui-input">
                    </div>
                    <div class="layui-input-inline layui-input-company">分钟</div>
                    <div class="layui-form-mid layui-word-aux">系统将对部分常用数据进行缓存。</div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">备用设置</label>
                    <div class="layui-input-block">
                        <input type="text" name="csetting" value="待更新的功能" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label required">系统公告</label>
                    <div class="layui-input-block">
                        <textarea name="notice" lay-verify="required" lay-reqtext="站点公告不能为空"
                            class="layui-textarea">{{site_notice}}</textarea>
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label required">版权信息</label>
                    <div class="layui-input-block">
                        <textarea name="copyright" lay-verify="required" lay-reqtext="版权信息不能为空"
                            class="layui-textarea">{{site_copyright}}</textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="setting">确认保存</button>
                        <button class="layui-btn layui-btn-normal"
                            layuimini-content-href="{{domain}}/admin/page?which=develop-setting"
                            data-title="高级配置">高级配置</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="{{resource}}/mini/lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
    <script>

        layui.config().extend({
            'miniTab': '{{resource}}/mini/js/lay-module/layuimini/miniTab'
        });

        layui.use(['form', 'miniTab'], function () {
            var form = layui.form,
                $ = layui.jquery,
                miniTab = layui.miniTab,
                layer = layui.layer;

            miniTab.listen();

            //监听提交
            form.on('submit(setting)', function (data) {
                var result = data.field;

                // 数据列表
                var title = result.sitename;
                var cache = result.cache;
                var notice = result.notice;
                var copyright = result.copyright;

                $.post('{{domain}}/admin/api/settings?do=update', {
                    title: title,
                    cache: cache,
                    notice: notice,
                    copyright: copyright
                }, function (res) {
                    if (res.data == 'OK') {
                        layer.msg('设置更新成功!');
                    } else {
                        layer.msg(res.msg + '...');
                    }
                });

            });

        });
    </script>
</body>

</html>
{{/ settings}}