@{
    string RightInfo = ViewBag.RightInfo as string;
    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>
    <script src="/admin/js/LAreaData2.js"></script>
</head>

<body>

    <div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin">

        <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>
                    </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-inline">
                                    <select id="MsgType" name="MsgType" lay-search="" lay-filter="MsgType">
                                        <option value="">请选择</option>
                                        <option value="1" selected="selected">文本</option>
                                        <option value="2">图片</option>
                                        <option value="3">动图</option>
                                    </select>
                                </div>
                            </div>
                            <div class="layui-form-item" id="Titles">
                                <label class="layui-form-label">标题</label>
                                <div class="layui-input-inline">
                                    <input class="layui-input" type="text" id="Title" name="Title" maxlength="50"
                                        lay-verify="" autocomplete="off" placeholder="请输入标题">
                                </div>
                            </div>
                            @* <div class="layui-form-item layui-form-text" id="Title">
                                <label class="layui-form-label">简介</label>
                                <div class="layui-input-block">
                                <textarea class="layui-textarea" id="Summary" name="Summary" maxlength="500"
                                lay-verify="" placeholder="请输入简介"></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="Content" name="Content" placeholder="请输入内容"
                                        style="width:100%;height:500px;"></textarea>
                                </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="EffectStartDate" name="EffectStartDate"
                                        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="EffectEndDate" name="EffectEndDate"
                                        lay-verify="" autocomplete="off" placeholder="请输入有效结束时间">
                                </div>
                            </div>
                            <div class="layui-form-item" id="BgPics" style="display: none;">
                                <label class="layui-form-label">背景图片</label>
                                <div class="layui-input-block">
                                    <div class="layui-upload">
                                        <input type="hidden" id="BgPic" name="BgPic" value="">
                                        <button class="layui-btn" type="button" id="BgPicBtn">选择图片</button>
                                        <div class="layui-inline layui-word-aux">@(new MySystem.PublicFunction().GetUploadHint("MsgAlertBgPic"))</div>
                                    </div>
                                    <div style="margin-top:10px;" id="BgPicImage">
                                    </div>
                                </div>
                            </div>
                            @* <div class="layui-form-item">
                                <label class="layui-form-label">推送类型</label>
                                <div class="layui-input-inline">
                                <select id="PushType" name="PushType" lay-search="">
                                <option value="">请选择</option>
                                <option value="0">不推送</option>
                                <option value="1">立即推送</option>
                                <option value="2">定时推送</option>
                                </select>
                                </div>
                                </div>
                                <div class="layui-form-item">
                                <label class="layui-form-label">推送标记</label>
                                <div class="layui-input-inline">
                                <select id="PushFlag" name="PushFlag" lay-search="">
                                <option value="">请选择</option>
                                <option value="0">不推送</option>
                                <option value="1">未推送</option>
                                <option value="2">已推送</option>
                                </select>
                                </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="PushParam" name="PushParam"
                                maxlength="255" 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="PushTime" name="PushTime" 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="ExtendColumn" name="ExtendColumn" maxlength=""
                                lay-verify="" placeholder="请输入扩展字段"></textarea>
                                </div>
                                </div> *@
                            <div class="layui-form-item">
                                <label class="layui-form-label">跳转Url参数</label>
                                <div class="layui-input-inline">
                                    <input class="layui-input" type="text" id="UrlParam" name="UrlParam" maxlength="200"
                                        lay-verify="" autocomplete="off" placeholder="请输入跳转Url参数">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">跳转Url</label>
                                <div class="layui-input-inline">
                                    <input class="layui-input" type="text" id="Url" name="Url" maxlength="500"
                                        lay-verify="" autocomplete="off" placeholder="请输入跳转Url">
                                </div>
                            </div>
                            <div class="layui-form-item" id="Button">
                                <label class="layui-form-label">按钮文字</label>
                                <div class="layui-input-inline">
                                    <input class="layui-input" type="text" id="BtnText" name="BtnText" maxlength="50"
                                        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="TimeByDay" name="TimeByDay"
                                        maxlength="20" lay-verify="" autocomplete="off" placeholder="请输入每日次数">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">是否周末</label>
                                <div class="layui-input-inline">
                                    <input type="checkbox" id="IsWeekend" name="IsWeekend" value="1" 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 type="checkbox" id="AlertFlag" name="AlertFlag" value="1" lay-skin="switch"
                                        lay-filter="AlertFlag" title="开关">
                                </div>
                            </div>
                            <div class="layui-form-item" id="MakerCode" style="display: none;">
                                <label class="layui-form-label">指定推送创客编号</label>
                                <div class="layui-input-block">
                                    <textarea class="layui-textarea" lay-verify="" name="MakerCodes" id="MakerCodes" placeholder="请输入创客编号,多个创客编号用回车隔开"></textarea>
                                </div>
                            </div>

                        </div>

                    </div>
                </div>
                <div class="layui-form-item layui-hide">
                    <input type="button" lay-submit lay-filter="LAY-list-front-submit" id="LAY-list-front-submit"
                        value="确认">
                </div>
            </div>
        </div>
    </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>
        //内容
        @(Html.Raw(Library.Control.kindeditorVar("Content")))


            //编辑器
            KindEditor.ready(function (K) {
                //内容
                @(Html.Raw(Library.Control.kindeditor("Content", 1)))

        });

        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 AreasProvinceInit(tagId, areasVal, form) {
            for (var i = 0; i < provs_data.length; i++) {
                var sel = "";
                if (areasVal.indexOf(provs_data[i].text) > -1) {
                    sel = " selected=selected";
                }
                $("#" + tagId + "Province").append('<option value="' + provs_data[i].value + '"' + sel + '>' + provs_data[i].text + '</option>');
            }
            form.render();
        }

        function AreasProvinceSelected(tagId, areasVal, form, value) {
            $("#" + tagId + "City").html('<option value="">市</option>');
            var list = citys_data[value];
            for (var i = 0; i < list.length; i++) {
                var sel = "";
                if (areasVal.indexOf(list[i].text) > -1) {
                    sel = " selected=selected";
                }
                $("#" + tagId + "City").append('<option value="' + list[i].value + '"' + sel + '>' + list[i].text + '</option>');
            }
            $("#" + tagId + "Area").html('<option value="">县/区</option>');
            form.render();
            $("#" + tagId + "").val($("#" + tagId + "Province option:selected").text() + "," + $("#" + tagId + "City option:selected").text() + "," + $("#" + tagId + "Area option:selected").text());
        }

        function AreasCitySelected(tagId, areasVal, form, value) {
            $("#" + tagId + "Area").html('<option value="">县/区</option>');
            var list = dists_data[value];
            for (var i = 0; i < list.length; i++) {
                var sel = "";
                if (areasVal.indexOf(list[i].text) > -1) {
                    sel = " selected=selected";
                }
                $("#" + tagId + "Area").append('<option value="' + list[i].value + '"' + sel + '>' + list[i].text + '</option>');
            }
            form.render();
            $("#" + tagId + "").val($("#" + tagId + "Province option:selected").text() + "," + $("#" + tagId + "City option:selected").text() + "," + $("#" + tagId + "Area option:selected").text());
        }

        function AreasAreaSelected(tagId, form) {
            form.render();
            $("#" + tagId + "").val($("#" + tagId + "Province option:selected").text() + "," + $("#" + tagId + "City option:selected").text() + "," + $("#" + tagId + "Area option:selected").text());
        }
        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").replace(osshost, '') + "|";
            });
            $("#" + 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 checkBox(tagId) {
            var text = "";
            $("input[type=checkbox][name=" + tagId + "List]:checked").each(function (i) {
                text += $(this).val() + ",";
            });
            $("#" + tagId).val(text);
        }
        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 tree;
        var element;
        var upload;
        layui.config({
            base: '/layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'upload', 'layedit', 'laydate', 'element', 'croppers', 'transfer', 'tree', 'util'], function () {
            var $ = layui.$
                , form = layui.form
                , layer = layui.layer
                , layedit = layui.layedit
                , laydate = layui.laydate
                , croppers = layui.croppers
                , transfer = layui.transfer
                , util = layui.util;
            tree = layui.tree;
            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');
            });

            form.on('select(MsgType)', function (data) {
                if (data.value == '1') {
                    $('#Titles').show();
                    $('#BgPics').hide();
                    $('#Button').show();
                } else if (data.value == '2') {
                    $('#Titles').show();
                    $('#BgPics').show();
                    $('#Button').hide();
                }
                else if (data.value == '3') {
                    $('#Titles').show();
                    $('#BgPics').show();
                    $('#Button').hide();
                }
                form.render();
            });

            form.on('switch(AlertFlag)', function (data) {
                console.log(data);
                if (this.checked) {
                    $('#MakerCode').css('display', 'block');
                } else {
                    $('#MakerCode').css('display', 'none');
                }
                form.render();
            });

            //日期
            laydate.render({
                elem: '#EffectStartDate',
                type: 'datetime',
                trigger: 'click'
            });
            laydate.render({
                elem: '#EffectEndDate',
                type: 'datetime',
                trigger: 'click'
            });
            laydate.render({
                elem: '#PushTime',
                type: 'datetime',
                trigger: 'click'
            });


            //上传文件
            WebUploadJs('BgPicBtn', '@(Library.ConfigurationManager.AppSettings["Database"].ToString())/upload', @(Html.Raw(new MySystem.PublicFunction().GetUploadParam("MsgAlertBgPic"))), function (filename) {
                $('#BgPicImage').html('<img src="' + osshost + filename + '" class="layui-upload-img" style="max-width:85px; max-height:85px;" onclick="showBigPic(\'' + osshost + filename + '\')">')
                $('#BgPic').val(filename);
            });


            //穿梭框


            //TreeView，比如权限管理


            //省市区

        })

    </script>
</body>

</html>
