<?php 
	$this->display(tpl('head',true)); 
	$setting=unserialize($data[setting]);
?>

<style>
	.layui-tab{
		padding-left: 20px;
	}
	.layui-field-box{
		color: red;
	}
	.layui-input,.layui-textarea{
		width: 30%;
		float: left;
	}
	.layui-form .layui-form-select .layui-input{
		width: 100%;
	}
	.layui-form .layui-form-select{
		width: 30%;
		float: left;
	}
	.layui-table p{
		width: 100%;
		float: left;
	}
</style>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  <legend>修改专题分类</legend>
</fieldset>
<form class="layui-form" method="post">
	<div class="layui-tab">
		<ul class="layui-tab-title">
			<li class="layui-this">基本设置</li>
			<li>模板设置</li>
		</ul>
		<div class="layui-tab-content">
			<div class="layui-tab-item layui-show">
				<table class="layui-table my-tabel">
					<tr>
						<td>专题分类名称</td>
						<td><input name="post[name]" id="name" placeholder="请输入专题分类名称" value="<?php echo $data[name] ?>" class="layui-input" ></td>
					</tr>
			
					<tr>
						<td>所属分类</td>
						<td>
							<select name="post[upsid]"  onchange="changeForm(this.value)" >
			    				<option value="">顶级分类</option>
								<?php echo $special_list ?>
			    			</select>
						</td>
					</tr>
					
					<tr>
						<td>SEO标题</td>
						<td><input name="post[seo_name]" placeholder="请输入SEO标题" value="<?php echo $data[seo_name] ?>" class="layui-input" ></td>
					</tr>
					
					<tr>
						<td>SEO关键字</td>
						<td><input name="post[seo_keywords]" placeholder="请输入SEO关键字" value="<?php echo $data[seo_keywords] ?>" class="layui-input" ></td>
					</tr>
					
					<tr>
						<td>SEO简介</td>
						<td>
							<textarea class="layui-textarea" name="post[seo_description]" placeholder="请输入SEO简介"><?php echo $data[seo_description] ?></textarea>
						</td>
					</tr>
					<tr>
						<td>伪静态目录</td>
						<td>
							<input name="post[dir_name]" id="dir_name" value="<?php echo $data[dir_name] ?>" class="layui-input" >
							<a href="javascript:void();" onclick="shengcheng()" style="float: left;height: 45px;line-height: 35px;padding-left: 10px;color: red;">一键生成</a>
						</td>
					</tr>
					<tr>
						<td colspan="2" class="my_button">
							<input type="hidden" name="sid" value="<?php echo $_GET[sid] ?>" />
							<input type="hidden" name="step" value="post" />
							<button class="layui-btn">立即提交</button>
						</td>
					</tr>
				</table>
			</div>
			<div class="layui-tab-item">
				<table class="layui-table  my-tabel">
		    		<tbody>
		    			<tr <?php echo $dis1 ?>>
		    				<td>专题列表模板</td>
		    				<td>
		    					<input name="setting[tpl][category]" value="<?php echo $setting[tpl][category] ?>" id="tplcategory" class="layui-input layui-input-my left" type="text">
				    			<select class="left" lay-filter="tplcategory" id="setting_content">
				    				<option value="">请选择一个模板</option>
				               		<option value="special/category">默认模板</option>
									<?php foreach($list_template AS $row){ ?>
										<option value="<?php echo $row[file] ?>"><?php echo $row[name] ?></option>
									<?php } ?>
				    			</select>
				    			<p></p>
		    				</td>
		    			</tr>
		    			<tr>
		    				<td>专题模板</td>
		    				<td>
		    					<input name="setting[tpl][list]" value="<?php echo $setting[tpl]['list'] ?>" id="tpllist" class="layui-input layui-input-my left" type="text">
				    			<select lay-filter="tpllist" class="left" id="setting_list">
				    				<option value="">请选择一个模板</option>
				               		<option value="special/content">默认模板</option>
				               		<?php foreach($content_template AS $row){ ?>
										<option value="<?php echo $row[file] ?>"><?php echo $row[name] ?></option>
									<?php } ?>
				    			</select>
				    			<p>如果专题页没有设置模板会以此模板为默认模板。如果都没设置，则以默认模板为准</p>
		    				</td>
		    			</tr>
			    	</tbody>
			    </table>
			</div>
		</div>
	</div>
	
</form>
<script>
	layui.config({
		version: '<?php echo NOWTIME ?>' //为了更新 js 缓存，可忽略
	});
	layui.use(['form','layer','element'], function(){
		var form = layui.form;
		form.on('select(tplcategory)', function(data){
			$('#tplcategory').val(data.value);
		});
		form.on('select(tpllist)', function(data){
		  $('#tpllist').val(data.value);
		});
	});
	function shengcheng(){
		var name=$("#name").val();
		$.ajax({
			url:"/admin/pinyin/pinyin/name_"+name,
		    type: 'get',
		    dataType: 'json',
		    success: function(data){
		       $("#dir_name").val(data.pinyin);
		    }
		})
	}	  
</script>

<?php $this->display(tpl('foot',true)); ?>   
