<?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><?php echo $data[name]?>设置</legend>
</fieldset>
<div class="layui-item">
	<a href="<?php echo admin_plugin_url ?>index/vendor/dir_yunpian/c_index/m_add" class="layui-btn layui-btn-primary">添加模板</a>
</div>
<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>APIKEY</td>
							<td>
								<input name="setting[apikey]" value="<?php echo $setting['apikey'] ?>" class="layui-input my-input" type="text">
							</td>
						</tr>

						<?php foreach($code AS $key=>$value){?>
							<tr>
								<td><?php echo $value ?>模板ID</td>
								<td>
									<input name="setting[code][<?php echo $key ?>]" value="<?php echo $setting[code][$key] ?>" class="layui-input my-input" type="number">
								</td>
							</tr>
						<?php } ?>
						<tr>
							<td colspan="2" align="center">
								<input type="hidden" name="id" value="<?php echo $_GET[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)); ?>
