<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>会员中心</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,minimum-scale=1,maximum-scale=1" />
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<link rel="stylesheet" type="text/css" href="__CSS__/main.css" />
<link rel="stylesheet" type="text/css" href="__CSS__/edit.css" />
<link href="__CSS__/common.css" rel="stylesheet"/>
</head>
<body class="bg02">
   <div  class="header"> 
      <div class="center">
          <div class="member"><span>贝云CMS</span>|<span class="fl38">会员中心</span></div>
	      <div class="fr">您好，<a class="fr20" href="{:url('member/index')}">{$UcenterMember.username|default=""}</a> |<a href="{:url('User/logout')}" class="fl20 fr20">退出</a>|<a  href="{:url('index/index')}" class="fl20">首页</a></div>
     </div>
   </div>
   <div  class="wrapper"> 
      <div class="lft">
        {include file="public/left" /} 
     </div>
      <div class="rgt">
        
	      			<div class="content">
			<div class="tips_msg none"><span class="tips">保存成功</span><span class="close_tips"></span></div>
				
				<div class="edit_box">
					<div class="edit_title">当前位置:{foreach $ids as $vo}  
			<a  class="cru_01" href="{:url('document/index?pid='.$vo)}">{$vo|get_category='title'}</a>>
		{/foreach}{$meta_title|default=""}</div>
					<div class="edit_tab">
						<div class="tab_option on">基础</div>
						<div class="tab_option">高级</div>
					</div>
					<div class="edit_content">
							 <form class="group-form"  action="{:url('')}" method="post">
 
                       {foreach name="list" item="v" key="k"}
                               <div class="edit_content_tab {if condition='$k eq 1'}none{/if}">
							  {volist name="v['data']" id="vo"}
							   {switch name="vo.type"}

							    {case value="num"}
                                 <div class="input_title">{$vo.title}<span>({$vo.remark|default=""})</span></div>
							<input type="text" name="{$vo.name}" class="input_box" value="{$info[$vo['name']]|default='1'}"/>
								{/case}

							    {case value="string"}
                                 <div class="input_title">{$vo.title}<span>({$vo.remark|default=""})</span></div>
							<input type="text" name="{$vo.name}" class="input_box" value="{$info[$vo['name']]|default=''}"/>
								{/case}
                            {case value="textarea"}
                                 <div class="input_title">{$vo.title}<span>({$vo.remark|default=""})</span></div>
						     	<textarea name="{$vo.name}"/>{$info[$vo['name']]|default=''}</textarea>
								{/case}
								{case value="editor"}
                                <div class="input_title">{$vo.title}<span>({$vo.remark|default=""})</span></div>
						  <textarea class="am-validate" id="content" name="{$vo.name}" required>{$info[$vo['name']]|default=''}</textarea>		
                                     <link rel="stylesheet" href="__COMMON__/kindeditor/default/default.css" />
			<script charset="utf-8" src="__COMMON__/kindeditor/kindeditor-min.js"></script>
			<script charset="utf-8" src="__COMMON__/kindeditor/zh_CN.js"></script>
			<script type="text/javascript">
				var editor_content;
				
				KindEditor.ready(function(K) {
					editor_content = K.create('textarea[name="content"]', {
						allowFileManager : false,
						themesPath: K.basePath,
						width: '90%',
						height: '300',
						resizeType:1,
						pasteType : 2,
						urlType : 'absolute',
						fileManagerJson : '{:url('fileManagerJson')}',
						uploadJson : '{:url("Uploads/ke_upimg")}'
					});
				});

				$(function(){
					$('textarea[name="{$vo.name}"]').closest('form').submit(function(){
						editor_content.sync();
					});
				})
			</script>
								{/case}

		               {case value="picture"}
                       <div class="upload_div">
							<div class="input_title">{$vo.title}<span>({$vo.remark})</span></div>
								<div class="upload_btn_group">
									<div class="upload_btn">上传图片</div>
									<input type="file" class="upload_file" id="{$vo.name}"/>
								</div>
								<div class="upload_imgs">
								<input type="hidden" name="{$vo.name}" value="{$info[$vo['name']]|default=''}"	>
									<span class="upload_imgs_wrap upload-pre-img-{$vo.name}">
									  {notempty name="vo.name"}
							              <div class="upload-pre-item"> <img src="{$info[$vo['name']]|get_cover_path}"/>
						                </div>
										{/notempty}
									
									</span>
									
								</div>
							</div>
														
								<script type="text/javascript">  
						 	var upload_url = "{:url('uploads/picture')}";	
  window.onload = function(){  
  
    // 选择图片  
    document.getElementById('{$vo.name}').onchange = function(event){  
        var img = event.target.files[0];  
        // 判断是否图片  
        if(!img){  
            return ;  
        }  
        // 判断图片格式  
        if(!(img.type.indexOf('image')==0 && img.type && /\.(?:jpg|png|gif)$/.test(img.name)) ){  
            alert('图片只能是jpg,gif,png');  
            return ;  
        }  
        var reader = new FileReader();  
        reader.readAsDataURL(img);  
  
        reader.onload = function(e){ // reader onload start  
            // ajax 上传图片  
            $.post(upload_url, { img: e.target.result},function(ret){  
                if(ret){  
                           	$("input[name='{$vo.name}']").val(data.id);
				        	$('.upload-pre-img-{$vo.name}').html(
				        		' <div class="upload-pre-item"><img src="' +data.path + '"/> </div>'
				        	);
                }else{  
                    alert('upload fail');  
                }  
            },'json');  
        } // reader onload end  
    }  
  
  }  
  </script>							
								{/case}
						 {case value="photo"}	
                           <div class="upload_div">
							<div class="input_title">{$vo.title}<span>({$vo.remark})</span></div>
								<div class="upload_btn_group">
									<div class="upload_btn">上传图片</div>
									<input type="file" class="upload_file" id="{$vo.name}"/>
								</div>
								<div class="upload_imgs">
								<input type="hidden" name="{$vo.name}"  value="{$info[$vo['name']]|default=''}"	>
									
								
									<span class="upload_imgs_wrap {$vo.name}">
									  {php}
						 if($info[$vo['name']]){
                                echo getimghtml($info[$vo['name']]);
                          }
                         else{
                             $list="";
                           }
                       {/php}
									
									</span>	
								</div>
							</div>
									
												<script type="text/javascript">  
						 	var upload_url = "{:url('uploads/picture')}";	

    // 选择图片  
    document.getElementById('{$vo.name}').onchange = function(event){  
        var img = event.target.files[0];  
        // 判断是否图片  
        if(!img){  
            return ;  
        }  
        // 判断图片格式  
        if(!(img.type.indexOf('image')==0 && img.type && /\.(?:jpg|png|gif)$/.test(img.name)) ){  
            alert('图片只能是jpg,gif,png');  
            return ;  
        }  
        var reader = new FileReader();  
        reader.readAsDataURL(img);  
  
        reader.onload = function(e){ // reader onload start  
            // ajax 上传图片  
            $.post(upload_url, { img: e.target.result},function(data){  
                if(data){  
                         var upload_img = "<div class='upload-pre-item'><img  class='item_{$vo.name}' src=" +data.src +" title='点击显示大图' data-id="+data.id+"> <span class='close' onclick='delPic(this);'></span></div>";
                            picsbox = $(".{$vo.name}");
							  picsbox.append(upload_img);
                             setVal();
                }else{  
                    alert('upload fail');  
                }  
            },'json');  
        } // reader onload end  
    }  
  
	  function delPic(obj){ //删除
            $(obj).parent("div").remove();
		    setVal();
	     }
	     function setVal(){ //取值
		    var option = $(".{$vo.name} img");
		    var result=new Array();
		    option.each(function(i){
		 	     result.push($(this).attr('data-id'));
		   });
          var ids= result.join(',');
           $("input[name='{$vo.name}']").val(ids);
	  }
					</script>					
								{/case}
						  {case value="select"}
                             <div class="input_title">{$vo.title}<span>({$vo.remark})</span></div>
						  
						  	 <select name="{$vo.name}" >
                               {volist name=":parse_attr($vo['extra'])" id="vo1"}
                                        <option value="{$key}">{$vo1}</option>
                                    {/volist}
                          </select>
						   <script type="text/javascript">
                                  $("select[name='{$vo.name}']").val("{$info[$vo['name']]|default='0'}");
                           </script>
								{/case}
						{case value="radio"}
                             <div class="input_title">{$vo.title}<span>({$vo.remark})</span></div>
                                    {volist name=":parse_attr($vo['extra'])" id="vo1"}
                                        <input type="radio" value="{$key}" {eq name="$info[$vo['name']]" value="$key"}checked{/eq}>{$vo1}</option>
                                    {/volist}
						  
								{/case}
			  			{case value="date"}
  				          <div class="input_title">{$vo.title}<span>({$vo.remark})</span></div>
							<input type="text" name="{$vo.name}" id="{$vo.name}" class="laydate-icon input_box" value="{notempty name='info.id'}{$info[$vo['name']]|time_format}{/notempty}"/>
				 		
								<script>
								laydate({
								  elem: '#{$vo.name}',
								  format: 'YYYY-MM-DD hh:mm:ss', 
								  min: laydate.now(), //设定最小日期为当前日期//目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
								  event: 'focus' //响应事件。如果没有传入event，则按照默认的click
								});
								</script>
								{/case}
							{/switch}

							{/volist}

								</div>
						{/foreach}  
						<div class="btn_group"> 
					      <input type="hidden" name="category_id" value="{$info.category_id|default=""}">
						    <input type="hidden" name="model_id" value="{$info.model_id|default=""}">
						    <input type="hidden" name="id" value="{$info.id|default=""}">
							<div class="confirm_btn">确认</div>
							<div class="cancel_btn">返回</div>
						</div>
						</form> 
					</div>
				</div>
			</div>
		</div>
	 <script type="text/javascript">
   
				$(".tab_option").click(function(){
					if(!$(this).hasClass("on")){
						var index = $(".tab_option").index($(this));
						$($(".edit_content_tab").get(index)).removeClass("none").siblings(".edit_content_tab").addClass("none");
						$(this).addClass("on").siblings().removeClass("on");
					}
					
				});
				
		</script>	
				





				</div>


      </div>
   </div>
 
</body>
<script src="__COMMON__/jquery.min.js"/>	</script>
<script type="text/javascript">
	function show(obj,num){
		   $(".tab span").removeClass("active");
    		$(obj).addClass("active");
            $(".info_div").hide();
            $(".info_div").eq(num-1).show();

    }
 $.post("demo_ajax_gethint.asp",{suggest:txt},function(result){
    $("span").html(result);
  });

$(".update").click(function(){
	var self = $("#member");
	 $.post(self.attr("action"),serialize(),function(data){
    	alert(data.msg);
    			
     });
 }); 
 $(".modify").click(function(){
	var self = $("#member2");
	 $.post(self.attr("action"),serialize(),function(data){
    	alert(data.msg);
    			
     });
 });  

</script>
	{include file="public/footer" /}
	
