<style>

.elput{width: 20%;margin-left: 428px;padding-left: 53px}

.sdiv{margin-top:18px;}

.dianm{margin-top: 0px}

.ssele{width: 91%}

.slable{margin-left:0px}

.bdiv{background-color: #fff;box-shadow:none;border-style:none;}

.score{border: 1px solid #ccc;margin-left:5px}

.t-e img {

    width: 16px;

    margin-left:10px;

}



.reward_box {

    margin-left: 0px !important;

    width: 700px;

    overflow: hidden;

}

.biu_rdo{

    float:left;

    margin-top: 10px;

    margin-bottom: 25px;

}

.biu_rdo span{

    font-size: 16px;

    color:#333;

}

.biu_tle{

    font-size: 16px;

}

.biu_ipt{

    width: 80%;

    text-align: left;

}

.khdpz-biugroup{

    padding-bottom: 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>



    <div class="bs-example bdiv">

        <form action="<?php //echo site_url('mocuzfun/client_fun/save_reward')?>" method="post" class="regiswidth registerForm" enctype="multipart/form-data">

            

            <div class="reward_box" style="width:800px!important;">

                <div class="form-group" >

                    <input type="hidden" name="link_switch" value="<?php echo $switch;?>">

                    <div class="biu_rdo">



                        <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="2"> <span>其他应用市场上架</span>

                    </div>

                </div>



                <div class="form-group khdpz-biugroup address1" style="display:none">

                    <span class="dianm biu_tle">微下载链接地址：</span>

                    <div class="examp">

                        <input type="text" class="biu_ipt" style="width:95%" name="link_value1" value="<?php echo ($switch==1)?$linkvalue[0]:'';?>">                         

                    </div>

                     <div class="t-e biu_e">

                        <img src="<?php echo asset_url('images/explain.png');?>" alt="">

                        <span>说明：打开应用宝管理中心，找到已上线的应用并打开，在“运营服务”标签中点击“微下载”，复制微下载链接地址，填入上方文本框中。</span>

                    </div>

                </div>

                

            

                <div class="form-group khdpz-biugroup address2" >

                    <span class="dianm biu_tle">Android（安卓）下载链接地址：</span>

                    <div class="examp">

                        <input type="text" class="biu_ipt" name="link_value2[]" value="<?php echo $switch==2?$linkvalue[0]:'';?>">                         

                    </div>

                     <div class="t-e biu_e">

                        <img src="<?php echo asset_url('images/explain.png');?>" alt="">

                        <span>说明：请填写安卓安装包下载链接，支持第三方应用商店链接。</span>

                    </div>

                </div>



                <div class="form-group khdpz-biugroup address2" >

                    <span class="dianm biu_tle">IOS（苹果）下载链接地址：</span>

                    <div class="examp">

                        <input type="text" class="biu_ipt" name="link_value2[]" value="<?php echo $switch==2?$linkvalue[1]:'';?>">                 

                    </div>

                     <div class="t-e biu_e">

                        <img src="<?php echo asset_url('images/explain.png');?>" alt="">

                        <span>说明：请填写苹果应用商店下载链接，如有疑问请联系运营人员。</span>

                    </div>

                </div> 

                <div class="form-group">

                    <span class="dianm biu_tle">页面描述:</span>

                    <div class="examp">

                        <textarea name="share_content" class="form-control" cols="30" rows="3" maxlength="40" data-bv-field="card_des"><?php echo $sharecontent;?></textarea>                        

                    </div>

                     <div class="t-e biu_e">

                        <img src="<?php echo asset_url('images/explain.png');?>" alt="">

                        <span>说明：分享的帖子详情下方阅读全文打开的引导页中间的描述语，填入上方文本框中。</span>

                    </div>

                </div>
                            

                 <button class="edit_btn" id="save">保存修改</button>

            </div>

        </form>    

    </div>

</div>

<script>

    jQuery(document).ready(function($) {

        //初始化显示

        var link_switch = $('input[name=link_switch]').val();

        $('.biu_rdo_img').each(function(){

         if($(this).attr('pid') == link_switch)

         {

            $(this).attr('src','<?php echo asset_url("images/choice.png");?>');

            $(this).attr('isc',1);

            $(".address1,.address2").hide();

            $('.address'+link_switch).show();

         }

        });

         // 单选按钮切换

         $('.biu_rdo img').click(function(){

            var pval = $(this).attr('pid');

            $('input[name=link_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');

                 var hid = $(this).siblings('img').attr('pid');

                 var sid = $(this).attr('pid');

                 $('.address'+hid).hide();

                 $('.address'+sid).show();

            }

         })

         //表单提交

         $('#save').on('click', function(event) {

            event.preventDefault();

             /* Act on the event */

            var link_switch = $('input[name=link_switch]').val();

            var link_value = {};

            if(link_switch ==1)

            {

                var value1= $('input[name=link_value1]').val();

                if(value1 == "")

                {

                    alert('微下载链接地址必须填写');

                    return false;

                }

                link_value[0] = value1;

            }

            if(link_switch ==2)

            {

                

                var value2 = $("input[name=link_value2]").val();

                var value3 = $("input[name=link_value3]").val();

                var bool = 1;

                $("input[name^=link_value2]").each(function(index){

                    if($(this).val() == "")

                    {

                        alert('安卓和苹果下载链接地址都必须填写');

                        bool = 0;

                        return false;

                    }

                   link_value[index]=$(this).val();

                })

                
                if(bool == 0)

                {

                    return fasle;

                }     

            }

            var pkgname=$("input[name=pkgname]").val();

            if(pkgname=="")

            {
                alert('包名必须填写');

                return false;
            }

            var share_content=$("textarea[name=share_content]").val();
            $.post('<?php echo site_url("mocuzfun/client_fun/save_link");?>', {link_switch: link_switch,link_value:link_value,share_content:share_content,pkgname:pkgname}, function(data) {

                /*optional stuff to do after success */

                if(data.code == 1)

                {

                    alert('保存成功');

                    location.href="";

                }

            },'json');

         });

    });

</script>