<%@ 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>
    <jsp:include page="../common/head.jsp"></jsp:include>
</head>
<body>
    <jsp:include page="../common/body_header.jsp"></jsp:include>
    <div class="mid">
        <div class="nr">
            <div class="nr0">
                <div class="nr-top">
                    <span class="xiangshu1">需求清单(共${pager.total}个)</span>
                    <span class="ss0">
                            <input type="text" placeholder="请输入要查找的清单" name="rqrmntName" class="ss" value="${searchName}">
                            <img  src="<%=resourcePath%>/images/share/icon_sousuo.png" onclick="fnSearch()" class="ssimg">
                        </span>
                    <div class="yifankui1" onclick="publish()">
                        <img  src="<%=resourcePath%>/images/share/fabu1.png" alt="" class="fbimg" title="立即发布">
                    </div>
                </div>

                <div class="shuju50" id="chakanId">
                    <c:if test="${outputModel !=null}">
                        <c:forEach items="${outputModel}" var="item">
                            <div class="xuqiu1">
                                <div class="xuqiu01"><a  class="qxbm" href="<%=basePath%>/share/dataRequirement/detail.htm/${item.rqrmntId}">${item.rqrmntName}</a></div>
                                <div class="xuqiu02">需求摘要：${item.rqrmntSummary}.</div>
                                <div class="xuqiu03">
<%--                                    <div class="xuqiu031">--%>
                                        <span class="fabu1">发布时间：</span>
                                        <span class="shijian1"><fmt:formatDate value="${item.publishAt}" pattern="yyyy-MM-dd"/></span>
<%--                                    </div>--%>
<%--                                    <div class="xuqiu032">--%>
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <span class="fabu1">反馈机构：</span>
                                        <span class="shijian1">${item.sectorName ==null?'无':item.sectorName}</span>
<%--                                    </div>--%>
                                </div>
                                <div class="clearfix"></div>
                                <div class="shoucang">
                                <span class="imgsc">
                                    <img  src="<%=resourcePath%>/images/share/icon_chakan.png" alt="">&nbsp;&nbsp;
                                    关注：${item.followTimes ==null ? 0 : item.followTimes}
                                </span>
                                    <span>
                                      <img  src="<%=resourcePath%>/images/share/icon_shoucang.png" alt="">&nbsp;&nbsp;
                                     浏览：${item.viewTimes ==null ? 0 : item.viewTimes}
                                </span>
                                </div>
                                <div class="yifankui">${item.rqrmntState}</div>
                            </div>
                        </c:forEach>
                    </c:if>
                    <c:if test="${outputModel.size() <1}">
                        <div>暂无数据</div>
                    </c:if>
                    <div class="chakan0" id="viewMore">
                        <span class="chakan"></span>
                        &nbsp&nbsp <a class="chakanfont" onclick="lookMore1()">查看更多</a> &nbsp&nbsp
                        <span class="chakan"></span>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <jsp:include page="../common/body_footer.jsp"></jsp:include>
</body>
<script type="text/javascript">
    //发布
    function publish() {
        window.location.href="<%=basePath%>/share/dataRequirement/publish.htm";
    }


    //查看更多
    var flagMore=false;
    var count=1;
    var allCount = ${pager.total} ;
    function lookMore1(){
        count++;
        if(flagMore){
            return;
        }
        $.post("<%=basePath%>/share/dataRequirement/getMore.action",{pageNo:count,rqrmntName:'${searchName}'},function(data){
            if($(data).html() ==null){
                flagMore=true;
                $('.chakanfont').text('已经到底了');
            }else{
                // var connectPoint = $('#chakanId').parent().children('div:last').prev();
                document.getElementById("viewMore").remove();
                var html = document.getElementById("chakanId").innerHTML;
                document.getElementById("chakanId").innerHTML = html + data
                    + '  <div class="chakan0" id="viewMore">\n' +
                    '                        <span class="chakan"></span>\n' +
                    '                        &nbsp&nbsp <a class="chakanfont" onclick="lookMore1()">查看更多</a> &nbsp&nbsp\n' +
                    '                        <span class="chakan"></span>\n' +
                    '                    </div>';
                if ($(".xuqiu1").length == allCount){
                    flagMore=true;
                    $('.chakanfont').text('已经到底了');
                }
            }
        })
    }

    //搜索
    function fnSearch(){
        var rqrment=$("input[name='rqrmntName']").val();
        window.location.href="<%=basePath%>/share/dataRequirement/index.htm?rqrmntName="+rqrment;
    }
</script>
</html>
