<?php /*a:5:{s:61:"D:\phpstudy_pro\WWW\2022_09_zscq\view\admin\article\cate.html";i:1663056340;s:59:"D:\phpstudy_pro\WWW\2022_09_zscq\view\admin\common\top.html";i:1625466448;s:63:"D:\phpstudy_pro\WWW\2022_09_zscq\view\admin\common\ueditor.html";i:1646121304;s:61:"D:\phpstudy_pro\WWW\2022_09_zscq\view\admin\common\field.html";i:1641638552;s:62:"D:\phpstudy_pro\WWW\2022_09_zscq\view\admin\common\bottom.html";i:1629163316;}*/ ?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title><?php echo config('common.CMS_NAME'); ?></title>
<link rel="stylesheet" href="/static/tqcms/css/common.css">
<link rel="stylesheet" href="/static/tqcms/layui/css/layui.css"><!--layui css-->
<link rel="stylesheet" href="/static/tqcms/css/skin.css">
<script src="/static/tqcms/js/jquery.js"></script>
</head>
<body>
<script type="text/javascript" charset="utf-8" src="/static/tqcms/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/tqcms/ueditor/ueditor.all.js"> </script>
<script type="text/javascript" charset="utf-8" src="/static/tqcms/ueditor/lang/zh-cn/zh-cn.js"></script>


<div class="body_top">
	<ul class="title">
		
        <?php if($info['model_id']!=1): ?>
    	<li><a href="<?php echo url('article',array('id'=>$info['id'],'model_id'=>$info['model_id'])); ?>"><?php echo tq_value($info['model_id'],'name','cate_type'); ?>管理</a></li>
		<?php endif; ?>
    	<li class="active"><a href="<?php echo url('cate',array('id'=>$info['id'])); ?>">栏目内容</a></li>
    	<li><a href="<?php echo url('cate_edit',array('id'=>$info['id'])); ?>">栏目设置</a></li>
    </ul>
</div>

<div class="common_content">
<form action="<?php echo url('cate_update'); ?>" class="layui-form" name="TQform" id="TQform" method="post" onsubmit="return TQsubmit();">
<input name="id" type="hidden" value="<?php echo htmlentities($info['id']); ?>" />
<input name="cate_id" type="hidden" value="<?php echo htmlentities($info['id']); ?>" />
<table width="100%" border="0" class="common_table">
    <tr>
        <td class="name">栏目名称</td>
        <td class="td_input"><input type="text" name="catename" value="<?php echo htmlentities($info['catename']); ?>" placeholder="" autocomplete="off" class="layui-input"></td>
    </tr>
    <?php 
    if(TQ('IS_SYSTEM')==1){
        var_dump($info['id']);
    }
    
    $F=xiabiao(F($info['id']));
    //dump($F);
     ?>
	<!-- 题库 栏目无栏目图 栏目图只对应杂项广告位 -->
    <style>
	.tr_catename_e { display:none}
	.tr_banner { display:none}
	.tr_lmt { display:none}
	.tr_icon { display:none}
    </style>
    
	<?php if(($info['id']==2) or (($F[0]==4) and ($F[1]!='') and ($F[2]==''))): ?>
    <style>
    .tr_catename_e { display:table-row}
    </style>
    <?php endif; if(($info['id']==1) or ($info['id']==2) or ($info['id']==5) or ($info['id']==6) or ($info['id']==7) or ($info['id']==40)): ?>
    <style>
    .tr_banner { display:table-row}
    </style>
    <?php endif; if(($info['id']==3) or (($F[0]==3) and ($F[1]!='') and ($F[2]==''))): ?>
    <style>
    .tr_lmt { display:table-row}
    </style>
    <?php endif; if(($F[0]==1) or ($info['id']==2) or (($F[0]==3) and ($F[1]!='') and ($F[2]=='')) or (($F[0]==4) and ($F[1]!='') and ($F[2]=='')) or (($F[1]==19) and ($F[2]!='') and ($F[3]=='')) or ($info['id']==5) or ($info['id']==6) or ($info['id']==7)): ?>
    <style>
	.tr_icon { display:table-row}
    </style>
	<?php endif; 
    //$lm=\app\admin\model\Cate::where('pid',$F[2])->field('id,model_id')->select()->toArray();
     if(is_array($field_list_array) || $field_list_array instanceof \think\Collection || $field_list_array instanceof \think\Paginator): $i = 0; $__LIST__ = $field_list_array;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;if($v['field_mk']=='文本框'): ?>
<!--文本框-->
<tr class="tr_<?php echo htmlentities($v['field_name']); ?>">
    <td class="name"><?php echo htmlentities($v['field_cn_name']); ?></td>
    <td class="td_input"><input name="<?php echo htmlentities($v['field_name']); ?>" value="<?php echo htmlentities($info[$v['field_name']]); ?>" autocomplete="off" type="text" class="layui-input" /></td>
</tr>
<?php endif; if($v['field_mk']=='多行文本框'): ?>
<!--多行文本框-->
<tr class="tr_<?php echo htmlentities($v['field_name']); ?>">
    <td class="name"><?php echo htmlentities($v['field_cn_name']); ?></td>
    <td class="td_textarea"><textarea name="<?php echo htmlentities($v['field_name']); ?>" cols="" rows="" class="layui-textarea"><?php echo htmlentities($info[$v['field_name']]); ?></textarea></td>
</tr>
<?php endif; if($v['field_mk']=='在线编辑器'): ?>
<!--在线编辑器-->
<tr class="tr_<?php echo htmlentities($v['field_name']); ?>">
    <td class="name"><?php echo htmlentities($v['field_cn_name']); ?></td>
    <td class="td_ueditor">
		<script  id="<?php echo $v['field_name'] ?>" type="text/plain" style="width:100%; height:250px;" name="<?php echo $v['field_name'] ?>" ><?php echo $info[$v['field_name']]; ?></script>
		<script type="text/javascript">
			var ue_<?php echo $v['field_name'] ?> = UE.getEditor("<?php echo $v['field_name'] ?>");
		</script></td>
</tr>
<?php endif; if($v['field_mk']=='上传图片'): ?>
<!--上传图片-->
<tr class="tr_<?php echo htmlentities($v['field_name']); ?>">
    <td class="name"><?php echo htmlentities($v['field_cn_name']); ?></td>
    <td class="td_input">
    	
		<input type="text" name="<?php echo $v['field_name'] ?>" id="upimg_<?php echo $v['field_name'] ?>" value="<?php echo $info[$v['field_name']]; ?>" class="layui-input" /> 
		<input type="file" id="for_<?php echo $v['field_name'] ?>" name="" onchange="upload_<?php echo $v['field_name'] ?>(this)" style="display:none">
		<label for="for_<?php echo $v['field_name'] ?>" class="for_label"><p class="layui-btn layui-btn-normal layui-btn-sm"><i class="layui-icon">&#xe67c;</i>上传图片</p></label>
		
		<script>
		function upload_<?php echo $v['field_name'] ?>(obj){
			if(obj.value==""){return;}
			var formdata = new FormData();
			formdata.append("file" , $(obj)[0].files[0]);
			$.ajax({
				type :"post",
				url : "<?php echo url("index/Upload/upload"); ?>",
				data : formdata,
				cache : true,
				processData : false,
				contentType : false,
				success : function(date){
					if(date.type==1){
						layer.msg(date.info, {icon:1,time:1500});
						$("#upimg_<?php echo $v['field_name'] ?>").val(date.file);
						$(".yulan_<?php echo $v['field_name'] ?>").show().attr("data-file",date.file);
					}else{
						layer.msg(date.info, {icon:2,time:1500});
					}
				},
				error : function(){ }
			});
		}			
		</script>
    	<a data-file="<?php echo htmlentities($info[$v['field_name']]); ?>" class="tq_img_look yulan_<?php echo htmlentities($v['field_name']); ?> layui-btn layui-btn-normal layui-btn-sm" style="display:<?php if($info[$v['field_name']]==''): ?>none<?php endif; ?>">预览</a>
    </td>
</tr>
<?php endif; if($v['field_mk']=='上传文件'): ?>
<!--上传文件-->
<tr class="tr_<?php echo htmlentities($v['field_name']); ?>">
    <td class="name"><?php echo htmlentities($v['field_cn_name']); ?></td>
    <td class="td_input">
    	
		<input type="text" name="<?php echo $v['field_name'] ?>" id="upimg_<?php echo $v['field_name'] ?>" value="<?php echo $info[$v['field_name']]; ?>" class="layui-input" /> 
		<input type="file" id="for_<?php echo $v['field_name'] ?>" name="" onchange="upload_<?php echo $v['field_name'] ?>(this)" style="display:none">
		<label for="for_<?php echo $v['field_name'] ?>" class="for_label"><p class="layui-btn layui-btn-normal layui-btn-sm"><i class="layui-icon">&#xe67c;</i>上传文件</p></label>
		
		<script>
		function upload_<?php echo $v['field_name'] ?>(obj){
			if(obj.value==""){return;}
			var formdata = new FormData();
			formdata.append("file" , $(obj)[0].files[0]);
			$.ajax({
				type :"post",
				url : "<?php echo url("index/Upload/upload_file"); ?>",
				data : formdata,
				cache : true,
				processData : false,
				contentType : false,
				success : function(date){
					if(date.type==1){
						layer.msg(date.info, {icon:1,time:1500});
						$("#upimg_<?php echo $v['field_name'] ?>").val(date.file);
						$(".yulan_<?php echo $v['field_name'] ?>").show().attr("data-file",date.file);
					}else{
						layer.msg(date.info, {icon:2,time:1500});
					}
				},
				error : function(){ }
			});
		}			
		</script>
    </td>
</tr>
<?php endif; if($v['field_mk']=='组合字段'): ?>
<!--组合字段-->
<tr class="tr_<?php echo htmlentities($v['field_name']); ?>">
    <td class="name"><?php echo htmlentities($v['field_cn_name']); ?></td>
    <td class="td_input"><?php if(empty($_GET['id'])): ?><span style="color:#f00">本处需要在数据添加完成后在编辑页面进行操作</span><?php else: ?><a href="javascript:cate_frame('<?php echo url('/admin/Article/field',array('pid'=>$v['field_name']."_".$info['id']."",'catename'=>$info['catename'].$v['field_cn_name'])); ?>');" class="layui-btn layui-btn-sm">查看管理</a><?php endif; ?></td>
</tr>
<?php endif; if($v['field_mk']=='系统字典'): ?>
<!--组合字段-->
<tr class="tr_<?php echo htmlentities($v['field_name']); ?>">
    <td class="name"><?php echo htmlentities($v['field_cn_name']); ?></td>
    <td class="field_td_select">
    	<select name="<?php echo htmlentities($v['field_name']); ?>" lay-ignore class="select_ys">
            <option value="">请选择</option>
            <?php $_result=Label($v['field_name'],0);if(is_array($_result) || $_result instanceof \think\Collection || $_result instanceof \think\Paginator): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$c): $mod = ($i % 2 );++$i;?>
            <option value="<?php echo htmlentities($c['id']); ?>" <?php if($info[$v['field_name']]==$c['id']): ?>selected<?php endif; ?>><?php echo htmlentities($c['name']); ?></option>
            <?php endforeach; endif; else: echo "" ;endif; ?>
         </select>
    </td>
</tr>
<?php endif; if($v['field_mk']=='城市联动'): ?>
<!--系统字典-->
<tr class="tr_<?php echo htmlentities($v['field_name']); ?>">
    <td class="name"><?php echo htmlentities($v['field_cn_name']); ?></td>
    <td class="field_td_select">
    	
        <?php 
        if(empty($info['city'])){
            $field_city='';
            $pid='';
        }else{
            $field_city=$info['city'];
            $pid=tq_value($field_city,'pid','label');
        }
         ?>
    	省份：<select name="" id="address_sf" lay-ignore class="select_ys" onchange="ceshi(this.value);">
    	  		<option value="">请选择</option>
    	  		<?php $_result=Label('city',0);if(is_array($_result) || $_result instanceof \think\Collection || $_result instanceof \think\Paginator): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$c): $mod = ($i % 2 );++$i;?>
                <option value="<?php echo htmlentities($c['id']); ?>" <?php if($pid==$c['id']): ?>selected<?php endif; ?>><?php echo htmlentities($c['name']); ?></option>
                <?php endforeach; endif; else: echo "" ;endif; ?>
    		 </select>
        城市：
        	<select name="<?php echo htmlentities($v['field_name']); ?>" id="shict" class="select_ys" lay-ignore>
    	  		<option value="">请选择</option>
    		</select>
            </span>
    </td>
</tr>
<script>
$(document).ready(function(){
	var pid="<?php echo htmlentities($pid); ?>";
	if(pid!=''){ ceshi(pid); }
});

function ceshi(pid){
	$.post('/index/Ajax/label',{field:'city',pid:pid},function(data){
		html='';
		var s=data.list.length;
		html+="<option value=\"\">请选择</option>";
		if(pid!=''){
			for(i=0;i<s;i++){
				if(data.list[i].id=="<?php echo htmlentities($field_city); ?>"){
				html+="<option value=\""+data.list[i].id+"\" selected>"+data.list[i].name+"</option>";
				}else{
				html+="<option value=\""+data.list[i].id+"\">"+data.list[i].name+"</option>";
				}
			}
		}
		$('#shict').html(html);
    });
	return false;
}
</script>
<?php endif; ?>

<?php endforeach; endif; else: echo "" ;endif; ?>
    
</table>
</form>

</div>

<div class="common_foot"><input name="" type="submit" onclick="TQsubmit();" class="layui-btn" /></div>
<script src="/static/tqcms/layui/layui.js"></script><!--layui js-->
<script src="/static/tqcms/layui/laytq.js"></script><!--layui js-->
<script src="/static/tqcms/js/common.js"></script>
<script src="/static/tqcms/js/md5.js"></script>
<script src="/static/tqcms/js/url.js"></script>
</body>
</html>
<iframe src="" id="zh_iframe_box" name="article_field_iframe" style="width:100%; height:100%; position:fixed; background:#fff; z-index:999; display:none" frameborder="0"></iframe>
<script>
function TQsubmit(){
	//TQform.submit();
	$.post('cate_update',$("#TQform").serialize(),function(data){
		console.log(data);
		if(data.type==2){
			layer.msg(data['msg'], {icon:2,time:1000});
		}else{
			layer.msg(data['msg'], {icon:1,time:1000});
			//setTimeout(function(){ window.location.reload(); },1500);
		}
    });
	return false;
}


function cate_frame(url){
	$('#zh_iframe_box').show().attr('src',url);
}
function cate_frame_close(){
	$('#zh_iframe_box').hide();
}

//传入四级field各页刷新页面 来自:index.html 继续或关闭,
function article_field_reload4(iname,url){
	if(url==''){
		window.frames['article_field_iframe'].location.reload();
	}else{
		$('#zh_iframe_box').attr('src',url);
	}
}

//来自index.html
function delete_id_field4(iname,info){
	window.frames['article_field_iframe'].delete_id(info);
}
//来自index.html
function delete_ids_field4(iname,info){
	window.frames['article_field_iframe'].delete_ids(info);
}
</script>