<style type="text/css">
    .topic_gjc{width: 120px;height: 26px;display: inline-block;}
    .mr20{margin-right: 20px;}
    .spgl_btn_sj{border: 0;width: 80px;}

    .cover{width: 100%;height: 100%;position: fixed;top: 0;left: 0;background-color: #000;opacity: 0.4;z-index: 666;}
    .input_box{width: 460px;height: 340px;background-color: #FFF;position: fixed;top: 100px;left: 0;z-index: 888;overflow:hidden;}
    .input_list{width: 380px;height: 220px;margin: 0px auto;margin-top: 20px;border: 1px solid #CCC;border-radius: 4px;overflow-y: scroll;padding: 10px;}
    .input_list input{display: block;border: 1px solid #CCC;border-radius: 4px;color: #7D7D7D;font-size: 15px;width: 220px;height: 32px;margin-bottom: 10px;text-indent: 12px;}
    .ipt_sub{display: block;background-color: #A8E353;float: right;margin-top:15px; margin-right: 30px;border-radius: 4px;color: #FFF;width: 120px;height: 32px;border: 0;}
</style>

<div class="col-md-10" role="main">
    <nav class="breadcrumb"></i>关键词<span class="c-gray en">&gt;</span>关键词管理</nav>
    <div class="title-box">
        <p class="t-p"  style="font-size: 28px; color: #7d7d7d;vertical-align: middle; padding-top: 15px; padding-bottom: 15px;">关键词</p>
         <div class="t-e" style="margin-left:30px">
            <img src="assets/images/explain.png" alt="">
            <span>说明：① 在此管理朋友圈关键词</span>
        </div>
    </div>

     <div class="topic_box">
        <form method='post' action="<?php echo site_url('keywords/jump');?>">
            <div class="screening">
                <div class="topic_group">
                   <!-- <input type="text"class="form-control topic_group_gjz topic_add_gjc" id="keyw" placeholder="添加关键词" name="keywords"> -->  
                   <div style="float:right">
                    <button type="button" class="tianjia topic_add_gjc_btn"  data-target="#myModal" data-toggle="modal" >添加</button>
                    <button type="button"  id="keyword_del" class="topic_add_gjc_btn" style="margin-left: 60px;">删除</button>
                    </div>
                    <div style="clear: both;">
                    </div>
                </div>
            </div>
        </form>
        <div class="m_table_box topic_table" >
            <table widtn="80%;">
                <thead>
                <tr>
                    <th class="s-thead" style="width:60px;height:40px;"></th>
                    <th class="s-thead" style="width:118px;height:40px;">序号</th>
                    <th class="s-thead" style="width:337px;height:40px;">关键词</th>
                    <th class="s-thead" style="width:152px;height:40px;">添加时间</th>
                </tr>
                </thead>
                <tbody>
              
                   <!--  <td><img src="<?php echo asset_url('images/select_box.png')?>" alt="" class="biu_rdo_img " isc="0" vid="0"></td> -->
                     <?php 
                     foreach ($data as $key => $value) {
                        echo "<tr><td style='width:60px;height:50px;'><img src='";
                        echo asset_url('images/select_box.png');
                        echo "' alt='' class='biu_rdo_img ' isc='0' vid='0' tid='".$value['id']."'></td>";
                        echo "<td style='width:118px;height:50px;'>";
                        echo $value['id'];
                        echo "</td><td style='width:337px;height:50px;'>";
                        echo $value['keyword'];
                        echo "</td><td style='width:152px;height:50px;'>";
                        echo $value['createtime'];
                        echo "</td></tr>";
                     }
                     ?>
      
                </tbody>
            </table>

        </div>
        <?php echo $page; ?>
    </div>
</div>
<div class="modal fade equity" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" style=" width:0px;height:0px;" >
        <form action="<?php echo site_url('keywords/jump/')?>" method="post" class="registerForm regiswidth" enctype="multipart/form-data">
           <div class="cover"></div>
    <div class="input_box" id="box">
         <div class="t-e" style="margin-left:35px ;margin-top: 15px;">
            <img src="assets/images/explain.png" alt="">
            <span>说明：可批量加入禁用关键词，换行隔开</span>
        </div>
        <div class="input_list" style="text-align:center;overflow-y:hidden;margin-top: 0px;">
            <textarea name="titleg" id="titleg" style="width:100%;height:100%; border:none;" ></textarea>
        </div>
        <button type="button"  class="ipt_sub" style="float:left;margin-left: 30px;" data-dismiss="modal">取消</button>
        <button class="ipt_sub" id='tijiao' onclick="return subyan();" type="submit">提交</button>
    </div>
        </form>
    </div>

<script type="text/javascript" src="<?php echo asset_url('js/bootstrap-datepicker.js') ?>"></script>
<script type="text/javascript" src="<?php echo asset_url('js/validate.js') ?>"></script>
<script type="text/javascript" src="<?php echo asset_url('js/bootstrapValidator.min.js') ?>"></script>
<script type="text/javascript" src="<?php echo asset_url('js/common.js') ?>"></script>

<script type="text/javascript">
$(function(){
      // 单选按钮切换
    $('.biu_rdo_img').click(function(){
        var isc=$(this).attr('isc');
        if(isc==0){
            $(this).attr('src','<?php echo asset_url('images/selected_box.png')?>');
            $(this).attr('isc','1');
        }else{
            $(this).attr('src','<?php echo asset_url('images/select_box.png')?>');
            $(this).attr('isc','0');
        }
    })
}); 

function subyan(){
    var titleg=$("#titleg").val();
    if(!titleg){
        alert("请输入关键词");
        return false;
    }
}


window.onload=function(){
    var wWidth=document.body.clientWidth; 
    var obox=document.getElementById("box");
    obox.style.left=(wWidth-460)/2+"px";
}
        $('.tianjia').bind('click',function(){
       
        
       
        
    })

    //删除
    $('#keyword_del').click(function(e) {
        var ids = '';
        if(confirm("确定要删除吗？")) {
            $('.biu_rdo_img').each(function() {
                if ($(this).attr('isc') == 1) {
                    if (ids === '') {
                        ids += $(this).attr('tid');
                    } else {
                        ids += ',' + $(this).attr('tid');
                    }
                }
            });
            if (ids === '') {
                alert('请选择要删除的话题');
                return false;
            } else {
                $.ajax({
                    url: "<?php echo site_url('keywords/keywords_del')?>",
                    type: 'POST',
                    dataType: 'json',
                    data: {tids: ids},
                    success:function(data)
                    {
                        location.href="<?php echo site_url('keywords/index')?>";
                    }
                })
            }
        }
    });
</script>