<include file="Public:header"/>
<style>
    #J_imageView img {
        width: 80px;
        height: 80px;
        margin-right: 10px;
    }

</style>
<body class="fixed-left">
<!-- Begin page -->
<div id="wrapper">

    <!-- Top Bar Start -->
    <include file="Public:nav"/>
    <!-- Top Bar End -->

    <!-- Left Sidebar Start -->
    <include file="Public:menu"/>
    <!-- Left Sidebar End -->

    <!-- Start right content -->
    <div class="content-page">
        <ol class="breadcrumb">
            <li><a style="curor:pointer;" href="{:U(' Index/index')}">首页</a></li>
            <li><a href="#">{:parent_name($action_name)}</a></li>
            <li><a href="">编辑专辑</a></li>
        </ol>
        <div class="content">
            <!-- 列表start -->
            <form class="form-horizontal" action="/Admin/Category/setting" id='formdata' method='post'>
                <div class="widget" style='padding:20px 20px;'>
                    <div class="widget-content padding">
                        <div class="col-sm-6">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">Logo：</label>
                                <div class="col-sm-2">
                                    <input id='upimage' name="thumb" class="form-control btn-blue-2" type="file" title="点击上传">
                                </div>
                                <div class="col-sm-4">
                                    <div id="J_imageView"><?php if($info['logo']['value'] !=''){ ?><img src="{$info.logo.value}" alt=""><?php }?></div>
                                    <div id="J_imageViewin"><input type='hidden' name='logo' value="{$info.logo.value}"/></div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">网站配色：</label>
                                <label >
                                    <input type="radio" name="color" value="1" <?php if($info['color']['value'] ==1){echo 'checked'; }?>>
                                </label>
                                活力橙
                               <button style="width:25px;height:25px;background: orangered" ></button>&nbsp;&nbsp;&nbsp;&nbsp;
                                <label>
                                    <input type="radio" name="color" value="2" <?php if($info['color']['value'] ==2){echo 'checked'; }?>>
                                </label>
                                科技蓝
                                <button style="width:25px;height:25px;background: #3366CC;"></button>&nbsp;&nbsp;&nbsp;&nbsp;
                                <label>
                                    <input type="radio" name="color" value="3" <?php if($info['color']['value'] ==3){echo 'checked'; }?>>
                                </label>
                                蜜桃粉
                                <button style="width:25px;height:25px;background: hotpink"></button>

                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">版权信息：</label>
                                <div class="col-sm-5">
                                    <input type="text" class="form-control" id="copyright" name='copyright' placeholder="版权信息" value="{$info.copyright.value}">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label"></label>
                                <div class="col-sm-3">
                                    <input class='form-control btn-blue-2 btn-add' type="button" value='提交'>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
            <!-- 列表end -->
            <include file="Public:copyright"/>
        </div>  
    </div>
</div>
<include file="Public:footer"/>
<script src="/Public/js/jquery.form.js"></script>
<script>
    $(function () {
        $("#upimage").change(function(){
            $("#formdata").ajaxSubmit({
                type:'post',
                url:'/Admin/Category/uploadImage',
                success:function(e){
                    if(e == -1){
                        notify('error','top center','图片上传失败');
                    } else {
                        var div = $('#J_imageView');
                        div.html("<img src='" +e+ "'/>");
                        $('#J_imageViewin').html("<input type='hidden' name='logo' value='" +e+ "'/>");
                    }
                }
            });
        })

        $(".btn-add").click(function () {
            $("#formdata").ajaxSubmit({
                type: 'post',
                url: "/Admin/Category/setting",
                success: function (data) {
                 if (data == 'ok') {
                        notify('success', 'top center', '更新成功');
                        setTimeout(function () {
                            location.reload();
                        }, 1000);
                    }
                }
            });
        })
    })
</script>
</body>
</html>