<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
  	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  	<title>会员中心</title>
  	<link rel="stylesheet" href="<?php echo WEBURL ?>/public/global/layui/css/layui.css">
  	<link rel="stylesheet" type="text/css" href="<?php echo WEBURL ?>/public/user/style.css"/>
  	<script type="text/javascript" src="<?php echo WEBURL ?>/public/global/jquery/1.11.1/jquery.min.js" ></script>
  	<script type="text/javascript" src="<?php echo WEBURL ?>/public/global/layui/layui.js"></script>
</head>
	<body>
	<style>
		.header{
			background: #009688;
			float: left;
			width: 100%;
		}
		.header .layui-nav-child{
			z-index: 9999;
		}
		.left{
			float: left;
		}
		.right{
			float: right;
		}
	</style>
		<div class='header'>
		<div class="left">
			<div class="layui-nav layui-bg-green ">
				<ul>
					<li class="layui-nav-item" >
						<a href="{{WEBURL}}"  target="_blank">网站首页</a>
					</li>
					<foreach array='HOME_MENU'>
					<li class="layui-nav-item" >
						<a href="{{$row.link}}"  target="{{$row.target}}">{{$row.name}}</a>
						<if condition="$row['list']">
							<dl class="layui-nav-child">
							<foreach array="row['list']" value="_row">
								<dd>
									<a href="{{$_row['link']}}" style="color: {{$_row.color}};" target="{{$_row.target}}">{{$_row['name']}}</a>
								</dd>
							</foreach>
							</dl>
						</if>
					</li>
					</foreach>
				</ul>
			</div>
		</div>
		<div class="right">
			<div class="layui-nav layui-bg-green ">
				<ul>
					<li class="layui-nav-item">
						<a href="">控制台<span class="layui-badge">{{$smsnum}}</span></a>
					</li>
					
					<li class="layui-nav-item" lay-unselect="">
						<?php 
							if(C('MYDB.thumb')){
								$thumb=get_img_url(C('MYDB.thumb'));
							}else{
								$thumb="/public/global/images/face.jpg";
							}
						?>
						<a href="javascript:;"><img src="{{$thumb}}" class="layui-nav-img">{{C('MYDB.username')}}</a>
						<dl class="layui-nav-child">
							<dd>
								<a href="/login/index/login_out">退出</a>
							</dd>
						</dl>
					</li>
				</ul>
			</div>
		</div>
	</div>
		<div class="layui-side layui-bg-black">
			<div class="layui-side-scroll">
				<!-- 左侧导航区域（可配合layui已有的垂直导航） -->
				<ul class="layui-nav layui-nav-tree layui-bg-green">
					<li class="layui-nav-item layui-nav-itemed">
						<a class="" href="javascript:;">基本功能</a>
						<dl class="layui-nav-child">
							<dd><a href="javascript:void('0')" class=" site-active" data-url="/user/Myprofile/edit_my_profile" data-id="edit_my_profile">我的资料</a></dd>
							<dd><a href="javascript:void('0')" class=" site-active" data-url="/user/sms/index" data-id="my_sms">我的站内信息</a></dd>
							<dd><a href="javascript:void('0')" class=" site-active" data-url="/user/jifen/index" data-id="my_jifen">我的积分日志</a></dd>
							<dd><a href="javascript:void('0')" class=" site-active" data-url="/user/renzheng/index" data-id="my_renzheng">身份认证</a></dd>
						</dl>
					</li>
					<li class="layui-nav-item layui-nav-itemed">
						<a class="" href="javascript:;">信息管理</a>
						<dl class="layui-nav-child">
							<dd><a href="javascript:void('0')" class=" site-active" data-url="/user/articles/index" data-id="/user/articles/alllist">我发布的文章</a></dd>
							<dd><a href="javascript:void('0')" class=" site-active" data-url="/user/articles/add" data-id="/user/articles/add">添加文章</a></dd>
							<dd><a href="javascript:void('0')" class=" site-active" data-url="/user/comment/index" data-id="/user/comment/alllist">我的评论</a></dd>
						</dl>
					</li>
				
				<?php foreach($Modular_DB AS $key=>$RS) { ?>
				
					<li class="layui-nav-item  layui-nav-itemed">
						<a href="javascript:;"><?php ECHO $RS[name] ?></a>
						<dl class="layui-nav-child">
						<?php foreach($RS['rute'] AS $_key=>$RSS) { ?>
							<?php foreach($RSS AS $__key=>$name) { ?>
							<dd><a href="javascript:void('0')" class=" site-active" data-url="<?php echo '/user/index/modular/'.$RS[dir].'/'.$_key.'/'.$__key ?>" data-id="<?PHP echo $RS[dir].'_'.$_key.'_'.$__key ?>"><?PHP echo $name ?></a></dd>
							<?php } ?>
						<?php } ?>
						</dl>
					</li>
				
				<?php } ?>
				<?php foreach($pluginDB AS $key=>$RS) { ?>
				
					<li class="layui-nav-item  layui-nav-itemed">
						<a href="javascript:;"><?php ECHO $RS[name] ?></a>
						<dl class="layui-nav-child">
						<?php foreach($RS['rute'] AS $_key=>$RSS) { ?>
							<?php foreach($RSS AS $__key=>$name) { ?>
							<dd><a href="javascript:void('0')" class=" site-active" data-url="<?php echo '/user/index/plugin/'.$RS[dir].'/'.$_key.'/'.$__key ?>" data-id="<?PHP echo $RS[dir].'_'.$_key.'_'.$__key ?>"><?PHP echo $name ?></a></dd>
							<?php } ?>
						<?php } ?>
						</dl>
					</li>
				<?php } ?>
				</ul>	
			</div>
		</div>
		<?php if($_GET[to]){ 
			$def="";
			$def1="";
		}else{
			$def="layui-this";
			$def1="layui-show";
		}?>
		<div class="layui-body">
			<div class="layui-tab layui-side" lay-filter="Menu" lay-allowclose="true">
				<ul class="layui-tab-title">
				    <li class="{{$def}}" lay-id="setting_map" id="setting_map">控制面板</li>
				    <?php if($_GET[to]){ ?>
				    	<li class="layui-this" lay-id="to" id="<?php echo nowtime ?>"><?php echo $_GET[name] ?></li>
				    <?php } ?>
				</ul>
				<div class="layui-tab-content">
				    <div class="layui-tab-item {{$def1}}"><iframe src="{{$maps}}"></iframe></div>
				     <?php if($_GET[to]){ ?>
				    	<div class="layui-tab-item layui-show"><iframe src="<?php echo urldecode($_GET[to]) ?>"></iframe></div>
				    <?php } ?>
				</div>
			</div>
			
			
		    <!-- 内容主体区域 -->
		    
		</div>
		<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
	layui.use(['element'], function(){
		var $ = layui.jquery
		,element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块
		var active = {
		    tabAdd: function(){
		    	var a=$(".layui-tab-title").children('li')
		    	for(i=0;i< a.length ;i++){
		    		if($(this).data('id')===a[i].getAttribute("lay-id")){
		    			document.getElementById('iframe_'+$(this).data('id')).src=$(this).data('url');
		    			element.tabChange('Menu', $(this).data('id')); //切换到：用户管理
		    			return false;
		    		}
		    	}
		      	//新增一个Tab项
			    element.tabAdd('Menu', {
			        title: this.innerHTML
			        ,content: '<iframe id="iframe_'+$(this).data('id')+'" src="'+$(this).data('url')+'"></iframe>'
			        ,id: $(this).data('id') //实际使用一般是规定好的id，这里以时间戳模拟下
			    })
		       	element.tabChange('Menu', $(this).data('id')); //切换到：用户管理
		       	//iframe自适应
			    $(window).on('resize', function () {
			        var content = $('.layui-side .layui-tab-content');
			        content.height($(this).height() - 140);
			        content.find('iframe').each(function () {
			            $(this).height(content.height());
			            //console.log(content.height());
			        });
			    }).resize();
		    }
		};
		$('.site-active').on('click', function(){
		    var othis = $(this);
		    active['tabAdd'] ? active['tabAdd'].call(this, othis) : '';
		});
		$('#setting_map i').hide();
		show_tab();
		function show_tab(){
			var content = $('.layui-side .layui-tab-content');
			content.height($(this).height() - 140);
			content.find('iframe').each(function () {
				$(this).height(content.height());
			});
		}
	});
	
</script>
	</body>
</html>
