<!DOCTYPE html>
<!--[if IE 8]>
<html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]>
<html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html>
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
    <base href="#springUrl('/assets/adminlte/')"/>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>工作台</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.5 -->
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="plugins/font-awesome/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="plugins/ionicons/css/ionicons.min.css">

    <!-- DataTables -->
    <link rel="stylesheet" href="plugins/datatables/dataTables.bootstrap.css">

    <!-- Theme style -->
    <link rel="stylesheet" href="dist/css/AdminLTE.min.css">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
         folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
    <!-- iCheck -->
    <link rel="stylesheet" href="plugins/iCheck/flat/blue.css">
    <!-- Date Picker -->
    <link rel="stylesheet" href="plugins/datepicker/datepicker3.css">
    <!-- Daterange picker -->
    <link rel="stylesheet" href="plugins/daterangepicker/daterangepicker-bs3.css">
    <!-- bootstrap wysihtml5 - text editor -->
    <link rel="stylesheet" href="plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
    <!--validate css-->
    <link rel="stylesheet" href="plugins/jquery-validation/css/validate.css">
    <!--fileinput css-->
    <link rel="stylesheet" href="plugins/fine-uploader/css/fine-uploader-new.css">
    <link rel="stylesheet" href="plugins/bootstrap-fileinput/fileinput.min.css">
    <!-- ztree css -->
    <link rel="stylesheet"
          href="plugins/ztree/css/metroStyle/metroStyle.css" type="text/css"/>
    <script src="plugins/fine-uploader/javascript/fine-uploader.min.js"></script>
</head>
<!-- END HEAD -->
<body class="hold-transition skin-blue sidebar-mini">
<div id="hiddenDiv" style="display:none">$!{data.personContent}</div>
<div id="hiddenDiv2" style="display:none">$!{data.speechContent}</div>
<div class="wrapper">
    <div class="content-wrapper" style="margin-left:0;">

        <section class="content-header">
            <h1>
                品牌申请服务协议
                <small>品牌申请服务协议</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i>首页</a></li>
                <li><a class="active">品牌申请服务协议</a></li>
            </ol>
        </section>
        <!--  -->
        <div id="preview" style="display: none;">
            <div class="file-preview-frame krajee-default  kv-preview-thumb" id="preview-1564565809482-0"
                 data-fileindex="0" data-template="video">
                <div class="kv-file-content">
                    <video class="kv-preview-data file-preview-video" width="213px" height="160px" controls="">
                        <source src="$!{data.name}">
                        <div class="file-preview-other">
                            <span class="file-other-icon"><i class="glyphicon glyphicon-file"></i></span>
                        </div>
                    </video>
                </div>
                <div class="file-thumbnail-footer" style="height: auto;">
                    <div class="file-footer-caption" style="display: none;">5ead81cfe804c1f62166c0e7ebf3a1a0.mp4<br>
                        <samp>(857.67 KB)</samp></div>
                    <div class="file-thumb-progress hide">
                        <div class="progress">
                            <div class="progress-bar progress-bar-success progress-bar-striped active"
                                 role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"
                                 style="width:0%;">
                                初始化...
                            </div>
                        </div>
                    </div>
                    <div class="file-upload-indicator" style="display: none;" title="没有上传"><i
                            class="glyphicon glyphicon-hand-down text-warning"></i></div>

                    <div class="file-actions">
                        <div class="file-footer-buttons">
                            <button type="button" class="kv-file-remove btn btn-xs btn-default" title="删除文件"><i
                                    class="glyphicon glyphicon-trash text-danger"></i></button>
                            <button type="button" style="display: none;" class="kv-file-zoom btn btn-xs btn-default"
                                    title="查看详情"><i class="glyphicon glyphicon-zoom-in"></i></button>
                        </div>
                        <div class="clearfix"></div>
                    </div>
                </div>
            </div>
        </div>

        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-xs-12">
                    <!-- general form elements disabled -->
                    <div class="box box-primary">
                        <form role="form" id="qq-form" enctype="multipart/form-data" method="post">
                            <input name="id" value="$!{data.id}" hidden="true"/>
                            <div class="box-body">

                                <div class="form-group form-md-line-input col-md-12">
                                    <label>品牌申请服务说明</label>
                                    <script id="ueditor2" type="text/plain"></script>
                                </div>


                                <div class="form-group form-md-line-input col-md-12 ">
                                    <input id="input-repl-3a" name="videoFileAddress" type="file"
                                           accept="mp4,avi,dat,3gp,mov,rmvb"/>
                                </div>
                                <input name="status" value="2" style="display: none;">

                                <input name="name" value="$!{data.name}" style="display: none;">
                                <textarea name = "personContent" style="display: none;"></textarea>
                                <textarea name = "speechContent" style="display: none;"></textarea>

                                <input name="cosconfigId" value="3" style="display: none;">

                                <div class="form-group form-md-line-input col-md-12">
                                    <label>品牌申请服务协议</label>
                                    <script id="ueditor" type="text/plain"></script>
                                </div>
                            </div>
                            <div class="box-footer">
                                #if($shiro.hasPermission("qy:common:agreement:edit"))
                                <input class="btn btn-primary" id="save" value="保存" type="submit">
                                #end
                            </div>
                        </form>
                        <!-- /.box-body -->
                    </div><!-- /.box -->


                </div><!-- /.col -->
            </div><!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->


    <!-- Add the sidebar's background. This div must be placed
         immediately after the control sidebar -->
    <div class="control-sidebar-bg"></div>
</div><!-- ./wrapper -->

<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables/extensions/i18n/lanauage_ch.js"></script>
<script src="plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="plugins/fastclick/fastclick.min.js"></script>
<!--fileinput js-->
<script src="plugins/bootstrap-fileinput/bootstrap-fileinput.js"></script>
<script src="plugins/bootstrap-fileinput/fileinput.js"></script>
<script src="plugins/bootstrap-fileinput/zh.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/app.min.js"></script>
<script src="plugins/bootstrap-maxlength/bootstrap-maxlength.min.js" type="text/javascript"></script>
<script src="plugins/security/sha256.js" type="text/javascript"></script>
<script src="plugins/jquery-validation/js/jquery.validate.min.js"></script>
<script src="js/jquery.form.min.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.all.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/lang/zh-cn/zh-cn.js"></script>
<script src="common/js/cfapp.js"></script>
<script src="js/jquery.serializejson.js"></script>
<script>
    var ue = null;
    var ue2 = null;
    $("#input-repl-3a").fileinput({
        dropZoneTitle: "请上传小于100M的视频！",
        uploadUrl: "saveVideoAddress",
        language: "zh",
        autoReplace: true,
        showCaption: false,
        showUpload: false,
        overwriteInitial: true,
        showUploadedThumbs: true,
        //showPreview:false,      ss             //显示上传图片的大小信息
        maxFileCount: 1,
        minFileCount: 1,
        maxFileSize: 153600,//文件最大153600kb=150M
        initialPreviewShowDelete: false,
        showRemove: false,//是否显示删除按钮
        showClose: false,
        layoutTemplates: {
            actionUpload: '',
        },
        allowedFileExtensions: ["mp4", "avi", "dat", "3gp", "mov", "rmvb"],
        previewSettings: {
            image: {
                width: "100%",
                height: "100%"
            },
        }
    });


    $().ready(function () {
        var url = "$!{data.name}";
        if (url && url != null && url != '') {
            $(".file-preview-thumbnails").html($("#preview").html());
            $(".file-drop-zone-title").hide();
        }
        $(".file-preview-thumbnails").on("click", ".kv-file-remove", function () {
            $(this).parents(".file-preview-frame").remove();
            $("input[name='name']").val('');
            $(".file-drop-zone-title").show();
        })
    });
</script>
<script>
    $().ready(function () {
        ue = UE.getEditor('ueditor', {
            toolbars: [[
                'insertimage',
                'insertvideo',
                'redo', //重做
                'bold', //加粗
                'indent', //首行缩进
                'italic', //斜体
                'underline', //下划线
                'strikethrough', //删除线
                'subscript', //下标
                'fontborder', //字符边框
                'superscript', //上标
                'formatmatch', //格式刷
                'source', //源代码
                'blockquote', //引用
                'pasteplain', //纯文本粘贴模式
                'selectall', //全选
                'print', //打印
                'preview', //预览
                'horizontal', //分隔线
                'removeformat', //清除格式
                'time', //时间
                'date', //日期
                'unlink', //取消链接
                'insertrow', //前插入行
                'insertcol', //前插入列
                'mergeright', //右合并单元格
                'mergedown', //下合并单元格
                'deleterow', //删除行
                'deletecol', //删除列
                'splittorows', //拆分成行
                'splittocols', //拆分成列
                'splittocells', //完全拆分单元格
                'deletecaption', //删除表格标题
                'inserttitle', //插入标题
                'mergecells', //合并多个单元格
                'deletetable', //删除表格
                'cleardoc', //清空文档
                'insertparagraphbeforetable', //"表格前插入行"
                'insertcode', //代码语言
                'fontfamily', //字体
                'fontsize', //字号
                'paragraph', //段落格式
                'edittable', //表格属性
                'edittd', //单元格属性
                'link', //超链接
                'emotion', //表情
                'spechars', //特殊字符
                'insertvideo', //视频

                'justifyleft', //居左对齐
                'justifyright', //居右对齐
                'justifycenter', //居中对齐
                'justifyjustify', //两端对齐
                'forecolor', //字体颜色
                'backcolor', //背景色
                'insertorderedlist', //有序列表
                'insertunorderedlist', //无序列表
                'fullscreen', //全屏
                'directionalityltr', //从左向右输入
                'directionalityrtl', //从右向左输入
                'rowspacingtop', //段前距
                'rowspacingbottom', //段后距
                'pagebreak', //分页
                'insertframe', //插入Iframe
                'imagenone', //默认
                'imageleft', //左浮动
                'imageright', //右浮动
                'attachment', //附件
                'imagecenter', //居中
                'wordimage', //图片转存
                'lineheight', //行间距
                'edittip ', //编辑提示
                'customstyle', //自定义标题
                'autotypeset', //自动排版
                'touppercase', //字母大写
                'tolowercase', //字母小写

                'inserttable', //插入表格
                'drafts', // 从草稿箱加载
                'charts', // 图表
            ]]
        });
        ue2 = UE.getEditor('ueditor2', {
            toolbars: [[
                'insertimage',
                'insertvideo',
                'redo', //重做
                'bold', //加粗
                'indent', //首行缩进
                'italic', //斜体
                'underline', //下划线
                'strikethrough', //删除线
                'subscript', //下标
                'fontborder', //字符边框
                'superscript', //上标
                'formatmatch', //格式刷
                'source', //源代码
                'blockquote', //引用
                'pasteplain', //纯文本粘贴模式
                'selectall', //全选
                'print', //打印
                'preview', //预览
                'horizontal', //分隔线
                'removeformat', //清除格式
                'time', //时间
                'date', //日期
                'unlink', //取消链接
                'insertrow', //前插入行
                'insertcol', //前插入列
                'mergeright', //右合并单元格
                'mergedown', //下合并单元格
                'deleterow', //删除行
                'deletecol', //删除列
                'splittorows', //拆分成行
                'splittocols', //拆分成列
                'splittocells', //完全拆分单元格
                'deletecaption', //删除表格标题
                'inserttitle', //插入标题
                'mergecells', //合并多个单元格
                'deletetable', //删除表格
                'cleardoc', //清空文档
                'insertparagraphbeforetable', //"表格前插入行"
                'insertcode', //代码语言
                'fontfamily', //字体
                'fontsize', //字号
                'paragraph', //段落格式
                'edittable', //表格属性
                'edittd', //单元格属性
                'link', //超链接
                'emotion', //表情
                'spechars', //特殊字符
                'insertvideo', //视频

                'justifyleft', //居左对齐
                'justifyright', //居右对齐
                'justifycenter', //居中对齐
                'justifyjustify', //两端对齐
                'forecolor', //字体颜色
                'backcolor', //背景色
                'insertorderedlist', //有序列表
                'insertunorderedlist', //无序列表
                'fullscreen', //全屏
                'directionalityltr', //从左向右输入
                'directionalityrtl', //从右向左输入
                'rowspacingtop', //段前距
                'rowspacingbottom', //段后距
                'pagebreak', //分页
                'insertframe', //插入Iframe
                'imagenone', //默认
                'imageleft', //左浮动
                'imageright', //右浮动
                'attachment', //附件
                'imagecenter', //居中
                'wordimage', //图片转存
                'lineheight', //行间距
                'edittip ', //编辑提示
                'customstyle', //自定义标题
                'autotypeset', //自动排版
                'touppercase', //字母大写
                'tolowercase', //字母小写

                'inserttable', //插入表格
                'drafts', // 从草稿箱加载
                'charts', // 图表
            ]]
        });
        //数据
        ue.addListener("ready", function () {
            var hiddenHtml = $("#hiddenDiv").html();
            ue.setContent(hiddenHtml);
        });
        //数据
        ue2.addListener("ready", function () {
            var hiddenHtml = $("#hiddenDiv2").html();
            ue2.setContent(hiddenHtml);
        });
    })
        $("#qq-form").validate({
            rules: {},
            messages: {},
            submitHandler: function (form) {
                $("#save").attr("disabled", true);
                $("textarea[name = 'personContent']").text(ue.getContent());
                $("textarea[name = 'speechContent']").text(ue2.getContent());
                var warningMsg = null;
                var options = {
                    url: "#springUrl('/a/brandApply/agreementFormData')?_csrf=${_csrf.token}&_csrf_header=${_csrf.headerName}",
                    type: "POST",
                    dataType: "json",
                    success: function (data) {
                        $("#save").attr("disabled", false);
                        warningMsg.destory();
                        if (data.errorNo == 0 || data.errorNo ==2) {  //保存成功
                            Cfapp.confirm({
                                message: "修改成功",
                                btncanceltext: "关闭",
                                success: function () {
                                    location.reload();
                                },
                                cancel: function () {
                                    location.reload();
                                }
                            });
                        } else {
                            Cfapp.alert({
                                message: "修改失败",
                                btntext: "确定",
                                success: function () {
                                }
                            });
                        }
                    }, error: function (data) {
                        $("#save").attr("disabled", false);
                    }
                };
                warningMsg= Cfapp.warning({
                    content: '正在修改中，请稍后!',  //
                    title: "提示"
                });
                $("#qq-form").ajaxSubmit(options);
            }
        })

</script>
</body>
<!-- END BODY -->
</html>