<style>
    .ediv{padding-bottom:20px}
    .elput{width: 80%;margin-left: 30px;}
    .elp{padding-left: 30px;}
    .khdpz-biugroup{margin-top: 10px;}
    .reset_bg{margin-top: 50px;}    
	.t-e {
    margin-left: 30px;
    overflow: hidden;
    margin-bottom: 15px;
    margin-top: 5px;}
	
	.biu_box, .reward_box {
    margin-left: 30px;
    width: 700px;
    overflow: hidden;}
	
</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;">朋友圈管理（Biu）</p>
        <div class="t-e">
            <img src="<?php echo asset_url('images/explain.png');?>" alt="">
            <span>说明：用于控制客户端中的朋友圈（原Biu）功能。</span>
        </div>
    </div>

            <form action="<?php echo site_url('mocuzfun/client_fun/savebiu')?>" method="post" class="registerForm regiswidth" enctype="multipart/form-data">
                <div class="biu_box">
                    <div class="form-group ediv khdpz-biugroup">
                        <span class="dianm biu_tle">朋友圈功能：</span>
                        <input type="hidden" value="<?php echo $biu_switch['value'];?>" name="biu_switch">

                        <div class="biu_rdo" style="margin-top: 11px;">
                            
                            <img src="<?php echo asset_url('images/unchoice.png');?>" alt="" class="biu_rdo_img " isc="0" pid="1"> <span>开启</span>
                            <img src="<?php echo asset_url('images/unchoice.png');?>" alt="" class="biu_rdo_img left_rdo" isc="0" pid="0"> <span>关闭</span>
                        </div>
                    </div> 

                    <div class="form-group khdpz-biugroup" >
                        <span class="dianm biu_tle">数据调用版块(适用于V3.1.0以前的版本)：</span>
                        <div class="examp">
                            <input type="text" class="biu_ipt" name="biu_data_source" value="<?php echo $biu_data_source['value'];?>">                         
                        </div>
                         <div class="t-e biu_e">
                            <img src="<?php echo asset_url('images/explain.png');?>" alt="">
                            <span>说明：由于帖子历史数据可能较为杂乱，建议使用独立空白版块运营朋友圈功能（亦可沿用2.x版本的朋友圈）。</span>
                        </div>
                    </div> 

                    <div class="form-group khdpz-biugroup" >
                        <span class="dianm biu_tle">热帖显示规则(适用于V3.1.0以前的版本)</span>
                        <input type="hidden" name="biu_show_rule" value="<?php echo $biu_show_rule['value'];?>">
                        <div class="biu_rdo kedgn-biu-rdo" style="margin-top:10px;">
                            <?php 
                                foreach ($show_rules as $v) {
                            ?>
                                <img src="<?php echo asset_url("images/unchoice.png");?>" alt="" class="biu_rdo_img " isc="0" sid="<?php echo $v;?>"> <span><?php echo $v == 0?"全局":$v.'天';?>热帖</span>
                            <?php
                                }
                            ?>                      
                        </div>
                         <div class="t-e biu_e">
                            <img src="<?php echo asset_url('images/explain.png');?>" alt="" />
                            <span>说明：若要管理朋友圈中的话题，请前往论坛DZ后台-版块管理-进入对应版块的帖子分类功能中配置。</span>
                        </div>
                    </div> 
                     <button class="edit_btn" id="save">保存修改</button>
                </div>
            </form>    
        
    </div>
<script type="text/javascript">

$(function(){
    var biu_show_rule = $('input[name=biu_show_rule]').val();
    var biu_switch = $('input[name=biu_switch]').val();

    $('.biu_rdo_img').each(function(){
     if($(this).attr('sid') == biu_show_rule || $(this).attr('pid') == biu_switch)
     {
        $(this).attr('src','<?php echo asset_url("images/choice.png");?>');
        $(this).attr('isc',1);
     }
    });
    $('#save').on('click', function(event) {
        event.preventDefault();
        /* Act on the event */
        var biu_switch = $('input[name=biu_switch]').val();
        var biu_data_source = $('input[name=biu_data_source]').val();
        var regExp1 = /^\d+$/;
        if(biu_switch == 1)
        {
            if(regExp1.test(biu_data_source) == false)
            {
                alert('请输入正确的板块ID');
                return false;
            }
        }
        $('form').submit();
    });
    // 单选按钮切换
    $('.biu_rdo img').click(function(){

        if(typeof($(this).attr('sid')) != "undefined")
        {
            var subval = $(this).attr('sid');
            $('input[name=biu_show_rule]').val(subval);

        }
        if(typeof($(this).attr('pid')) != "undefined")
        {
            var pval = $(this).attr('pid');
            $('input[name=biu_switch]').val(pval); 
        }
     
        var isc=$(this).attr('isc');
        if(isc==0){
            $(this).attr('src','<?php echo asset_url("images/choice.png")?>');
            $(this).attr('isc','1');
            $(this).siblings('img').attr('src','<?php echo asset_url("images/unchoice.png");?>');
            $(this).siblings('img').attr('isc','0');
        }
    })
})    
</script>