<%@ page language="java" pageEncoding="UTF-8"
         contentType="text/html; charset=UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
    String basePath = request.getContextPath();
    String resourcePath = basePath + "/resource";
%>
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>发布路演</title>
    <jsp:include page="../common/head.jsp"></jsp:include>
</head>
<body>
<jsp:include page="../common/body_header.jsp"></jsp:include>
<div class="line0"></div>
<div class="mid-fabu10">
    <div class="mid-fabu101">
        <div class="form-fabu10">
            <div class="fabufont">发布新路演</div>
            <div class="line-fabu"></div>
            <div class="clearfix"></div>
            <div class="fabu00">
                <form action="" >
                    <div class="fabu-01">
                        <span class="fabufont1"><span class="xinghao">*</span>路演名称</span>
                        <span class="ff1">
                            <input type="text" id="roadshowName" name="roadshowName" class="fabuinput" placeholder="请输入路演名称">
                        <div class="tishi4"></div>
                        </span>
                    </div>
                    <div class="fabu-01">
                        <span class="fabufont1"><span class="xinghao">*</span>路演描述</span>
                        <span class="ff1">
                            <textarea name="roadshowIntro" id="roadshowIntro" cols="30" rows="2" class="fabuinput1" placeholder="请输入路演描述" ></textarea>
                        <div class="tishi4"></div>
                        </span>

                    </div>
                    <div class="fabu-01">
                        <span class="fabufont1"><span class="xinghao">*</span>融资类型</span>
                        <span class="ff1">
                            <input type="text" name="financingType" id="financingType"  class="fabuinput" placeholder="请输入融资类型">
                        <div class="tishi4"></div>
                        </span>

                    </div>
                    <div class="fabu-050">
                        <span class="fabufont1"><span class="xinghao">*</span>融资额度</span>
                        <span class="fabu-button8">
                            <input type="text" name="financingAmount" id="financingAmount" class="input-0100" placeholder="10">
                        <div class="tishi4"></div>
                        </span>
                        <span class="qian">单位：万元</span>
                    </div>
                    <div class="fabu-020">
                        <span class="fabufont2"><span class="xinghao">*</span>项目阶段</span>
                        <span class="radio0">
                                            <%--<input type="radio" name="radio1" value="概念阶段" class="radio">概念阶段&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--%>
                                            <%--<input type="radio" name="radio1" value="研发阶段" class="radio">研发阶段&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--%>
                                            <%--<input type="radio" name="radio1" value="已发布" class="radio">已发布&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--%>
                                            <%--<input type="radio" name="radio1" value="已盈利" class="radio">已盈利&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--%>
                        <c:forEach items="${roadShowStage}" var="item">
                            <input type="radio" id="projectPhase" name="projectPhase" value="${item.key}" class="radio">${item.key}&nbsp;&nbsp;
                        </c:forEach>
                            <div class="tishi4" id="ra"></div>
                        </span>
                    </div>
                    <div class="fabu-021">
                        <span class="fabufont2"><span class="xinghao">*</span>行业领域</span>
                        <span class="radio01">
                                                <%--<input type="radio" name="radio1" value="是" class="radio">生活服务&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--%>
                                                <%--<input type="radio" name="radio1" value="否" class="radio">产业发展&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--%>
                                                <%--<input type="radio" name="radio1" value="否" class="radio">教育&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--%>
                                                <%--<input type="radio" name="radio1" value="否" class="radio">旅游&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--%>
                                                <%--<input type="radio" name="radio1" value="是" class="radio">医疗&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--%>
                                                <%--<input type="radio" name="radio1" value="否" class="radio">房产&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--%>
                                                <%--<input type="radio" name="radio1" value="否" class="radio">交通&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--%>
                                                <%--<input type="radio" name="radio1" value="否" class="radio">农业&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--%>
                                                <%--<input type="radio" name="radio1" value="是" class="radio">社会治理&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--%>
                                                <%--<input type="radio" name="radio1" value="否" class="radio">生活&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--%>
                                                <%--<input type="radio" name="radio1" value="否" class="radio">休闲&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br><br>--%>
                                                <%--<input type="radio" name="radio1" value="否" class="radio">政务&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--%>
                        <c:forEach items="${roadShowTrade}" var="item">
                                <input type="radio" id="tradeField" name="tradeField" value="${item.key}" class="radio">${item.key}&nbsp;&nbsp;
                        </c:forEach><div class="tishi4" id="rb"></div>

                        </span>
                    </div>
                    <div class="fabu-0501">
                        <span class="fabufont1"><span class="xinghao">*</span>标签选择</span>
                        <span class="fabu-button8">
                            <input type="text" name="roadshowTag" id="roadshowTag" class="input-0100" placeholder="10">
                       <div class="tishi4"></div>
                        </span>
                        <%--<span><button class="xuanze">选择</button></span>--%>
                    </div>
                    <div class="fabu-01">
                        <span class="fabufont1"><span class="xinghao">*</span>缩略图</span>
                        <span class="ff1">
                            <input style="border: none" id="fileImg"  type="file" name="fileImg" class="fabuinput" placeholder="">
                            <div class="tishi4" id="im"></div>
                        </span>

                    </div>
                    <div class="fabu-01">
                        <span class="fabufont1">路演材料1</span>
                        <span class="ff1">
                            <input style="border: none" multiple="multiple1" id="file1"  type="file" name="fileImgs" class="fabuinput" placeholder="">

                         <div class="tishi4" id="im1"></div></span>

                    </div>
                    <div class="fabu-01">
                        <span class="fabufont1">路演材料2</span>
                        <span class="ff1">
                            <input style="border: none" multiple="multiple2" id="file2"  type="file" name="fileImgs" class="fabuinput" placeholder="">
                         <div class="tishi4" id="im2"></div>
                        </span>

                    </div>
                    <div class="fabu-01">
                        <span class="fabufont1">路演材料3</span>
                        <span class="ff1">
                            <input style="border: none" multiple="multiple3" id="file3"  type="file" name="fileImgs" class="fabuinput" placeholder="">
                         <div class="tishi4" id="im3"></div>
                        </span>

                    </div>
                    <div class="fabu-01">
                        <span class="fabufont1">路演材料4</span>
                        <span class="ff1">
                            <input style="border: none" multiple="multiple4" id="file4"  type="file" name="fileImgs" class="fabuinput" placeholder="">
                         <div class="tishi4" id="im4"></div>
                        </span>

                    </div>

                    <div class="clearfix"></div>
                    <input type="hidden" name="flag" id="flag"/>
                    <button type="button" class="fabu-but" onclick="fabu()">发布</button>
                    <%--<button type="button" class="fabu-but1" onclick="zancun()">暂存</button>--%>
                </form>
            </div>

        </div>
    </div>
</div>
<div class="clearfix"></div>
<jsp:include page="../common/body_footer.jsp"></jsp:include>

</body>
<script>
    function fabu() {
        $('.tishi4').text('');//清空验证
        // if($('input[name="projectPhase"]:checked').val()==null){
        //     $("#ra").html("!项目阶段不能为空")
        // }
        if($('input[name="tradeField"]:checked').val()==null){
            $("#rb").html("!行业领域不能为空")
        }
        // if($("#fileImg")[0].files[0]==null) {
        //     $("#im").html("!缩略图不能为空")
        // }
        // if($("#file1")[0].files[0]==null) {
        //     $("#im1").html("!路演材料1不能为空")
        // }
        $("#flag").val(1);
        var formData = new FormData();
        formData.append("file1",$("#file1")[0].files[0]);
        formData.append("file2",$("#file2")[0].files[0]);
        formData.append("file3",$("#file3")[0].files[0]);
        formData.append("file4",$("#file4")[0].files[0]);
        formData.append("fileImg", $("#fileImg")[0].files[0]);
        formData.append("roadshowName", $("#roadshowName").val());
        formData.append("roadshowIntro", $("#roadshowIntro").val());
        formData.append("financingType", $("#financingType").val());
        formData.append("financingAmount", $("#financingAmount").val());
        formData.append("projectPhase", $('input[name="projectPhase"]:checked').val());
        formData.append("tradeField", $('input[name="tradeField"]:checked').val());
        formData.append("roadshowTag", $("#roadshowTag").val());
        formData.append("flag", $("#flag").val());

        // formData.append("flag", $("#flag").val());

        $.ajax({
            url : "<%=basePath%>/open/roadShow/toAdd.action",
            type : 'POST',
            async : true,
            data : formData,
            // 告诉jQuery不要去处理发送的数据
            processData : false,
            // 告诉jQuery不要去设置Content-Type请求头
            contentType : false,
            success : function(ret) {
                if(ret.stateCode==200) {
                    alert("发布成功");
                    location.href="<%=basePath%>/open/roadShow/index.htm";
                }else{
                    for(var item in ret.data){
                        $("[name='"+item+"']").next().text("! "+ret.data[item]);
                        $("[name='"+item+"']").next().show();
                    }
                }
            }
        });

    }
</script>
</html>