<?php /*a:1:{s:71:"/www/wwwroot/666.u7u.top/application/ohbbs/view/content/scode_edit.html";i:1554131770;}*/ ?>

<!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,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	<link rel="stylesheet" href="/public/static/layui/css/layui.css" media="all">
	<link rel="stylesheet" href="/public/static/css/admin.css" media="all">
</head>
<body>
	<form class="layui-form column-content-detail">
		<div class="layui-tab-item layui-show">
					<?php foreach($columndata as $k=>$vo): ?>
					<div class="layui-form-item">
						<label class="layui-form-label"><?php echo htmlentities($vo['name']); ?>：</label>
						<div class="layui-input-inline">
							<select class="form-control" name="catid[]">
								<?php if(is_array(assortmentInfo($vo['id'])) || assortmentInfo($vo['id']) instanceof \think\Collection || assortmentInfo($vo['id']) instanceof \think\Paginator): $i = 0; $__LIST__ = assortmentInfo($vo['id']);if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
								<option value="<?php echo htmlentities($v['id']); ?>" <?php if($v['id'] == $vo['assid']): ?>selected<?php endif; ?>><?php echo htmlentities($v['name']); ?></option>
								<?php endforeach; endif; else: echo "" ;endif; ?>
							</select>
						</div>
					</div>
					<?php endforeach; ?>
					<div class="layui-form-item form-group">
						<label class="layui-form-label control-label"><font color="red">*</font>标题：</label>
						<div class="layui-input-block">
							<input class="form-control layui-input" type="text" name="title" value="<?php echo htmlentities($data['title']); ?>" style="width:90%;" required="required">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label"><font color="red">*</font>标签云：</label>
						<div class="layui-input-inline">
							<select class="form-control" name="tagid" required="required">
								<?php foreach($taginfo as $k=>$vo): ?>
								<option value="<?php echo htmlentities($vo['id']); ?>" <?php if($data['tagid'] == $vo['id']): ?>selected<?php endif; ?>><?php echo htmlentities($vo['name']); ?></option>
								<?php endforeach; ?>
							</select>
						</div>
					</div>
					<div class="layui-form-item form-group">
						<label class="layui-form-label control-label"><font color="red">*</font>源码标签：</label>
						<div class="layui-input-block">
							<input class="form-control layui-input" type="text" name="tag" value="<?php echo htmlentities($data['tag']); ?>" style="width:90%;" required="required">
						</div>
					</div>
					<div class="layui-form-item form-group">
						<label class="layui-form-label control-label">演示地址：</label>
						<div class="layui-input-block">
							<input class="form-control layui-input" type="text" name="demo" value="<?php echo htmlentities($data['demo']); ?>" style="width:400px;">
						</div>
					</div>
					<div class="layui-form-item form-group">
						<label class="layui-form-label control-label"><font color="red">*</font>上传源码：</label>
						<div class="layui-input-block">
							<div class="row" style="margin:0">
								<input type="hidden" value="" name="file">
								<style>
									div.uploader {
										height:30px !important;
										line-height:30px;
										width:60px !important;
										background-image: none !important;
										cursor: pointer;
										padding:0px 5px 0 5px;
									}
									.my_list .badge {margin-top: 5px;}
									.my_list {
										margin-top: 0px;padding: 0 20px 0 10px;
									}
									.my_upload {
										width:66px!important;
										margin-top: 0px;padding-left:0px
									}
									.uploader input {
										position: absolute;
										top: 0;
										right: 0;
										margin: 0;
										border: solid transparent;
										border-width: 0 0 100px 200px;
										opacity: .0;
										filter: alpha(opacity= 0);
										-o-transform: translate(250px,-50px) scale(1);
										direction: ltr;
										cursor: pointer;
									}
								</style>
								<div id="btn" class="col-md-3 btn btn-sm blue uploader layui-left layui-btn layui-btn-sm" style="margin-right:15px;width: 110px !important;">
									<i class="fa fa-cloud-upload layui-icon"></i> TXT文本上传
								</div>
								<input type="hidden" name="url" value="<?php echo htmlentities($data['url']); ?>" id="url">
							</div>
							<span class="help-block layui-form-mid layui-word-aux">请把网盘下载地址放入txt文本进行上传，如果觉得麻烦可直接复制链接到下方网盘</span>
						</div>
					</div>
					<div class="layui-form-item form-group">
						<label class="layui-form-label control-label">售价：</label>
						<div class="layui-input-block">
							<div class="layui-input-inline">
								<input type="text" class="form-control layui-input" style="width:100%;" name="price" value="<?php echo htmlentities($data['price']); ?>">
							</div>
							<span class="help-block layui-form-mid layui-word-aux">不填写或者0为免费</span>
						</div>
					</div>
					<div class="layui-form-item form-group">
						<label class="layui-form-label control-label">售价类型：</label>
						<div class="layui-input-block">
					  		<input type="radio" name="type" value="1" title="积分" <?php if($data['type'] == 1): ?>checked<?php endif; ?>>
					  		<input type="radio" name="type" value="2" title="金额" <?php if($data['type'] == 0): ?>checked<?php endif; ?>>
						</div>
					</div>
					<div class="layui-form-item form-group">
						<label class="layui-form-label control-label"><font color="red">*</font>封面主图：</label>
						<div class="layui-input-block">
							<div class="row" style="margin:0">
								<input type="hidden" value="<?php echo htmlentities($data['thumb']); ?>" name="thumb" id="fileid_thumb">
								<div class="col-md-3 btn btn-sm blue uploader layui-left layui-btn layui-btn-sm" style="margin-right:15px" id="img">
									<i class="fa fa-cloud-upload layui-icon"></i> 上传
								</div>
							</div>
							<span class="help-block layui-form-mid layui-word-aux">好的封面主图，可以获得更多关注</span>
						</div>
					</div>
					<div class="layui-form-item form-group" style="">
						<label class="layui-form-label control-label"><font color="red">*</font>详细描述：</label>
						<div class="layui-input-block">
							<textarea id="content" name="content" style="display: none;"><?php echo htmlentities($data['content']); ?></textarea>
						</div>
					</div>
					<div class="layui-form-item layui-input-block">
						<input type="hidden" name="id" value="<?php echo htmlentities($data['id']); ?>">
						<input type="hidden" name="mid" value="<?php echo htmlentities($data['mid']); ?>">
						<input type="hidden" name="uid" value="<?php echo htmlentities($data['uid']); ?>">
						<input type="hidden" name="user" value="<?php echo htmlentities($data['user']); ?>">
						<button type="submit" class="layui-btn" lay-submit lay-filter="addform"><i class="layui-icon"></i>立即发布</button>
					</div>
		</div>
	</form>
<script src="/public/static/layui/layui.js"></script>
<script src="/public/static/js/common.js" type="text/javascript" charset="utf-8"></script>
<script>
layui.use(['layedit','form'], function(){
  	var layedit = layui.layedit;
  	var form = layui.form;
  	var $ = layui.jquery;
	layedit.set({
	    uploadImage: {
	        url: "<?php echo url('api/scode/lay_img_upload'); ?>",
	        type: 'post',
	    }
	});
  	var index = layedit.build('content');
	form.on('submit(addform)', function(data){
  		var content = layedit.getContent(index);
  		data.field.content = content;
		$.post("<?php echo url(''); ?>",data.field,function(data){
		  if(data.code == 1){
		    layer.msg(data.msg, {time: 2000}, function(){
		      window.history.go(-1);
		    });
		  }else{
		    layer.msg(data.msg, {time: 2000});
		  }
		});
		return false;
	});
});
</script>
<script>
layui.use(['upload','jquery'], function(){
	var $ = layui.jquery;
	var upload = layui.upload;
  	var uploadInst = upload.render({
    elem: '#btn'
    ,url: "<?php echo url('api/scode/uptxt'); ?>"
    ,exts: 'txt'
	,dataType: 'json'
	,acceptMime: 'text/plain'
    ,done:function(res){
        if (res.code == 0){
        	layer.msg(res.msg, {time: 2000});
        }else{
        	layer.msg(res.msg, {time: 2000});
        }
        $('#url').val(res.filepath);
    }
  });
});
</script>
<script>
layui.use(['upload','jquery'], function(){
	var $ = layui.jquery;
	var upload = layui.upload;
  	var uploadInst = upload.render({
    elem: '#img'
    ,url: "<?php echo url('api/scode/upthumb'); ?>"
    ,exts: 'jpg|png|gif|jpeg'
	,dataType: 'json'
	,acceptMime: 'image/jpg,image/png'
    ,done:function(res){
        if (res.code == 0){
        	layer.msg(res.msg, {time: 2000});
        }else{
        	layer.msg(res.msg, {time: 2000});
        }
        $('#fileid_thumb').val(res.filepath);
    }
  });
});
</script>
</body>
</html>