<%@ 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="liutongbanner">
    <div class="bannerxuqiu"><button type="button" onclick="publish()"  class="xqbut">立即发布</button></div>
</div>
<div class="mid4" id="anchorPoint1">
    <div class="line"></div>
    <div class="box" >
        <div class="box00">
            <div class="xuanxiang01">
                <a href="<%=basePath%>/open/apiDemand/list.htm" class="xuanxiangfont">API开发需求</a>
            </div>
            <div class="xuanxiang02">
                <a href="<%=basePath%>/open/dataRequirement/index.htm" class="xuanxiangfont">数据供给需求</a>
            </div>
            <div class="line00" style="left: 140px;"></div>
            <div class="xuanxiang02">
                <a href="<%=basePath%>/open/requirementMicroapp/openList.action" class="xuanxiangfont">服务开发需求</a>
            </div>
            <div class="zhutishuju">
            <div class="xiangshu">(${pager.total}项)</div>
            <div id="sortDivId">
                <span ${flag == 0 ? 'class="paixu paixu-active"' : "class='paixu'"}><a>最新发布</a></span>
                <span ${flag == 1 ? 'class="paixu paixu-active"' : "class='paixu'"}><a>最多浏览</a></span>
                <span ${flag == 2 ? 'class="paixu paixu-active"' : "class='paixu'"}><a>最多关注</a></span>
            </div>
            <div class="shuju5" >
                <c:if test="${outputModel !=null}">
                <c:forEach items="${outputModel}" var="item">
                    <div class="xuqiu1">
                        <div class="xuqiu01"><a  class="qxbm" href="<%=basePath%>/open/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">
                                <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/icon_chakan.png" alt="">&nbsp;&nbsp;
                                          关注：${item.followTimes ==null ? 0 : item.followTimes}
                                      </span>
                            <span>
                                            <img src="<%=resourcePath%>/images/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>
                <div class="chakan0" id="chakanId">
                    <span class="chakan"></span>
                    &nbsp&nbsp <a class="chakanfont" onclick="lookMore1()">查看更多</a> &nbsp&nbsp
                    <span class="chakan"></span>
                </div>
            </div>
        </div>
        </div>
    </div>

</div>
<div class="clearfix"></div>
<jsp:include page="../common/body_footer.jsp"></jsp:include>
<script type="text/javascript">
    //发布
    function publish() {
        window.location.href="<%=basePath%>/open/dataRequirement/publish.htm";
    }
    //排序
    $(function() {
         var spans = $('#sortDivId').children();
         console.info(spans);
         for (var i = 0; i < spans.length; i++) {
             (function(j) {
                 spans[j].onclick = function () {
                     window.location.href ="<%=basePath%>/open/dataRequirement/index.htm?flag="+j;
                 };
             })(i)
         }
    });

    //查看更多
    var flagMore=false;
    var count=1;
    function lookMore1(){
        count++;
        if(flagMore){
            return;
        }
        $.post("<%=basePath%>/open/dataRequirement/getMore.action",{pageNo:count,rqrmntName:null},function(data){
            if($(data).html() ==null){
                flagMore=true;
                $('.chakanfont').text('已经到底了');
            }else {
                var connectPoint = $('#chakanId').parent().children('div:last').prev();
                connectPoint.after(data);
            }
        })
    }
</script>
</body>
</html>