<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title><?php echo ($title); ?> | 追格小程序后台管理</title>   
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
        <meta name="apple-mobile-web-app-capable" content="yes" />
        <meta name="description" content="追格微信小程序后台管理">
        <meta name="keywords" content="追格,小程序">
        <meta name="author" content="追格">

        <!-- Base Css Files -->
        <link href="/Public/assets/libs/jqueryui/ui-lightness/jquery-ui-1.10.4.custom.min.css" rel="stylesheet" />
        <link href="/Public/assets/libs/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
        <link href="/Public/assets/libs/font-awesome/css/font-awesome.min.css" rel="stylesheet" />
        <link href="/Public/assets/libs/fontello/css/fontello.css" rel="stylesheet" />
        <link href="/Public/assets/libs/animate-css/animate.min.css" rel="stylesheet" />
        <!-- <link href="/Public/assets/libs/nifty-modal/css/component.css" rel="stylesheet" /> -->
        <link href="/Public/assets/libs/pace/pace.css" rel="stylesheet" />
        <link href="/Public/assets/libs/jquery-icheck/skins/all.css" rel="stylesheet" />
		<link href="/Public/assets/libs/jquery-notifyjs/styles/metro/notify-metro.css" rel="stylesheet" type="text/css" />

        <link href="/Public/assets/css/style.css" rel="stylesheet" type="text/css" />
        <link href="/Public/assets/css/style-responsive.css" rel="stylesheet" />
		<link href="/Public/css/append.css" rel="stylesheet" />

        <link rel="shortcut icon" href="/favicon.ico">
        <link rel="apple-touch-icon" href="/Public/assets/img/apple-touch-icon.png" />
    </head>
	
<body class="fixed-left">
	<!-- Begin page -->
	<div id="wrapper">
		
        <!-- Top Bar Start -->
        <div class="topbar">
            <div class="topbar-left">
                <div class="logo">
                    <h1><a href="#"><img src="/Public/assets/img/logo.png" alt="Logo"></a></h1>
                </div>
                <button class="button-menu-mobile open-left">
                <i class="fa fa-bars"></i>
                </button>
            </div>
            <!-- Button mobile view to collapse sidebar menu -->
            <div class="navbar navbar-default" role="navigation">
                <div class="container">
                    <div class="navbar-collapse2">
                        <ul class="nav navbar-nav navbar-right top-navbar">
                            <li class="dropdown iconify hide-phone"><a href="#" onclick="javascript:toggle_fullscreen()"><i class="icon-resize-full-2"></i></a></li>
                            <li class="dropdown topbar-profile">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="rounded-image topbar-profile-image"><img src="/Public/images/users/user-35.jpg"></span><strong><?php echo session('admin_name')?></strong> <i class="fa fa-caret-down"></i></a>
                                <ul class="dropdown-menu">
                                    <li><a href='/admin/Index/updPwd'><i class="icon-key"></i> 修改密码</a></li>
                                    <li><a id="btn-logout" href="javascript:void(0)"><i class="icon-logout-1"></i> 退出</a></li>
                                </ul>
                            </li>
                        </ul>
                    </div>
                    <!--/.nav-collapse -->
                </div>
            </div>
        </div>
        <!-- Top Bar End -->
        		
        <!-- Left Sidebar Start -->
        <!-- Left Sidebar Start -->
<div class="left side-menu">
    <div class="sidebar-inner slimscrollleft">
        <!--- Divider -->
        <div id="sidebar-menu">
            <ul>
					<li class=''>
						<a href='/Admin/Index/index'><i class='icon-home-3'></i><span>首页</span></a>
					</li>
					<?php  foreach($navlist as $k=>$v) { if(in_array($v['id'], $role)) { ?>
							<li class='has_sub'><a href='javascript:void(0);'><i class='fa fa-table'></i><span><?php echo $v['auth_name'];?></span> <span class="pull-right"><i class="fa fa-angle-down"></i></span></a>
									<ul>
							<?php
 foreach($v['list'] as $k1=>$v1){ if(in_array($v1['id'],$role)){ ?>
							<li><a href="<?php echo $v1['href']?>" <?php if($action_name==$v1['key']){echo "class='active'";}?> ><span><?php echo $v1['auth_name'];?></span></a></li>
							<?php
 }} ?>
							
						</ul>
					</li>
					<?php
 }} ?>
               
                <!-- <li class='has_sub'><a href='javascript:void(0);'><i class='fa fa-table'></i><span>用户管理</span> <span class="pull-right"><i class="fa fa-angle-down"></i></span></a>
                    <ul>
                        <li><a href="/index.php/Admin/User/index" <?php if($nav=='用户管理'){echo "class='active'";}?> ><span>用户列表</span></a></li>
                    </ul>
                </li>
                				<li class='has_sub'><a href='javascript:void(0);'><i class='fa fa-table'></i><span>名片管理</span> <span class="pull-right"><i class="fa fa-angle-down"></i></span></a>
                    <ul>
                						<li><a href="<?php echo U('card/userCardList');?>" <?php if($nav=='用户名片列表'){echo "class='active'";}?> ><span>用户名片列表</span></a></li>
                        <li><a href="<?php echo U('card/cardList');?>" <?php if($nav=='联系人名片列表'){echo "class='active'";}?> ><span>联系人名片列表</span></a></li>
                    </ul>
                </li> -->
             
                <div class="clearfix"></div>
        </div>
        <div class="clearfix"></div>
    </div>
    <div class="left-footer">
        <div class="progress progress-xs">
            <div class="progress-bar bg-green-1" role="progressbar" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100" style="width: 80%">
                <span class="progress-precentage">80%</span>
            </div>

            <a data-toggle="tooltip" title="See task progress" class="btn btn-default" data-modal="task-progress"><i class="fa fa-inbox"></i></a>
        </div>
    </div>
</div>



<!-- Left Sidebar End -->
        <!-- Left Sidebar End -->

        <!-- Start right content -->
        <div class="content-page">
			<ol class="breadcrumb">
				<li><a style="curor:pointer;"  href='<?php echo U('Index/index');?>'>首页</a></li>
				<li><a href="#"><?php echo parent_name($action_name);?></a></li>
				<li><a href="#"><?php echo category_name($action_name);?></a></li>
			</ol>
	        <div class="content">
				<!-- 列表start -->
				<form class="form-horizontal" id='formdata'  method='post'>
				<div class="widget" style='padding:20px 20px;'>
					<div class="widget-content padding">
						<div class="col-sm-12">
							<div class="form-group">
								<label class="col-sm-2 col-lg-1 control-label">名称：</label>
								<div class="col-sm-3">
									<input type="text" class="form-control" id="name" name='name' placeholder="小程序名称" value=''>
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-2 col-lg-1 control-label">LOGO：</label>
								<div class="col-sm-3">
									<img src="" width=300px height=200px style="display:none;" id='yulanlogo' />
									<input type="file" class="form-control uploadlogo" id="logoimg" name='logoimg' title='LOGO'>
									<input type='hidden' name='logo' id='logo'/>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 col-lg-1 control-label">二维码：</label>
								<div class="col-sm-3">
									<img src="" width=200px height=200px style="display:none;" id='yulanqrcode' />
									<input type="file" class="form-control uploadqrcode" id="qrcodeimg" name='qrcodeimg' title='二维码图片'>
									<input type='hidden' name='qrcode' id='qrcode'/>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 col-lg-1 control-label">截图：</label>
								<div class="col-sm-2">
									<img src="" width=200px height=200px style="display:none;" id='yulanfirstscreenshot' />
									<input type="file" class="form-control uploadimg" id='firstscreenshot' name='firstscreenshot' title='截图'>
									<input type='hidden' name='shotone' id='first'/>
								</div>
								<div class="col-sm-2">
									<img src="" width=200px height=200px style="display:none;" id='yulansecondscreenshot' />
									<input type="file" class="form-control uploadimg" id='secondscreenshot' name='secondscreenshot' title='截图'>
									<input type='hidden' name='shotwo' id='second'/>
								</div>
								<div class="col-sm-2">
									<img src="" width=200px height=200px style="display:none;" id='yulanthirdscreenshot' />
									<input type="file" class="form-control uploadimg" id='thirdscreenshot' name='thirdscreenshot' title='截图'>
									<input type='hidden' name='shothree' id='third'/>
								</div>
								<div class="col-sm-2">
									<img src="" width=200px height=200px style="display:none;" id='yulanfourthscreenshot' />
									<input type="file" class="form-control uploadimg" id='fourthscreenshot' name='fourthscreenshot' title='截图'>
									<input type='hidden' name='shotfour' id='fourth'/>
								</div>
								<div class="col-sm-2">
									<img src="" width=200px height=200px style="display:none;" id='yulanfivedscreenshot' />
									<input type="file" class="form-control uploadimg" id='fivedscreenshot' name='fivedscreenshot' title='截图'>
									<input type='hidden' name='shotfive' id='fived'/>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 col-lg-1 control-label">简介：</label>
								<div class="col-sm-10">
									<textarea class="form-control" id="introduct" name='introduce' placeholder="简介" value=''></textarea>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 col-lg-1 control-label">公司：</label>
								<div class="col-sm-3">
									<input type="text" class="form-control" id="company" name='company' placeholder="公司名称" value=''>
								</div>
							</div>
							<div class="form-group">
								<label class="col-xs-12 col-sm-2 col-lg-1 control-label">分类：</label>
								<div class="col-xs-12 col-sm-10">
								<?php if(is_array($categoryList)): $i = 0; $__LIST__ = $categoryList;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><div class="col-xs-12 col-sm-2" style='line-height:30px;'>
										<input type="checkbox" class="form-control" name='category[]' value='<?php echo ($vo["id"]); ?>'><?php echo ($vo["category"]); ?>
									</div><?php endforeach; endif; else: echo "" ;endif; ?>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 col-lg-1 control-label">标签：</label>
								<div class="col-sm-3">
									<input type="text" class="form-control" id='addlabel' value=''>
									<input type="hidden" class="form-control" id='label' name='label' value=''>
								</div>
								<div class="col-sm-1">
									<input class='form-control btn-green-2 btn-add-label' type="button" value='添加'>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 col-lg-1 control-label"></label>
								<div class="col-sm-3" id='showlabel'></div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 col-lg-1 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 -->

				<!-- Footer Start -->
<footer>
    <a href="https://www.zhuige.com" title="追格-微信小程序" target="_blank">追格-微信小程序</a> &copy; 2017
</footer>
<!-- Footer End -->		
			</div>
		</div>
	</div>
<script>
    var resizefunc = [];
</script>
<script src="/Public/assets/libs/jquery/jquery-1.11.1.min.js"></script>
<script src="/Public/assets/libs/jquery-detectmobile/detect.js"></script>
<script src="/Public/assets/libs/jquery-icheck/icheck.min.js"></script>
<script src="/Public/assets/libs/jquery-notifyjs/notify.min.js"></script>
<script src="/Public/assets/libs/jquery-notifyjs/styles/metro/notify-metro.js"></script>
<script src="/Public/assets/libs/jqueryui/jquery-ui-1.10.4.custom.min.js"></script>
<script src="/Public/assets/libs/jquery-ui-touch/jquery.ui.touch-punch.min.js"></script>
<script src="/Public/assets/libs/bootstrap/js/bootstrap.min.js"></script>
<!-- <script src="/Public/assets/libs/bootstrap-bootbox/bootbox.min.js"></script> -->
<script src="/Public/assets/libs/bootstrap-fileinput/bootstrap.file-input.js"></script>
<!-- <script src="/Public/assets/libs/magnific-popup/jquery.magnific-popup.min.js"></script> -->
<script src="/Public/assets/libs/fastclick/fastclick.js"></script>
<script src="/Public/assets/libs/pace/pace.min.js"></script>
<script src="/Public/assets/js/pages/notifications.js"></script>
<script src="/Public/assets/js/init.js"></script>
<script type="text/javascript">
	$(document).ready(function(){
		$("#btn-logout").click(function() {
			if(confirm('确定退出？')) {
				window.location.href = '/admin/index/logout';
			}
		});
	});
</script>
<script src="/Public/js/jquery.form.js"></script>
<script type="text/javascript">
<!--
	$(function(){
		$(".btn-add").click(function(){
			var name = $("#name").val();
			if(name==''){
				notify('error','top center','小程序名称不能为空');
				return false;
			}
			$("#formdata").ajaxSubmit({
                type:'post',
                url:'/Admin/Program/addProgram',
                success:function(e){
					if(e==1){
						notify('success','top center','添加成功');
					} setTimeout(function () {
                        location.href = "/Admin/Program/programList"
                    }, 1000);
    				
                }
            });
		})
		//上传logo
		$(".uploadlogo").change(function(){
			notify('success','top center','上传中...');
			$("#formdata").ajaxSubmit({
                type:'post',
                url:'/Admin/Program/uploadlogo',
                success:function(e){
                	if(e==-1){
                		notify('error','top center','LOGO上传失败');
                	}else{
                		$("#logo").val(e);
                		$("#yulanlogo").show();
                		$("#yulanlogo").attr('src',e);
                		notify('success','top center','上传成功');
                	}

                }
            });
			return false;
		})
		
		//上传二维码图片
		$(".uploadqrcode").change(function(){
			notify('success','top center','上传中...');
			$("#formdata").ajaxSubmit({
                type:'post',
                url:'/Admin/Program/uploadqrcode',
                success:function(e){
                	if(e==-1){
                		notify('error','top center','二维码图片上传失败');
                	}else{
                		$("#qrcode").val(e);
                		$("#yulanqrcode").show();
                		$("#yulanqrcode").attr('src',e);
                		notify('success','top center','上传成功');
                	}
				   				
                }
            });
			return false;
		})
		
		//上传截图
		$(".uploadimg").change(function(){
			notify('success','top center','上传中...');
			var id = $(this).attr('id');
			$("#formdata").ajaxSubmit({
                type:'post',
                url:'/Admin/Program/uploadScreenshot',
                data:{id:id},
                success:function(e){
                	if(e==-1){
                		notify('error','top center','截图上传失败');
                	}else{
                		if(id=='firstscreenshot'){
    						$("#first").val(e);
    					}else if(id=='secondscreenshot'){
    						$("#second").val(e);
    					}else if(id=='thirdscreenshot'){
    						$("#third").val(e);
    					}else if(id=='fourthscreenshot'){
    						$("#fourth").val(e);
    					}else if(id=='fivedscreenshot'){
    						$("#fived").val(e);
    					}
                		$("#yulan"+id).show();
                		$("#yulan"+id).attr('src',e);
                		notify('success','top center','上传成功');
                	}
                	
                }
            });
			return false;
		})
		
		//添加标签
		$(".btn-add-label").click(function(){
			var label = $("#addlabel").val();
			if(label==''){
				notify('error','top center','标签不能为空');
				return false;
			}
			$("#showlabel").append(label+"&nbsp;&nbsp;&nbsp;&nbsp;");
			var sublabel = $("#label").val();
			if(sublabel==''){
				$("#label").val(label);
			}else{
				$("#label").val(sublabel+","+label);
			}
		})
		
	})
	
//-->
</script>
</body>
</html>