@using MySystem.BsModels;
@{SystemSet editData = ViewBag.data as SystemSet;}
@{
    string right = ViewBag.right as string;
}
<!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">
    <script src="/admin/js/jquery-1.10.1.min.js"></script>
</head>
<body style="background-color:#fff;">

    <div class="layui-form" style="padding: 20px 0 0 0;">
        <form class="layui-form" id="confirmFrm">
            <input type="hidden" name="Id" value="@editData.Id" />
            <div class="layui-card">
          <div class="layui-card-body">
        <div class="layui-tab" lay-filter="mytabbar">
                <ul class="layui-tab-title">
                    <li class="layui-this" lay-id="1">基本信息</li>
                    <li lay-id="2">上传</li>
                    <!-- <li lay-id="3">模板设置</li>
                    <li lay-id="4">App设置</li> -->
                </ul>
                <div class="layui-tab-content mt20">
                    <div class="layui-tab-item layui-show">
                        <div class="layui-form-item">
                            <label class="layui-form-label">网站地址</label>
                            <div class="layui-input-block">
                                <input class="layui-input" type="text" id="WebUrl" name="WebUrl" value="@editData.WebUrl" maxlength="200" lay-verify="" autocomplete="off" placeholder="请输入网站地址">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">网站名称</label>
                            <div class="layui-input-block">
                                <input class="layui-input" type="text" id="WebName" name="WebName" value="@editData.WebName" maxlength="50" lay-verify="" autocomplete="off" placeholder="请输入网站名称">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">首页关键词</label>
                            <div class="layui-input-block">
                                <input class="layui-input" type="text" id="IndexKeyword" name="IndexKeyword" value="@editData.IndexKeyword" maxlength="200" lay-verify="" autocomplete="off" placeholder="请输入首页关键词">
                            </div>
                        </div>
                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">首页简介</label>
                            <div class="layui-input-block">
<textarea class="layui-textarea" id="IndexDescription" name="IndexDescription" lay-verify="" placeholder="请输入首页简介">@editData.IndexDescription</textarea>
                            </div>
                        </div>
                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">版权信息</label>
                            <div class="layui-input-block">
<textarea class="layui-textarea" id="RightInfo" name="RightInfo" lay-verify="" placeholder="请输入版权信息">@editData.RightInfo</textarea>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">企业地址</label>
                            <div class="layui-input-block">
                                <input class="layui-input" type="text" id="Address" name="Address" value="@editData.Address" maxlength="100" lay-verify="" autocomplete="off" placeholder="请输入企业地址">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">联系电话</label>
                            <div class="layui-input-block">
                                <input class="layui-input" type="text" id="Phone" name="Phone" value="@editData.Phone" maxlength="100" lay-verify="" autocomplete="off" placeholder="请输入联系电话">
                            </div>
                        </div>
                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">网站统计代码</label>
                            <div class="layui-input-block">
<textarea class="layui-textarea" id="WebStatCode" name="WebStatCode" lay-verify="" placeholder="请输入网站统计代码">@editData.WebStatCode</textarea>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">Logo图片</label>
                            <div class="layui-input-block">
                                <div class="layui-upload">
                                    <input type="hidden" id="Logo" name="Logo" value="@editData.Logo">
                                    <button class="layui-btn" type="button" id="LogoBtn">选择图片</button>
                                    <div class="layui-inline layui-word-aux"></div>
                                </div>
                                <div class="mt10" id="LogoImage">
                                    @if (!string.IsNullOrEmpty(editData.Logo))
                                    {
                                        <img src="@(MySystem.OssHelper.Instance.SourceHost)@editData.Logo" class="layui-upload-img" style="max-width:85px; max-height:85px;" onclick="showBigPic('@(MySystem.OssHelper.Instance.SourceHost)@editData.Logo')">
                                    }
                                </div>
                            </div>
                        </div>

                    </div>
                    <div class="layui-tab-item">                        
                        <div class="layui-form-item">
                            <label class="layui-form-label">是否上传到OSS</label>
                            <div class="layui-input-block">
                                <input type="checkbox" id="UploadOss" name="UploadOss" value="1" @(editData.UploadOss == 1 ? "checked=checked" : "") lay-skin="switch" lay-filter="switchTest" title="开关">
                            </div>
                        </div>
                        <!-- <div class="layui-form-item">
                            <label class="layui-form-label">允许上传类型</label>
                            <div class="layui-input-block">
                                <input class="layui-input" type="text" id="UploadExt" name="UploadExt" value="@editData.UploadExt" maxlength="100" lay-verify="" autocomplete="off" placeholder="请输入允许上传类型">
                            </div>
                        </div> -->
                        <div class="layui-form-item">
                            <label class="layui-form-label">允许最大上传</label>
                            <div class="layui-input-inline">
                                <input class="layui-input" type="text" id="UploadMaxSize" name="UploadMaxSize" value="@editData.UploadMaxSize" maxlength="20" lay-verify="integer;" autocomplete="off" placeholder="请输入允许最大上传">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">自动缩略图</label>
                            <div class="layui-input-block">
                                <input type="checkbox" id="UploadAutoZoom" name="UploadAutoZoom" value="1" @(editData.UploadAutoZoom == 1 ? "checked=checked" : "") lay-skin="switch" lay-filter="switchTest" title="开关">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">自动缩略图宽</label>
                            <div class="layui-input-inline">
                                <input class="layui-input" type="text" id="UploadAutoZoomWidth" name="UploadAutoZoomWidth" value="@editData.UploadAutoZoomWidth" maxlength="20" lay-verify="required;integer;" autocomplete="off" placeholder="请输入自动缩略图宽">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">自动缩略图高</label>
                            <div class="layui-input-inline">
                                <input class="layui-input" type="text" id="UploadAutoZoomHeight" name="UploadAutoZoomHeight" value="@editData.UploadAutoZoomHeight" maxlength="20" lay-verify="required;integer;" autocomplete="off" placeholder="请输入自动缩略图高">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">自动缩略图质量</label>
                            <div class="layui-input-inline">
                                <input class="layui-input" type="text" id="UploadAutoZoomQuality" name="UploadAutoZoomQuality" value="@editData.UploadAutoZoomQuality" maxlength="20" lay-verify="required;integer;" autocomplete="off" placeholder="自动缩略图质量">
                            </div>
                        </div>
                        <!-- <div class="layui-form-item">
                            <label class="layui-form-label">自动水印</label>
                            <div class="layui-input-block">
                                <input type="checkbox" id="UploadAutoWater" name="UploadAutoWater" value="1" @(editData.UploadAutoWater == 1 ? "checked=checked" : "") lay-skin="switch" lay-filter="switchTest" title="开关">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">水印位置</label>
                                <div class="layui-input-inline">
                                    <select id="UploadWaterPosition" name="UploadWaterPosition" lay-search="">
                                        <option value="">请选择</option>
                                    </select>
                                    <script>$("#UploadWaterPosition").val("@editData.UploadWaterPosition");</script>
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">水印图片</label>
                            <div class="layui-input-block">
                                <div class="layui-upload">
                                    <input type="hidden" id="UploadWaterPath" name="UploadWaterPath" value="@editData.UploadWaterPath">
                                    <button class="layui-btn" type="button" id="UploadWaterPathBtn">选择图片</button>
                                    <div class="layui-inline layui-word-aux"></div>
                                </div>
                                <div class="mt10" id="UploadWaterPathImage">
                                    @if (!string.IsNullOrEmpty(editData.UploadWaterPath))
                                    {
                                        <img src="@(MySystem.OssHelper.Instance.SourceHost)@editData.UploadWaterPath" class="layui-upload-img" style="max-width:85px; max-height:85px;" onclick="showBigPic('@(MySystem.OssHelper.Instance.SourceHost)@editData.UploadWaterPath')">
                                    }
                                </div>
                            </div>
                        </div> -->
                    </div>
                    @*<div class="layui-tab-item">
                        <div class="layui-form-item">
                            <label class="layui-form-label">主题目录</label>
                            <div class="layui-input-block">
                                <input class="layui-input" type="text" id="TempPath" name="TempPath" value="@editData.TempPath" maxlength="50" lay-verify="" autocomplete="off" placeholder="请输入主题目录">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">主题目录(移动)</label>
                            <div class="layui-input-block">
                                <input class="layui-input" type="text" id="TempPathM" name="TempPathM" value="@editData.TempPathM" maxlength="50" lay-verify="" autocomplete="off" placeholder="请输入主题目录(移动)">
                            </div>
                        </div>
                    </div>
                    <div class="layui-tab-item">
                        <div class="layui-form-item">
                            <label class="layui-form-label">App启动图片</label>
                            <div class="layui-input-block">
                                <div class="layui-upload">
                                    <input type="hidden" id="StartAdPhoto" name="StartAdPhoto" value="@editData.StartAdPhoto">
                                    <button class="layui-btn" type="button" id="StartAdPhotoBtn">选择图片</button>
                                    <div class="layui-inline layui-word-aux"></div>
                                </div>
                                <div class="mt10" id="StartAdPhotoImage">
                                    @if (!string.IsNullOrEmpty(editData.StartAdPhoto))
                                    {
                                        <img src="@editData.StartAdPhoto" class="layui-upload-img" style="max-width:85px; max-height:85px;" onclick="showBigPic('@editData.StartAdPhoto')">
                                    }
                                </div>
                            </div>
                        </div>
                    </div>*@

                </div>
            </div>
            <div class="layui-form-item ml10">
                <div class="layui-input-block">
                    <button type="button" class="layui-btn" onclick="save()">立即提交</button>
                </div>
            </div>
        </form>
    </div>

    <script src="/layuiadmin/layui/layui.js"></script>
    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js"></script>
    <script src="/other/mybjq/kindeditor-min.js"></script>
    <script src="/other/mybjq/lang/zh_CN.js"></script>
    <script>
        function save() {
            var index = layer.load(1, {
                shade: [0.5, '#000']
            });
            var userdata = $("#confirmFrm").serialize();
            $.ajax({
                type: "POST",
                url: "/Admin/SystemSet/Edit?r=" + Math.random(1),
                data: userdata,
                dataType: "text",
                success: function (data) {
                    layer.close(index); //关闭弹层
                    if (data == "success") {
                        layer.msg("修改成功");
                    } else {
                        layer.msg(data);
                    }
                }
            });
        }

        //编辑器
        KindEditor.ready(function (K) {

        });

        var ids = "";
        function getChildren(obj) {
            $.each(obj, function (index, value) {
                var id = obj[index].id;
                ids += id + ",";
                var children = obj[index].children;
                if (children) {
                    getChildren(children);
                }
            });
        }

        function movePrev(obj, tagId) {
            $(obj).parent().prev().insertAfter($(obj).parent());
            checkPics(tagId);
        }
        function moveNext(obj, tagId) {
            $(obj).parent().next().insertBefore($(obj).parent());
            checkPics(tagId);
        }
        function deletePic(obj, tagId) {
            $(obj).parent().remove();
            checkPics(tagId);
        }
        function checkPics(tagId) {
            var pics = "";
            var texts = "";
            $("#" + tagId + "Image div img").each(function (i) {
                pics += $(this).attr("src") + "|";
            });
            $("#" + tagId + "Image div input").each(function (i) {
                texts += $(this).val() + "|";
            });
            if (pics == "") {
                $("#" + tagId).val("");
            } else {
                pics = pics.substring(0, pics.length - 1);
                texts = texts.substring(0, pics.length - 1);
                $("#" + tagId).val(pics + "#cut#" + texts);
            }
        }
        function showBigPic(picpath) {
            parent.layer.open({
                type: 1,
                title: false,
                closeBtn: 0,
                shadeClose: true,
                area: ['auto', 'auto'],
                content: '<img src="' + picpath + '" style="max-width:800px; max-height:800px;" />'
            });
        }

        
        var upload;
        layui.config({
            base: '/layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'upload', 'layedit', 'laydate', 'element', 'croppers', 'transfer', 'tree', 'util'], function () {
            var $ = layui.$;
            var element = layui.element;
            upload = layui.upload;

            //Hash地址的定位
            var layid = location.hash.replace(/^#test=/, '');
            element.tabChange('test', layid);
            element.on('tab(test)', function (elem) {
                location.hash = 'test=' + $(this).attr('lay-id');
            });

            //日期


            //上传文件
            WebUploadJs('UploadWaterPathBtn', '@(Library.ConfigurationManager.AppSettings["Database"].ToString())/upload', {}, {},  function (filename) {
                $('#UploadWaterPathImage').html('<img src="' + osshost + filename + '" class="layui-upload-img" style="max-width:85px; max-height:85px;" onclick="showBigPic(\'' + osshost + filename + '\')">')
                $('#UploadWaterPath').val(filename);
            });
            WebUploadJs('LogoBtn', '@(Library.ConfigurationManager.AppSettings["Database"].ToString())/upload', {}, {},  function (filename) {
                $('#LogoImage').html('<img src="' + osshost + filename + '" class="layui-upload-img" style="max-width:85px; max-height:85px;" onclick="showBigPic(\'' + osshost + filename + '\')">')
                $('#Logo').val(filename);
            });
            upload.render({
                elem: '#StartAdPhotoBtn',
                url: '/Admin/SystemSet/UploadPhoto',
                multiple: false,
                done: function (res) {
                    $('#StartAdPhotoImage').html('<img src="' + res.obj + '" class="layui-upload-img" style="max-width:85px; max-height:85px;" onclick="showBigPic(' + res.obj + ')">')
                    $('#StartAdPhoto').val(res.obj);
                }
            });


            //穿梭框


            //TreeView，比如权限管理

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