<style>
.elput{width: 20%;margin-left: 428px;}
.sdiv{margin-top:18px;}
.dianm{margin-top: 0px}
.ssele{width: 91%}
.slable{margin-left:0px}
.reset_bg{margin-top: 50px;}
.t-e {
    margin-left: 30px;
    overflow: hidden;
    margin-bottom: 15px;
    margin-top: 5px;
}

.yq_gn_box {
    width: 775px;
    overflow: hidden;
    margin-left: 30px;
    margin-top: 20px;
}

</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">
            <img src="<?php echo asset_url('images/explain.png');?>" alt="">
            <span>说明：用于配置邀请好友相关功能。若要邀请好友功能，请在发现频道入口组中添加。</span>
        </div>
    </div>
    <form action="<?php echo site_url('mocuzfun/client_fun/saveinte_func')?>" method="post" class="registerForm regiswidth" enctype="multipart/form-data">
        <div class="yq_gn_box">
            <div class="gn_set">
                <span>每邀请一名用户，邀请者获得积分数量</span>
                <input type="text" maxlength="6" placeholder="0" value="<?php echo $invite_user_num['value'];?>" name="invite_user_num">
            </div>
            <div class="gn_set">
                <span>输入邀请码的用户，获得积分数量</span>
                <input type="text" maxlength="6" placeholder="0" value="<?php echo $invite_self_num['value'];?>" name="invite_self_num">
            </div>
            <div class="gn_set">
                <span>选择增加积分种类</span>
                <div style="float: right;">
                    <div class="gn_jf_type">
                        <p class="reward_je_p"></p> 
                        <img src="<?php echo asset_url('images/triangle.png');?>" alt="" class="sel_down">              
                    </div>
                    <input type="hidden" value="<?php echo $invite_score_type['value']?>" name="invite_score_type">
                     <ul isn="0" style="position: absolute;background-color: #FFF;">
                            <li class="<?php !$invite_score_type['value']?'on_jf_type':'';?>" vid="0">请选择分类</li>
                        <?php
                            foreach ($extcredits as $id => $value)
                            {
                                if($value['available']){

                        ?>
                                <li class="<?php if($id == $invite_score_type['value']){echo "on_jf_type";}?>" vid="<?php echo $id;?>"><?php echo empty($value['title']) ? 'extcredit'.$id : $value['title']; ?></li>
                        <?php
                                }
                            }
                        ?>
                    </ul>
                </div>         
            </div>

            <div class="gn_gz_box">
                <p>邀请好友规则详情</p>
                <div style="margin-bottom:20px;">
                    <img src="<?php echo asset_url('images/explain.png');?>" style="width: 16px;">
                    <span style="font-size:12px;color: #ADADAD;  vertical-align: middle;">说明：请在下方输入邀请好友的规则详情，以便用户知晓。</span>
                </div>
                <textarea class="gn_text_area" name="invite_rule"><?php echo $invite_rule['value'];?></textarea>
            </div>
            <div class="gn_gz_box">
                <p>分享页面用户评论</p>
                <div style="margin-bottom:20px;">
                    <img src="<?php echo asset_url('images/explain.png')?>" style="width: 16px;">
                    <span style="font-size:12px;color: #ADADAD;  vertical-align: middle;">说明：每行一句话，用于展示页面模拟用户评论。</span>
                </div>
                <textarea class="gn_text_area" name="invite_comments"><?php echo $invite_comments['value'];?></textarea>
            </div>
            <button class="edit_btn" id="save">保存修改</button>
        </div>
    </form>
    </div>
<script type="text/javascript">

$(function(){
        //提交表单事件
        $("#save").on('click',function(event) {
            event.preventDefault();
            /* Act on the event */
            var invite_score_type = $('input[name=invite_score_type]').val();
            if(invite_score_type == 0)
            {
                alert('请选择积分种类');
                return false;
            }
            var regExp1 = /^[1-9]\d*$/;
            var subvalue = new Array();
            subvalue[0] = $('input[name=invite_user_num]').val();  
            subvalue[1] = $('input[name=invite_self_num]').val();
            for (i=0;i<subvalue.length;i++)
            {
                if(!regExp1.test(subvalue[i]))
                {
                    alert('请输入正确分值');
                    return false;
                }
            }
            $('form').submit();
        });
        //初始化下拉框
        $('.gn_set ul li').each(function(index) {
            if($(this).attr('vid') == <?php echo $invite_score_type['value']?>)
            {
                $('.gn_jf_type p').text($(this).text());
            }
        });
        // 模拟下拉框
        $('.gn_jf_type,.sel_down').click(function(e){
            e.stopPropagation();
            var isn=$('.gn_set ul').attr('isn');
            if(isn==0){
                $('.gn_set ul').show();
                $('.gn_set ul').attr('isn','1');
            }else{
                $('.gn_set ul').hide();
                $('.gn_set ul').attr('isn','0');
            }
        })

        $('.gn_set ul li').mouseover(function(){
            $(this).addClass('on_jf_type');
            $(this).siblings().removeClass('on_jf_type');
        })

        $('.gn_set ul li').click(function(){
            var vid = $(this).attr('vid');
            $("input[name=invite_score_type]").val(vid);    
            $('.gn_set ul').hide();
            $('.gn_set ul').attr('isn','0');
            var text=$(this).text();
            $('.gn_jf_type p').text(text);
        })
})    
</script>
</body>
</html>