<?php 
	$this->display(tpl('head',true)); 
?>
<style>
	.layui-form-select{
		width: 30%;
	}
</style>
<script src="/Public/global/js/colpick.js" type="text/javascript" charset="utf-8"></script>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  <legend>添加品牌</legend>
</fieldset>
<form class="layui-form" method="post" action="">
	<div class="layui-tab">
		<div class="layui-tab-content">
			<div class="layui-tab-item layui-show">
				<table class="layui-table my-tabel">
					<tbody>
						
						<tr>
							<td>品牌名称</td>
							<td>
								<input name="post[title]" value="<?php echo $edit[title] ?>"  lay-verify="required|title" placeholder="请输入品牌名称" class="layui-input my-input" type="text">
							</td>
						</tr>
						<tr>
							<td>品牌网址</td>
							<td>
								<input name="post[url]"  class="layui-input my-input" type="text" value="<?php echo $edit[url] ?>">
								<p>作为相关文章的索引,如多个用空格隔开</p>
							</td>
						</tr>

						<tr>
							<td>品牌Logo</td>
							<td>
								<input name="post[thumb]" id="thumb" class="layui-input  my-input" type="text" value="<?php echo $edit[thumb] ?>">
			    				<button type="button" class="layui-btn layui-btn-normal" id="select_pic">选择图片上传</button>
							</td>
						</tr>
						<tr>
							<td>品牌描述</td>
							<td>
									<textarea name="post[content]" placeholder="品牌描述" class="layui-textarea"><?php echo $edit[content] ?></textarea>
							</td>
						</tr>
						<tr>
							<td>排序值</td>
							<td>
								<input name="post[reorder]" class="layui-input  my-input" type="text" value="<?php echo $edit[reorder] ?>">
							</td>
						</tr>
						<tr>
							<td colspan="2" align="center">
								<input type="hidden" name="post[id]" value="<?php echo $edit[id] ?>" />
								<input type="hidden" name="step" value="post" />
								<button class="layui-btn" lay-submit="" lay-filter="post">立即提交</button>
							</td>
						</tr>
					</tbody>
				</table>
			</div>
		</div>
  	</div>
</div>
</form>
<script>
	layui.config({
		version: '<?php echo NOWTIME ?>'
	});
	layui.use(['upload','form','layer','element','laydate'], function(){
	  	var $ = layui.jquery
	  	,element = layui.element
	  	,upload = layui.upload;
	   	var $ = layui.jquery, layer = layui.layer;
		var form = layui.form;
		//选完文件后不自动上传
		upload.render({
		    elem: '#select_pic',
		    url: '/admin/upfile/up/thumb_1/json_true/',
		    auto: true,
		    bindAction: '#star_upload',
		    before: function(obj){
		    	files = obj.pushFile(); //将每次选择的文件追加到文件队列
		    	loading = layer.load();
		    },
		    done: function(res, index, upload){
		    	layer.close(loading);
			    if(res.Result==0){
			    	layer.msg(res.content);
			    }else{
			      	$('#thumb').val(res.url); 
			    }
			    delete files[index]; //删除对应的文件
		    }
		});
	});	  
</script>

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