<div class="content_wrapper">
<style>
    .btn-name {
        white-space: nowrap;
    }
</style>
    <div class="container-fluid">
        <div id="msg-tip"></div>
        <div class="row">
            <div class="col-sm-12">
                <aside>
                    <header><i class="fa fa-fw fa-file"></i>聊天举报</header>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-sm-12">
                                    <div class="table-responsive">
                                        <table id="example" class="table table-striped table-bordered table-hover" cellspacing="0" width="100%">
                                            <thead>
                                            <tr>
                                                <th>用户ID</th>
                                                <th>举报次数</th>

                                                <th>操作</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <?php
                                            if(is_array($list)  && !empty($list)){
                                                foreach ($list as $key => $vl) { ?>
                                                    <tr>
                                                        <td><a target = "_blank" href="#user/index/<?php echo $vl['touid'];?>"><?php echo $vl['touid'];?></a></td>
                                                        <td><?php echo $vl['count'];?></td>
                                                        <td>
                                                            <?php
                                                            if($vl['chatLock'] == 0){
                                                                echo '<button id="chatLock" type="button" class="btn btn-danger" onclick="changeChatLock(1,'.$vl['touid'].')">聊天禁言</button>';
                                                            }else{
                                                                echo '<button id="chatLock" type="button" class="btn btn-success" onclick="changeChatLock(2,'.$vl['touid'].')">解除禁言</button>';
                                                            }
                                                            ?>
                                                            <a href="#chat/reportContent/<?php echo $vl['touid'];?>" class="btn btn-primary active" role="button">举报详情</a>
                                                        </td>
                                                    </tr>
                                                <?php }
                                            } else{?>
                                            <tr>
                                                <td colspan="10">暂无数据</td>
                                            </tr>
                                            <?php } ?>
                                            </tbody>
                                        </table>
                                    </div>
                                    <nav>
                                        <ul class="pagination">
                                            <li class="disabled"><a href="#">共<span class="pagetotal"><?php echo $total;?></span>条</a></li>
                                            <?php echo $pageurl;?>
                                        </ul>
                                    </nav>
                                </div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
        </div>
    </div>

</div>

<script src="<?php echo base_url();?>public/js/common.js"></script>
<script>
    function changeChatLock(type,uid) {
        var tips = (type==1)?"确认禁言该账号?备注原因：":"确认解除禁言?";
        var tips2 = (type==1)?"禁言成功":"解除禁言成功";
        var remark = '';
        if(type==1){
            remark = prompt(tips);
            if(remark){

            }else if(remark === ""){
                alert('请输入禁言原因');
                return false;
            }else{
                return false;
            }
        }
        $.post("user/chatLock", { uid: uid,remark:remark }, function(data){
            if( data == 1 ){
                alert(tips2);
                window.location.reload();
            }
        });
    }
</script>