<%@ page import="com.baidu.ueditor.define.BaseState" %>
<%@ page import="com.baidu.ueditor.ActionEnter" %>
<%@ page import="com.baidu.ueditor.define.ActionMap" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
    String base = pageContext.getServletContext().getContextPath();

%>
<script type="text/javascript">
    window.UEDITOR_SERVER_URL = '<%=base%>';
</script>
<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="Bookmark" href="/favicon.ico">
    <link rel="Shortcut Icon" href="/favicon.ico"/>
    <link rel="icon" href="${findicoid.icopic}" type="image/x-icon"/>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/admin/manage/js/jquery.js"></script>
    <script type="text/javascript"
            src="${pageContext.request.contextPath}/static/admin/manage/js/jquery.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/admin/js/H-ui.js"></script>
    <script src="${pageContext.request.contextPath}/static/admin/js/laydate/laydate.js"></script> <!-- 改成你的路径 -->
    <script src="${pageContext.request.contextPath}/static/admin/js/ajaxupload.js"></script>

    <!--[if lt IE 9]>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/admin/index/js/html5shiv.js"></script>
    <script type="text/javascript"
            src="${pageContext.request.contextPath}/static/admin/index/js/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css"
          href="${pageContext.request.contextPath}/static/admin/index/h-ui/css/H-ui.min.css"/>
    <link rel="stylesheet" type="text/css"
          href="${pageContext.request.contextPath}/static/admin/index/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css"
          href="${pageContext.request.contextPath}/static/admin/index/Hui-iconfont/1.0.8/iconfont.css"/>
    <link rel="stylesheet" type="text/css"
          href="${pageContext.request.contextPath}/static/admin/index/h-ui.admin/skin/default/skin.css" id="skin"/>
    <link rel="stylesheet" type="text/css"
          href="${pageContext.request.contextPath}/static/admin/index/h-ui.admin/css/style.css"/>
    <!--[if IE 6]>
    <script type="text/javascript"
            src="${pageContext.request.contextPath}/static/admin/index/js/DD_belatedPNG_0.0.8a-min.js"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/ue/ueditor.all.min.js"></script>

    <script type="text/javascript" src="${pageContext.request.contextPath}/static/ue/ueditor.config.js"></script>

    <script type="text/javascript" src="${pageContext.request.contextPath}/static/ue/ueditor.all.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/ue/lang/zh-cn/zh-cn.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/ue/ueditor.parse.js"></script>
    <title>${findseoid.title}-后台管理系统</title>
    <style>
        #bodydiv {
            position: relative;
            top: 100px;
            left: 200px;
        }
        #editor{
            width: 100%;
            height: 300px;
        }
    </style>


</head>

<body>
<nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i>案例管理
    <a href="/admin/caseManage.html"><i class="Hui-iconfont">&gt;</i>案例信息</a>
    <span class="c-gray en">&gt;</span> 添加案例
    <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div id="bodydiv">
    <form action="addCaseDetail.html" method="post" id="newsForm" style="width: 70%" enctype="multipart/form-data">

        <div>
        <span class="select-box">
          <select class="select" size="1" name="typeid" required="required">
            <option value="" selected>--案例类型--</option>
              <c:forEach items="${listAllType}" var="t">
                  <option value="${t.id}">${t.typename}</option>
              </c:forEach>
          </select>
        </span>
        </div>
        <div>
        <span class="select-box">
          <select class="select" size="1" name="state" required="required">
            <option value="" selected>--案例状态--</option>

                  <option value="0">不推荐</option>
                  <option value="1">推荐</option>

          </select>
        </span>
        </div>
        <br>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-1"><span class="c-red">*</span>案例名称:</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text"  name="casename">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-1"><span class="c-red">*</span>案例简介:</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text"  name="caseinfo">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-1"><span class="c-red">*</span>案例风格:</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text"  name="casestyle">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-1"><span class="c-red">*</span>案例面积:</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text"  name="area">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-1"><span class="c-red">*</span>面积单位:</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text"  name="areaunit">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-1"><span class="c-red"></span>案例图片：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="file" class="input-text"  name="filename"/>
                <label style="color:red" >建议尺寸:220px*220px</label>
            </div>
        </div>
        <br>
        <div>
            <div class="form-group">
                <input type="hidden" id="picture" name="newsCover" value="${data.newsCover}"/>
                <img id="preview" src="${data.newsCover}" style="width: 100px;height: 50px;">
                <a href="javascript:void(0);" onclick="upImage();" class="btn btn-primary upload-btn">
                    <i class="Hui-iconfont">&#xe642;</i> 上传封面
                </a>
                <a href="javascript:void(0);" onclick="deleteCover();" class="btn btn-primary upload-btn">
                    <i class="Hui-iconfont">&#xe609;</i> 删除封面
                </a>

            </div>

            <script>
                function deleteCover(){
                    $("#picture").val("");
                    $("#preview").attr("src", "");
                }
            </script>
        </div>

        <%--<div class="row cl">--%>
            <%--<label class="form-label col-xs-4 col-sm-1">图册：</label>--%>
            <%--<div class="formControls col-xs-8 col-sm-9">--%>
                <%--<div style="width:100%;height:80px;border:1px solid #DDDDDD;padding:8px 5px 0 0;" class="selfprozslidim">--%>
                    <%--<input type="file" style="display: none;" name="fileToUpload" class="selfbasetlimgedup" id="picfile">--%>
                    <%--<dl>--%>
                        <%--<dd id="albummore"><a onclick="$('#picfile').click();"><img src="/static/haocai/images/addmore.jpg" alt="" id="img"></a></dd>--%>
                    <%--</dl>--%>
                <%--</div>--%>
            <%--</div>--%>
        <%--</div>--%>
        <%--编辑器--%>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-1"><span class="c-red"></span>案例详情：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <script id="introduction" name="casedetail" style="width:100%;height:200px;" type="text/plain"></script>
                </div>

             </div>
                <div class="row cl">
                    <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-1">
                <button type="submit" class="btn btn-success radius" >提交</button>
                    </div>
                    </div>
    </form>
</div>
<script>

    // $(function () {
    //     $("#tijiao").click(function () {
    //         $.post("/admin/addNewsDetails.html", $("#newsForm").serialize(), function (data) {
    //             if (data.is) {
    //                 window.location.href = "newsManage.html";
    //             } else {
    //                 /*layer.msg(data.msg,{icon:2,time:1000});*/
    //             }
    //         }, "json")
    //         return false;
    //     });
    // });
</script>
                <!--请在下方写此页面业务相关的脚本-->
                <!-- 百度文本编辑器   引用文件 -->
                <link href="<%=base%>/static/ue/themes/default/css/ueditor.css" type="text/css" rel="stylesheet">
                <script src="<%=base%>/static/ue/ueditor.config.js" type="text/javascript"></script>
                <script src="<%=base%>/static/ue/ueditor.all.js" type="text/javascript"></script>
                <script type="text/javascript" src="<%=base%>/static/ue/lang/zh-cn/zh-cn.js"></script>

                <!-- 百度文本编辑器   js -->
                <script type="text/javascript">
                    $(function(){
                        var ue = UE.getEditor('introduction',{
                            //关闭字数统计
                            wordCount:false,
                            toolbars:[['fullscreen', 'source', '|', 'undo', 'redo', '|',
                                'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',
                                'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
                                'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
                                'directionalityltr', 'directionalityrtl', 'indent', '|',
                                'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|',
                                'link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', '|',
                                'insertimage', 'emotion', 'insertvideo',  'attachment', 'map',    'template', 'background', '|',
                                'horizontal', 'date', 'time', 'spechars',  'wordimage', '|',
                                'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', 'charts', '|',
                                'print', 'preview', 'searchreplace', 'help'
                            ]],
                            //关闭elementPath
                            elementPathEnabled:false,
                        });
                    });


                    var currentBrowserId;
                    function browserImage(targetId){
                        currentBrowserId = targetId;
                        var weboxTemp = $.webox({
                            height:600,
                            width:1024,
                            bgvisibel:true,
                            title:'图片管理',
                            iframe:'<%=base%>/admin/image/imgbox.html?'+Math.random()
                        });
                    }

                    function setImagepath(imgPath){
                        $('#'+currentBrowserId).val(imgPath);
                    }

                    function closeFrame(){
                        $('#locked .span').click();
                    }
                </script>
                <%--请在下方写此页面业务相关的脚本--%>

                <script type="text/javascript">

                    $(function () {
                        $("#picfile").change(function(){
                            $.ajaxFileUpload({
                                fileElementId : 'picfile',
                                url : '/uploadImage',
                                dataType : 'text',
                                data : {},
                                async : true,
                                error : function(data) {
                                    alert("网络异常，请重试");
                                },
                                success : function(message) {
                                    $("#albummore").before('<dd class="del"><img src="'+message+'" width="68" height="68" /><input type="hidden" name="piclist" value="'+message+'"/><div class="delwarp"><a class="delete" onclick="delalbum(this)">删除</a></div></dd>');
                                    chens();
                                }
                            });
                        });
                        function chens(){
                            $("#picfile").change(function(){
                                $.ajaxFileUpload({
                                    fileElementId : 'picfile',
                                    url : '/uploadImage',
                                    dataType : 'text',
                                    data : {},
                                    async : true,
                                    error : function(data) {
                                        alert("网络异常，请重试");
                                    },
                                    success : function(message) {
                                        $("#albummore").before('<dd class="del"><img src="'+message+'" width="68" height="68" /><input type="hidden" name="piclist" value="'+message+'"/><div class="delwarp"><a class="delete" onclick="delalbum(this)">删除</a></div></dd>');
                                        chens();
                                    }
                                });
                            });
                        }
                    });
                    function delalbum(obj){
                        $(obj).parents(".del").remove();
                    }
                </script>
</body>
</html>