js实现搜索并分页

<%@page import="org.apache.struts2.components.Include"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";

    StringBuffer uploadUrl = new StringBuffer("http://");
    uploadUrl.append(request.getHeader("Host"));
    uploadUrl.append(request.getContextPath());
    uploadUrl.append("/imgUpload.htm");
    Date dt = new Date();
    long dat = dt.getTime();
%>
<!DOCTYPE html>

<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->

<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->

<!--[if !IE]><!-->
<html lang="en">
<!--<![endif]-->

<!-- BEGIN HEAD -->

<head>

<meta charset="utf-8" />

<title>zovon-众望合信</title>

<meta content="width=device-width, initial-scale=1.0" name="viewport" />

<meta content="" name="description" />

<meta content="" name="author" />

<!-- BEGIN GLOBAL MANDATORY STYLES -->
<!-- 页面引入样式开始 -->
<link
    href="${pageContext.request.contextPath }/resource/css/bootstrap.min.css"
    rel="stylesheet" type="text/css" />

<link
    href="${pageContext.request.contextPath }/resource/css/bootstrap-responsive.min.css"
    rel="stylesheet" type="text/css" />

<link
    href="${pageContext.request.contextPath }/resource/css/font-awesome.min.css"
    rel="stylesheet" type="text/css" />

<link
    href="${pageContext.request.contextPath }/resource/css/style-metro.css"
    rel="stylesheet" type="text/css" />

<link href="${pageContext.request.contextPath }/resource/css/style.css"
    rel="stylesheet" type="text/css" />

<link
    href="${pageContext.request.contextPath }/resource/css/style-responsive.css"
    rel="stylesheet" type="text/css" />

<link
    href="${pageContext.request.contextPath }/resource/css/default.css"
    rel="stylesheet" type="text/css" id="style_color" />

<link
    href="${pageContext.request.contextPath }/resource/css/uniform.default.css"
    rel="stylesheet" type="text/css" />

<!-- END GLOBAL MANDATORY STYLES -->

<!-- BEGIN PAGE LEVEL STYLES -->

<link rel="stylesheet" type="text/css"
    href="${pageContext.request.contextPath }/resource/css/select2_metro.css" />

<link rel="stylesheet"
    href="${pageContext.request.contextPath }/resource/css/bootstrap-spinner.css" />

<link rel="stylesheet"
    href="${pageContext.request.contextPath }/resource/css/DT_bootstrap.css" />

<!-- END PAGE LEVEL STYLES -->

<link rel="shortcut icon"
    href="${pageContext.request.contextPath }/resource/image/favicon.ico" />

<!-- 页面引入样式结束 -->
<style>

#divobj div {
    float: left;
}

table tr td {
    padding: 5px;
}

table input[type="text"] {
    width: 250px;
    height: 30px;
    border-radius: 3px;
}

select option {
    height: 26px;
    border-radius: 3px;
}

.import_red {
    color: #ff0000;
}

#blogImg {
    float: left;
}

#blogImg div {
    float: left;
    height: 150px;
    width: 150px;
    padding: 5px;
}

#blogImg img {
    height: 150px;
    width: 150px;
}

.floatLeft {
    float: left;
    padding-right: 20px;
}

.contentFont {
    font-size: 20px;
}

.row-fluid .span6 {
    width: 42.718%;
}

.btn-group {
    float: left;
}
.check{
    color: red;
}
</style>
</head>

<!-- END HEAD -->

<!-- BEGIN BODY -->

<body class="page-header-fixed">

    <!-- 引入头部页面-->

    <%@ include file="../../../comm/top.jsp"%>

    <!--  引入头部页面结束  -->

    <!-- BEGIN CONTAINER -->

    <div class="page-container row-fluid">

        <!-- 左侧菜单开始 一个li表示一个菜单 -->

        <%@ include file="../../../comm/left.jsp"%>

        <!-- 控制添加模块为默认选中 -->

        <script type="text/javascript">
            document.getElementById("2").className = "start active";
            document.getElementById("4456222d-e197-44f4-ad21-05a32f65628c").className = "active";
        </script>

        <!-- 左侧菜单结束-->

        <!-- 中间空白内容开始 -->
        <div class="page-content">


            <!-- BEGIN PAGE CONTAINER-->

            <div class="container-fluid">

                <!-- BEGIN PAGE HEADER-->

                <div class="row-fluid">

                    <div class="span12">

                        <!-- BEGIN STYLE CUSTOMIZER -->

                        <div class="color-panel hidden-phone">

                            <div class="color-mode-icons icon-color"></div>

                            <div class="color-mode-icons icon-color-close"></div>

                            <div class="color-mode">

                                <p>THEME COLOR</p>

                                <ul class="inline">

                                    <li class="color-black current color-default"
                                        data-style="default"></li>

                                    <li class="color-blue" data-style="blue"></li>

                                    <li class="color-brown" data-style="brown"></li>

                                    <li class="color-purple" data-style="purple"></li>

                                    <li class="color-grey" data-style="grey"></li>

                                    <li class="color-white color-light" data-style="light"></li>

                                </ul>

                                <label> <span>Layout</span> <select
                                    class="layout-option m-wrap small">

                                        <option value="fluid" selected>Fluid</option>

                                        <option value="boxed">Boxed</option>

                                </select>

                                </label> <label> <span>Header</span> <select
                                    class="header-option m-wrap small">

                                        <option value="fixed" selected>Fixed</option>

                                        <option value="default">Default</option>

                                </select>

                                </label> <label> <span>Sidebar</span> <select
                                    class="sidebar-option m-wrap small">

                                        <option value="fixed">Fixed</option>

                                        <option value="default" selected>Default</option>

                                </select>

                                </label> <label> <span>Footer</span> <select
                                    class="footer-option m-wrap small">

                                        <option value="fixed">Fixed</option>

                                        <option value="default" selected>Default</option>

                                </select>

                                </label>

                            </div>

                        </div>

                        <!-- END BEGIN STYLE CUSTOMIZER -->

                        <!-- BEGIN PAGE TITLE & BREADCRUMB-->

                        <h3 class="page-title">

                            笑脸墙<small>查看</small>

                        </h3>

                        <ul class="breadcrumb">

                            <li><i class="icon-home"></i> <a
                                href="${pageContext.request.contextPath }//user/toIndex.do">主页</a>

                                <i class="icon-angle-right"></i></li>

                            <li><a href="#">举报</a> <i class="icon-angle-right"></i></li>

                        </ul>

                        <!-- END PAGE TITLE & BREADCRUMB-->

                    </div>

                </div>

                <!-- END PAGE HEADER-->

                <!-- BEGIN PAGE CONTENT-->

                <div class="row-fluid">

                    <div class="span12">

                        <!-- BEGIN EXAMPLE TABLE PORTLET-->

                        <div class="portlet box green">

                            <div class="portlet-title">

                                <div class="caption">
                                    <i class="icon-globe"></i>举报列表
                                </div>

                                <div class="tools">

                                    <a href="javascript:;" class="collapse"></a> <a
                                        href="#portlet-config" data-toggle="modal" class="config"></a>

                                    <a href="javascript:;" class="reload"></a> <a
                                        href="javascript:;" class="remove"></a>

                                </div>

                            </div>

                            <div class="portlet-body">

                                <div class="clearfix" style="float: left;">

                                    <div class="btn-group" style="float: left;">

                                        <a class="btn green" href="#responsive1"
                                            id="sample_editable_1_new" data-toggle="modal"> 添加举报信息 <i
                                            class="icon-plus"></i>
                                        </a>

                                    </div>

                                </div>
                                <!-- 搜索开始 -->
                                <div id="sample_1_wrapper" class="dataTables_wrapper form-inline" style="float: right;">

                                    <div class="row-fluid">
                                        <label>搜索:</label>
                                        <div class="input-prepend">
                                            
                                            <div class="btn-group">
                                                
                                                <button class="btn dropdown-toggle" data-toggle="dropdown">

                                                <a id="searchField" value="weiboid" href="javaScript:;">信息ID</a>

                                                <span class="caret"></span></button>

                                                <ul class="dropdown-menu">

                                                    <li><a class="fieldVal" value="weiboid" href="javaScript:;">信息ID</a></li>

                                                    <li><a class="fieldVal" value="jbUserId" href="javaScript:;">举报人</a></li>

                                                    <li><a class="fieldVal" value="reason" href="javaScript:;">理由</a></li>
                                                    
                                                    <li><a class="fieldVal" value="jbTime" href="javaScript:;">举报时间</a></li>

                                                    <li class="divider"></li>

                                                    <li><a class="fieldVal" value="shTime" href="javaScript:;">审核时间</a></li>
                                                    
                                                    <li><a class="fieldVal" value="shUserId" href="javaScript:;">审核人</a></li>
                                                    
                                                    <li><a class="fieldVal" value="status" href="javaScript:;">状态</a></li>
                                                    

                                                </ul>

                                            </div>

                                            <input id="search" placeholder="当为状态时,0为未审核1为已审核" class="m-wrap medium" type="text" />

                                        </div>

                                    </div>

                                </div>
                                <!-- 搜索结束 -->

                                <table class="table table-striped table-bordered table-hover table-full-width"
                                    id="sample_1">

                                    <thead>

                                        <tr>

                                            <th>序号</th>

                                            <th>举报人</th>

                                            <th class="hidden-480">举报理由</th>

                                            <th class="hidden-480">举报时间</th>

                                            <th class="hidden-480">审核人</th>
                                            
                                            <th class="hidden-480">审核时间</th>

                                            <th class="hidden-480">操作</th>

                                        </tr>

                                    </thead>

                                    <tbody id="reportPageInfo">

                                        <c:forEach items="${sPage.list}" var="report" varStatus="status">
                                            <!-- 第一行开始 -->
                                            <tr>

                                                <td>${status.index+1}</td>

                                                <td>${report.jbUser.nickName}</td>

                                                <td class="hidden-480">${report.reason}</td>

                                                <td class="hidden-480">${report.jbTime}</td>
                                                
                                                <td class="hidden-480">
                                                
                                                    <c:if test="${report.shUser ==null}">
                                                    
                                                        未审核
                                                        
                                                    </c:if>
                                                    <c:if test="${report.shUser !=null}">
                                                    
                                                        ${report.shUser.nickName}
                                                        
                                                    </c:if>
                                                
                                                </td>

                                                <td class="hidden-480">
                                                
                                                    <c:if test="${report.shTime=='null'}">
                                                    
                                                        未审核
                                                        
                                                    </c:if>
                                                    <c:if test="${report.shTime!='null'}">
                                                    
                                                        ${report.shTime}
                                                        
                                                    </c:if>
                                                
                                                </td>

                                                <td class="hidden-480">
                                                    
                                                    <c:if test="${report.shTime!='null'}">
                                                    
                                                        <button class="btn grey" disabled="disabled" type="button"
                                                            onclick="shield('${report.weiboid}');">通过</button>
                                                        <button disabled="disabled" class="btn grey" type="button"
                                                            onclick="overlook('${report.weiboid}');">不通过</button>
                                                        <a class="btn grey"  disabled="disabled" href="javaScript:;" data-toggle="modal" οnclick="sel('${report.weiboid}');">查看</a>
                                                    
                                                    </c:if>
                                                    <c:if test="${report.shTime =='null'}">
                                                            
                                                        <button class="btn blue" type="button"
                                                            onclick="shield('${report.weiboid}');">通过</button>
                                                        <button class="btn red" type="button"
                                                            onclick="overlook('${report.weiboid}');">不通过</button>
                                                        <a class="btn yellow" href="#responsive2" data-toggle="modal" οnclick="sel('${report.weiboid}');">查看</a>
                                                        
                                                    </c:if>
                                                    

                                                </td>
                                            </tr>
                                            <!-- 第一行结束 -->
                                        </c:forEach>
                                    </tbody>

                                </table>
                                <!-- 分页开始-->
                                <table align="center" id="pageTab">
                                    <tr>
                                        <td id="countAll">共${sPage.countAll }条记录</td>
                                        <td id="currentPage">第${sPage.currentPage }/${sPage.allPage }页</td>
                                        <td><a id="startPage"
                                            href="${pageContext.request.contextPath }${sPage.path }?num=1">首页</a>&nbsp;&nbsp;&nbsp;
                                            <a id="backPage"
                                            href="${pageContext.request.contextPath }${sPage.path }?num=${sPage.currentPage-1<1?sPage.currentPage:sPage.currentPage-1}">上一页</a>&nbsp;&nbsp;&nbsp;
                                            <a id="nextPage"
                                            href="${pageContext.request.contextPath }${sPage.path }?num=${sPage.currentPage+1>sPage.allPage?sPage.allPage:sPage.currentPage+1}">下一页</a>&nbsp;&nbsp;&nbsp;
                                            <a id="endPage"
                                            href="${pageContext.request.contextPath }${sPage.path }?num=${sPage.allPage}">尾页</a>
                                        </td>
                                    </tr>
                                </table>
                                <!-- 分页结束-->
                            </div>

                        </div>

                        <!-- END EXAMPLE TABLE PORTLET-->

                    </div>

                </div>



                <!-- END PAGE CONTENT-->

            </div>

            <!-- END PAGE CONTAINER-->

        </div>
        <!-- 中间空白内容结束 -->

    </div>
    
    <!--预览功能开始-->
    <div class="portlet-body form">
        <div id="responsive" class="modal hide fade" tabindex="-1"
            data-width="760">

            <div class="modal-header">

                <button type="button" class="close" data-dismiss="modal"
                    aria-hidden="true"></button>

                <h3>举报记录</h3>

            </div>

            <div id="showHtml" class="modal-body">

                <table class="table table-hover" style="width: auto;">

                    <thead>

                        <tr>

                            <th style="width: 44px; ">序号</th>

                            <th style="width: 81px; ">举报人</th>

                            <th style="width: 98px; ">举报理由</th>
                            
                            <th style="width: 106px; ">举报时间</th>
                            
                            <th style="width: 85px; ">审核人</th>
                            
                            <th style="width: 119px; ">审核时间</th>


                        </tr>

                    </thead>

                    <tbody id="reportInfo">
        
                            
                    </tbody>

                </table>

            </div>

            <div class="modal-footer">

                <button type="button" data-dismiss="modal" class="btn">Close</button>

            </div>

        </div>

    </div>
    <!--预览功能开始-->
    
    <!--添加笑脸墙 功能开始-->
    <div class="portlet-body form">
        <div id="responsive2" class="modal hide fade" tabindex="-1"
            data-width="760">

            <div class="modal-header">

                <button type="button" class="close" data-dismiss="modal"
                    aria-hidden="true"></button>

                <h3>预览</h3>

            </div>

            <div id="showHtml" class="modal-body">
                <div id="blogDiv">
                    <div style="padding-bottom: 8px;">
                        <div class="floatLeft" id="userImg"></div>
                        <label id="userName"></label> <a href="#">发表状态</a>&nbsp;&nbsp;&nbsp;<span
                            id="blogTime"></span>
                    </div>
                    <div>
                        <span class="contentFont" id="content"></span>
                    </div>
                    <div id="blogImg"></div>
                </div>
                <!-- <div>
                    <a href="#">转发(16)</a>
                    <a href="#">评论(21)</a>
                    <a href="#">赞(26)</a>
                </div> -->
                <div id="reprotDiv">
                    <table
                        class="table table-striped table-bordered table-hover table-full-width">

                        <thead>

                            <tr>

                                <th style="border: 0px;"><a href="javaScript:shareInfo();">转发<span
                                        id="zf"></span></a></th>

                                <th style="border: 0px;"><a
                                    href="javaScript:commentInfo();">评论<span id="pl"></span></a></th>

                                <th style="border: 0px;"><a href="javaScript:praiseInfo();">赞<span
                                        id="zs"></span></a></th>

                            </tr>

                        </thead>

                        <tbody id="reportDiv">

                        </tbody>

                    </table>
                </div>
            </div>

            <div class="modal-footer">

                <button type="button" data-dismiss="modal" class="btn">Close</button>

            </div>

        </div>

    </div>
    <!--添加新鲜事 功能开始-->
    <!--被举报的信息详情 功能开始-->
    <div class="portlet-body form">
        <div id="responsive1" class="modal hide fade" tabindex="-1"
            data-width="760">

            <div class="modal-header">

                <button type="button" class="close" data-dismiss="modal"
                    aria-hidden="true"></button>

                <h3>添加举报信息</h3>

            </div>

            <div id="showHtml" class="modal-body">
                <div class="container-fluid">
                
                        这里不需要实现举报信息的添加功能,手机客户端已经实现,该模块是为了以后的扩展使用
                
                </div>
            </div>

            <div class="modal-footer">
                <button type="button"   style="float: left;" data-dismiss="modal" class="btn">Close</button>
                <input class="btn blue" disabled="disabled" value="发表" type="button" id="subForm1" />
                <input class="btn red" disabled="disabled" value="重置" type="reset" />
            </div>

        </div>

    </div>
    <!--被举报的信息详情 功能结束-->
</body>

<!-- 底部开始 -->
<%@ include file="../../../comm/foot.jsp"%>
<!-- 底部结束 -->


<!-- 页面引入js开始 -->

<!-- 页面引入js开始 -->

<script
    src="${pageContext.request.contextPath }/resource/js/jquery-1.10.1.min.js"
    type="text/javascript"></script>

<script
    src="${pageContext.request.contextPath }/resource/js/jquery-migrate-1.2.1.min.js"
    type="text/javascript"></script>

<!-- IMPORTANT! Load jquery-ui-1.10.1.custom.min.js before bootstrap.min.js to fix bootstrap tooltip conflict with jquery ui tooltip -->

<script
    src="${pageContext.request.contextPath }/resource/js/jquery-ui-1.10.1.custom.min.js"
    type="text/javascript"></script>

<script
    src="${pageContext.request.contextPath }/resource/js/bootstrap.min.js"
    type="text/javascript"></script>

<!--[if lt IE 9]>

    <script src="${pageContext.request.contextPath }/resource/js/excanvas.min.js"></script>

    <script src="${pageContext.request.contextPath }/resource/js/respond.min.js"></script>  

    <![endif]-->

<script
    src="${pageContext.request.contextPath }/resource/js/jquery.slimscroll.min.js"
    type="text/javascript"></script>

<script
    src="${pageContext.request.contextPath }/resource/js/jquery.blockui.min.js"
    type="text/javascript"></script>

<script
    src="${pageContext.request.contextPath }/resource/js/jquery.cookie.min.js"
    type="text/javascript"></script>

<script
    src="${pageContext.request.contextPath }/resource/js/jquery.uniform.min.js"
    type="text/javascript"></script>

<!-- END CORE PLUGINS -->

<!-- BEGIN PAGE LEVEL PLUGINS -->

<script type="text/javascript"
    src="${pageContext.request.contextPath }/resource/js/select2.min.js"></script>


<script type="text/javascript"
    src="${pageContext.request.contextPath }/resource/js/DT_bootstrap.js"></script>

<!-- END PAGE LEVEL PLUGINS -->

<!-- BEGIN PAGE LEVEL SCRIPTS -->

<script src="${pageContext.request.contextPath }/resource/js/app.js"></script>

<script
    src="${pageContext.request.contextPath }/resource/js/table-advanced.js"></script>

<script>
    jQuery(document).ready(function() {

        App.init();

        TableAdvanced.init();

    });
    //查看被举报信息的详细信息
    var showState = function(weiboid){
        alert(weiboid);
    };
    //查看该信息的所有举报
    var selReportInfo = function(weiboId){
        $("#reportInfo").html("");//清空原有的
        var shuser="未审核";
        var shDate="未审核";
         $.ajax({
                dataType:'json',
                data:{"weiboId":weiboId},
                url:'../report/getReportDetalied.do',   // 通过weiboid查看该条信息的举报记录
                async:false,
                success:function(data){
                    /* alert("success"+data); */
                    $.each(data,function(i,item){
                        i=parseInt(i)+1;
                        
                        if(item.shUser!=null){
                            shuser=item.shUser.nickName;
                        }
                        if(item.shTime!=null){
                            shDate=item.shTime;
                        }
                        
                         //alert(item.jbTime);
                        $("#reportInfo").append("<tr><td>"+i+"</td><td>"+item.jbUser.nickName+"</td><td>"+item.reason+"</td><td>"+item.jbTime+"</td><td>"+shuser+"</td><td>"+shDate+"</td></tr>");
                    });
                },
                error:function(data){
                    alert("error"+data);
                }
            });
    };
    //根据weiboid操作所有关于该信息的举报(屏蔽)
    function shield(weiboid) {
        //把当前信息的状态status改为1
        //向report表中关于该消息的举报添加处理人和处理日期
        //获得举报人和发布人并以邮件的方式通知处理结果
        if(confirm("通过后与之关联的所有举报将采取同样的操作,原信息将被屏蔽,确定要在这样做?"))
        $.ajax({
            dataType : 'json',
            data : {
                "weiboid" : weiboid
            },
            url : '../report/shield.action',
            success : function(data) {
            
                 if (data.flag == "success") {
                    alert("操作成功");
                    //$("#" + weiboid).html("已屏蔽");
                    location.reload();
                }
                if (data.flag == "400") {
                    alert("该举报信息您已经处理过了");
                }
                if (data.flag == "defeat") {
                    alert("操作出现异常,请联系网站工作人员");
                } 
            },
            error : function(data) {
                alert("网络异常,请稍后重试");
            }
        });
    }
    //忽略
    function overlook(weiboid) {
        //给举报人发送通知邮件
        alert("给举报者发送邮件,短信或者是手机推送--未实现");
    }
    //查看信息详情和举报操作人信息
    /* function sel(weiboid) {
        //清空原有数据
        //用户名
        $("#userName").empty();
        //用户头像
        $("#userImg").empty();
        //发布时间
        $("#blogTime").empty();
        //内容
        $("#content").empty();
        //图片
        $("#blogImg").empty();
        //审核人信息
        $("#reportDiv").empty();
        $.ajax({
            dataType : 'json',
            data : {
                "weiboid" : weiboid
            },
            type : 'post',
            async : false,
            url : '../report/sel.action',
            success : function(data) {
                // $("#repCount").html(data.report.shTime);
                //alert(data.blog.status);
                $("#showHtml").append(data.blog.content);
                //用户名
                $("#userName").append(data.blog.fbUser.nickName);
                //用户头像
                $("#userImg").append("<img src='${pageContext.request.contextPath}/"+data.blog.fbUser.img+"' />");
                //发布时间
                $("#blogTime").append(data.blog.time);
                //内容
                $("#content").append(data.blog.content);
                //获得路径
                var imgPath=data.blog.path;
                if(data.blog.images[0]!=null){
                    //图片
                    $.each(data.blog.images,function(i,item){
                        $("#blogImg").append("<div><img alt='' src='${pageContext.request.contextPath}/resource/photo/"+imgPath+"/"+item+"'></div>");
                    });
                }
                //审核人信息
                if(data.blog!=null){
                    $("#reportDiv").append("<td>"+data.report.shUser.nickName+"</td><td>"+data.report.shTime+"</td>");
                }else{
                    $("#reportDiv").append("未处理");
                }
                
            },
            error : function(data) {
                alert("error");
            }
        });
    } */
    //查看信息详情和默认显示评论信息
    var wbId; //声明变量保存当前操作的weiboid
    var swid; //声明变量保存当前信息的sid
    function sel(weiboid) {
        //清空原有数据
        //用户名
        $("#userName").empty();
        //用户头像
        $("#userImg").empty();
        //发布时间
        $("#blogTime").empty();
        //内容
        $("#content").empty();
        //图片
        $("#blogImg").empty();
        //审核人信息
        $("#reportDiv").empty();
        $.ajax({
            dataType: 'json',
            data: {
                "weibo_id": weiboid
            },
            type: 'post',
            async: false,
            url: '../state/getDetailedInfo.action',
            success: function(data) {
                /* $("#repCount").html(data.report.shTime);
                            alert(data.blog.status);
                            $("#showHtml").append(data.blog.content); */
                //用户名
                $("#userName").append(data.fbUser.nickName);
                //用户头像
                $("#userImg").append("<img height='29px;' width='45px;' src='${pageContext.request.contextPath}/resource/userImg/" + data.fbUser.path + "/" + data.fbUser.img + "' />");
                //发布时间
                $("#blogTime").append(data.time);
                //分享评论赞的次数
                $("#pl").text("(" + data.cnum + ")");
                $("#zf").text("(" + data.snum + ")");
                $("#zs").text("(" + data.pnum + ")");
                //内容
                $("#content").append(data.content);
                //获得路径
                var imgPath = data.path;
                if (data.images[0] != null) {
                    //图片
                    $.each(data.images,
                    function(i, item) {
                        $("#blogImg").append("<div><img alt='' src='${pageContext.request.contextPath}/resource/photo/" + imgPath + "/" + item + "'></div>");
                    });
                }
            },
            error: function(data) {
                alert("error");
            }
        });
        //默认
        shareInfo(weiboid);
    }
    //分享信息
    function shareInfo(weiboid) {
        //清空原有数据
        $("#reportDiv").text("");
    
        $.ajax({
            dataType: 'json',
            type: 'post',
            data: {
                "weibo_id": weiboid,
                "stating": "4"
            },
            url: '../state/shareStateByWeiboIdAndStating.action',
            success: function(data) {
                if (data.length > 0) {
                    $.each(data,
                    function(i, item) {
                        $("#reportDiv").append("<tr><td style='border: 0px;'><img height='29px;' width='45px;' src='${pageContext.request.contextPath}/resource/userImg/" + item.fbUser.path + "/" + item.fbUser.img + "'/>" + item.fbUser.nickName + "<br />" + item.reason + "</td><tr/>");
                    });
                } else {
                    $("#reportDiv").append("<tr><td style='border: 0px;'>还没有人来分享哦--!</td><tr/>");
                }
            },
            error: function(data) {
                alert("获取分享信息失败,请联系管理员:code=" + data.code);
            }
        });
    }
    //评论信息
    function commentInfo() {
        //清空原有数据
        $("#reportDiv").text("");
        $.ajax({
            dataType: 'json',
            type: 'post',
            data: {
                "weibo_id": swid
            },
            url: '../comment/showComment.action',
            success: function(data) {
                if (data.length > 0) {
                    $.each(data,
                    function(i, item) {
                        $("#reportDiv").append("<tr><td style='border: 0px;'><img height='29px;' width='45px;' src='${pageContext.request.contextPath}/resource/userImg/" + item.plUser.path + "/" + item.plUser.img + "'/>" + item.plUser.nickName + "<br />" + item.content + "</td><tr/>");
                    });
                } else {
                    $("#reportDiv").append("<tr><td style='border: 0px;'>还没有人来评论哦--!</td><tr/>");
                }
            },
            error: function(data) {
                alert("获取评论信息失败,请联系管理员:code=" + data.code);
            }
        });
    }
    //赞信息
    function praiseInfo() {
        //清空原有数据
        $("#reportDiv").text("");
        $.ajax({
            dataType: 'json',
            type: 'post',
            data: {
                "weibo_id": wbId
            },
            url: '../praise/showPraise.action',
            success: function(data) {
                if (data.length > 0) {
                    $("#reportDiv").append("TA们都感觉很赞:<br />");
                    $.each(data,
                    function(i, item) {
                        $("#reportDiv").append("<tr><td style='border: 0px;'><img height='29px;' width='45px;' src='${pageContext.request.contextPath}/resource/userImg/" + item.userImg + "'/>" + item.userName + "</td><tr/>");
                    });
                } else {
                    $("#reportDiv").append("<tr><td style='border: 0px;'>还没有人来点赞哦--!</td><tr/>");
                }
            },
            error: function(data) {
                alert("获取点赞信息失败,请联系管理员:code=" + data.code);
            }
        });
    }
    //------------------------------------------搜索操作,包括分页-----------------------------------------------------
    //绑定每一个条件的key,a标签fieldVal的点击事件
    $(".fieldVal").live("click",function(){
        $("#searchField").html($(this).html());
        $("#searchField").attr("value",$(this).attr("value"));
    });
    $("#search").live("keyup",function(){
        //清空原有的值
        $("#reportPageInfo").html("");
        //清空分页记录
        $("#countAll").html("共"+0+"条记录"); //总页数
        $("#currentPage").html("第"+0+"/"+0+"页"); //当前页码
        $("#startPage").attr("href","javaScript:;"); //首页
        $("#backPage").attr("href","javaScript:;"); //上一页
        $("#nextPage").attr("href","javaScript:;"); //下一页
        $("#endPage").attr("href","javaScript:;"); //最后一页
        //用户输入的搜索条件
        var conditionsKey =$("#searchField").attr("value"); //key
        var conditionsVal =$("#search").val();    //val
        //请求数据
        $.ajax({
            dataType:'json',
            type:'post',
            data:{"conditionsKey":conditionsKey,"conditionsVal":conditionsVal},
            url:'../report/search.action',
            success:function(data){
                //循环写入到页面中
                //alert("success");
                if(data.list!=""){
                    //var status ="未处理";
                    $.each(data.list,function(i,item){
                        i=parseInt(i)+1;
                        //操作
                        /* var opt="<button class='btn blue' name='btnOpt' type='button' οnclick="+"shield('"+item.weiboid+"');"+">通过</button>";
                        opt+="<button class='btn red' name='btnOpt' type='button' οnclick="+"overlook('"+item.weiboid+"');"+">不通过</button>";
                        opt+="<a class='btn yellow' name='btnOpt' href='#responsive2' data-toggle='modal' οnclick="+"sel('"+item.weiboid+"');"+">查看</button>"; */
                        var shNickName ="未审核";
                        if(item.shUser!=null){
                            shNickName=item.shUser.nickName;
                        }
                        //审核时间
                        var shTime="未审核";
                        if(item.shTime!=null){
                            shTime=item.shTime;
                            var opt="<button class='btn grey' disabled='disabled' name='btnOpt' type='button' οnclick="+"shield('"+item.weiboid+"');"+">通过</button>&nbsp;&nbsp";
                            opt+="<button class='btn grey' disabled='disabled' name='btnOpt' type='button' οnclick="+"overlook('"+item.weiboid+"');"+">不通过</button>&nbsp;&nbsp";
                            opt+="<a class='btn grey' disabled='disabled' name='btnOpt' href='javaScript:;' data-toggle='modal' οnclick="+"sel('"+item.weiboid+"');"+">查看</button>";
                        }else{
                            var opt="<button class='btn blue'  name='btnOpt' type='button' οnclick="+"shield('"+item.weiboid+"');"+">通过</button>&nbsp;&nbsp";
                            opt+="<button class='btn red'  name='btnOpt' type='button' οnclick="+"overlook('"+item.weiboid+"');"+">不通过</button>&nbsp;&nbsp";
                            opt+="<a class='btn yellow'  name='btnOpt' href='#responsive2' data-toggle='modal' οnclick="+"sel('"+item.weiboid+"');"+">查看</button>";
                        }
                        //搜索结果
                        $("#reportPageInfo").append("<tr><td class='hidden-480'>"+i+"</td><td class='hidden-480'>"+item.jbUser.nickName+"</td><td class='hidden-480'>"+item.reason+"</td><td class='hidden-480'>"+item.jbTime+"</td><td class='hidden-480'>"+shNickName+"</td><td class='hidden-480'>"+shTime+"</td><td class='hidden-480' id="+item.weiboid+">"+opt+"</td></tr>");
                        //控制操作按钮的启用和禁用
                        /* if(shNickName!="未审核"){
                            $("#"+item.weiboid).find("button[name='btnOpt']").attr("disabled","disabled");
                        } */
                        //分页
                        //$("#pageTab").append("<tr><td>共${sPage.countAll }条记录</td><td>第${sPage.currentPage }/${sPage.allPage }页</td><td><a href='${pageContext.request.contextPath }${sPage.path }?num=1'>首页</a>&nbsp;&nbsp;&nbsp;<a href='${pageContext.request.contextPath }${sPage.path }?num=${sPage.currentPage-1<1?sPage.currentPage:sPage.currentPage-1}'>上一页</a>&nbsp;&nbsp;&nbsp;</tr>");
                        /* "allPage": 1,
                        "countAll": 1,
                        "countPage": 10,
                        "currentPage": 1,
                         */
                         //清空原有分页记录
                        $("#countAll").html(""); //总页数
                        $("#currentPage").html(""); //当前页码
                        $("#startPage").attr("href",""); //首页
                        $("#backPage").attr("href",""); //上一页
                        $("#nextPage").attr("href",""); //下一页
                        $("#endPage").attr("href",""); //总页数
                        
                        $("#countAll").html("共"+data.countAll+"条记录"); //总页数
                        $("#currentPage").html("第"+data.currentPage+"/"+data.allPage+"页"); //当前页码
                        $("#startPage").attr("href","javaScript:startPage('"+data.path+"','"+1+"','"+data.allPage+"')"); //首页
                        //num的值
                        /* var backPage =parseInt(data.currentPage);
                        if(backPage-1<1){
                            backPage=data.currentPage;
                        }else{
                            backPage=parseInt(data.currentPage)-1;
                        } */
                        $("#backPage").attr("href","javaScript:backPage('"+data.path+"','"+1+"','"+data.allPage+"')"); //上一页
                        
                         var nextPage =parseInt(data.currentPage);
                        if(nextPage+1>parseInt(data.allPage)){
                            nextPage=data.allPage;
                        }else{
                            nextPage=parseInt(data.currentPage)+1;
                        }
                        $("#nextPage").attr("href","javaScript:nextPage('"+data.path+"','"+nextPage+"','"+data.allPage+"')"); //下一页
                        $("#endPage").attr("href","javaScript:endPage('"+data.path+"','"+data.allPage+"','"+data.allPage+"')"); //最后一页
                    });
                }else{
                    $("#reportPageInfo").append("<tr><td colspan='7'>没有对应的举报信息</td></tr>");
                }
            },
            error:function(data){
                alert("网络出现异常,请稍后重试");
            }
        });
    });
    //分页 --下一页  path:请求分页路径 num:当前页的下一页 allpage:共多少页
    var nextPage = function(path,num,allPage){
        //alert(path+":"+currentPage+":"+allPage);
        //发送ajax请求
        pageAjax(num);
        //更改页面当前页的值
        $("#currentPage").html("第"+num+"/"+allPage+"页"); //当前页码
        //更改页面上一页的值
         var backPage =parseInt(num);
        if(backPage-1<1){
            backPage=num;
        }else{
            backPage=parseInt(num)-1;
        }
        $("#backPage").attr("href","javaScript:backPage('"+path+"','"+backPage+"','"+allPage+"')"); //上一页
        //更改页面下一页的值
        var nextPage =parseInt(num);
        if(nextPage+1>parseInt(allPage)){
            num=allPage;
        }else{
            num=parseInt(num)+1;
        }
        $("#nextPage").attr("href","javaScript:nextPage('"+path+"','"+num+"','"+allPage+"')"); //下一页
        
        
    };
    //分页 --上一页  path:请求分页路径 num:当前页的下一页 allpage:共多少页
    var backPage = function(path,num,allPage){
        //发送ajax请求
        pageAjax(num);
        //更改页面当前页的值
        $("#currentPage").html("第"+num+"/"+allPage+"页"); //当前页码
        //更改页面上一页的值
         var backPage =parseInt(num);
        if(backPage-1<1){
            backPage=num;
        }else{
            backPage=parseInt(num)-1;
        }
        $("#backPage").attr("href","javaScript:backPage('"+path+"','"+backPage+"','"+allPage+"')"); //上一页
        
        //更改页面下一页的值
        var nextPage =parseInt(num);
        if(nextPage+1>parseInt(allPage)){
            num=allPage;
        }else{
            num=parseInt(num)+1;
        }
        $("#nextPage").attr("href","javaScript:nextPage('"+path+"','"+num+"','"+allPage+"')"); //下一页
        
    };
    //首页
    var startPage = function(path,num,allPage){
        //发送ajax请求
        pageAjax(num);
        //更改页面的值
        $("#currentPage").html("第"+1+"/"+allPage+"页"); //当前页码
        $("#backPage").attr("href","javaScript:backPage('"+path+"','"+num+"','"+allPage+"')"); //上一页
        $("#nextPage").attr("href","javaScript:nextPage('"+path+"','"+2+"','"+data.allPage+"')"); //下一页
        $("#endPage").attr("href","javaScript:searchPage('"+path+"','"+allPage+"')"); //最后一页
    };
    //最后一页(尾页)
    var endPage = function(path,num,allPage){
        //发送ajax请求
        pageAjax(num);
        //更改页面的值
        $("#currentPage").html("第"+num+"/"+allPage+"页"); //当前页码
        //更改页面上一页的值
         var backPage =parseInt(num);
        if(backPage-1<1){
            backPage=num;
        }else{
            backPage=parseInt(num)-1;
        }
        $("#backPage").attr("href","javaScript:backPage('"+path+"','"+backPage+"','"+allPage+"')"); //上一页
        $("#nextPage").attr("href","javaScript:nextPage('"+path+"','"+num+"','"+data.allPage+"')"); //下一页
        $("#endPage").attr("href","javaScript:searchPage('"+path+"','"+allPage+"')"); //最后一页
    };
    //按条件查询后,点击上一页下一页时的的数据请求,条件从页面中取
    var pageAjax = function(num){
        //清空原有的值
        $("#reportPageInfo").html("");
        //用户输入的搜索条件
        var conditionsKey =$("#searchField").attr("value"); //key
        var conditionsVal =$("#search").val();    //val
        //请求数据
        $.ajax({
            dataType:'json',
            type:'post',
            data:{"conditionsKey":conditionsKey,"conditionsVal":conditionsVal,"num":num},
            url:'../report/search.action',
            success:function(data){
                //循环写入到页面中
                //alert("success");
                if(data.list!=""){
                    //var status ="未处理";
                    $.each(data.list,function(i,item){
                        i=parseInt(i)+1;
                        var shNickName ="未审核";
                        if(item.shUser!=null){
                            shNickName=item.shUser.nickName;
                        }
                        //审核时间
                        var shTime="未审核";
                        if(item.shTime!=null){
                            shTime=item.shTime;
                            var opt="<button class='btn grey' disabled='disabled' name='btnOpt' type='button' οnclick="+"shield('"+item.weiboid+"');"+">通过</button>&nbsp;&nbsp";
                            opt+="<button class='btn grey' disabled='disabled' name='btnOpt' type='button' οnclick="+"overlook('"+item.weiboid+"');"+">不通过</button>&nbsp;&nbsp";
                            opt+="<a class='btn grey' disabled='disabled' name='btnOpt' href='javaScript:;' data-toggle='modal' οnclick="+"sel('"+item.weiboid+"');"+">查看</button>";
                        }else{
                            var opt="<button class='btn blue'  name='btnOpt' type='button' οnclick="+"shield('"+item.weiboid+"');"+">通过</button>&nbsp;&nbsp";
                            opt+="<button class='btn red'  name='btnOpt' type='button' οnclick="+"overlook('"+item.weiboid+"');"+">不通过</button>&nbsp;&nbsp";
                            opt+="<a class='btn yellow'  name='btnOpt' href='#responsive2' data-toggle='modal' οnclick="+"sel('"+item.weiboid+"');"+">查看</button>";
                        }
                        //搜索结果
                        $("#reportPageInfo").append("<tr><td class='hidden-480'>"+i+"</td><td class='hidden-480'>"+item.jbUser.nickName+"</td><td class='hidden-480'>"+item.reason+"</td><td class='hidden-480'>"+item.jbTime+"</td><td class='hidden-480'>"+shNickName+"</td><td class='hidden-480'>"+shTime+"</td><td class='hidden-480' id="+item.weiboid+">"+opt+"</td></tr>");
                    });
                }else{
                    $("#reportPageInfo").append("<tr><td colspan='6'>没有对应的举报信息</td></tr>");
                }
            },
            error:function(data){
                alert("网络出现异常,请稍后重试");
            }
        });
    };
</script>

<script type="text/javascript">
    var _gaq = _gaq || [];
    _gaq.push([ '_setAccount', 'UA-37564768-1' ]);
    _gaq.push([ '_setDomainName', 'keenthemes.com' ]);
    _gaq.push([ '_setAllowLinker', true ]);
    _gaq.push([ '_trackPageview' ]);
    (function() {
        var ga = document.createElement('script');
        ga.type = 'text/javascript';
        ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://'
                : 'http://')
                + 'stats.g.doubleclick.net/dc.js';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(ga, s);
    })();
</script>
<!-- 页面进入js结束 -->
</html>

 

转载于:https://www.cnblogs.com/zovon/p/4409721.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值