<?php /*a:4:{s:61:"/www/wwwroot/btn.millet-mirth.com/view/admin/images/edit.html";i:1658997170;s:60:"/www/wwwroot/btn.millet-mirth.com/view/admin/common/top.html";i:1625466448;s:64:"/www/wwwroot/btn.millet-mirth.com/view/admin/common/ueditor.html";i:1646121304;s:63:"/www/wwwroot/btn.millet-mirth.com/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="iframe_content">
	<div class="iframe_add images_box">
    	<form action="<?php echo url('update'); ?>" class="layui-form" name="rule" id="rule" method="post" onsubmit="return TQsubmit();">
        <input name="id" type="hidden" value="<?php echo htmlentities($info['id']); ?>" />
    	<ul>
            <li><label class="layui-form-label">标　　题</label><input type="text" name="title" value="<?php echo htmlentities($info['title']); ?>" placeholder="" autocomplete="off" class="layui-input"></li>
            <li><label class="layui-form-label">链　　接</label><input type="text" name="url" value="<?php echo htmlentities($info['url']); ?>" placeholder="http://" autocomplete="off" class="layui-input"></li>
            <li class="images_pic_input"><label class="layui-form-label">图　　片</label>
		<input type="text" name="pic" id="upimg_pic" value="<?php echo $info['pic']; ?>" class="layui-input" /> 
		<input type="file" id="for_pic" name="" onchange="upload_pic(this)" style="display:none">
		<label for="for_pic" class="for_label"><p class="layui-btn layui-btn-normal layui-btn-sm"><i class="layui-icon">&#xe67c;</i>上传图片</p></label>
		
		<script>
		function upload_pic(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_pic").val(date.file);
						$(".yulan_pic").show().attr("data-file",date.file);
					}else{
						layer.msg(date.info, {icon:2,time:1500});
					}
				},
				error : function(){ }
			});
		}			
		</script></li>
            <?php if($info['pid']==10): ?>
            <li class="images_pic_input"><label class="layui-form-label">附加图片</label>
		<input type="text" name="pic1" id="upimg_pic1" value="<?php echo $info['pic1']; ?>" class="layui-input" /> 
		<input type="file" id="for_pic1" name="" onchange="upload_pic1(this)" style="display:none">
		<label for="for_pic1" class="for_label"><p class="layui-btn layui-btn-normal layui-btn-sm"><i class="layui-icon">&#xe67c;</i>上传图片</p></label>
		
		<script>
		function upload_pic1(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_pic1").val(date.file);
						$(".yulan_pic1").show().attr("data-file",date.file);
					}else{
						layer.msg(date.info, {icon:2,time:1500});
					}
				},
				error : function(){ }
			});
		}			
		</script></li>
            <!--<li class="images_pic_input"><label class="layui-form-label">视　　频</label>
		<input type="text" name="sp" id="upimg_sp" value="<?php echo $info['sp']; ?>" class="layui-input" /> 
		<input type="file" id="for_sp" name="" onchange="upload_sp(this)" style="display:none">
		<label for="for_sp" class="for_label"><p class="layui-btn layui-btn-normal layui-btn-sm"><i class="layui-icon">&#xe67c;</i>上传文件</p></label>
		
		<script>
		function upload_sp(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_sp").val(date.file);
						$(".yulan_sp").show().attr("data-file",date.file);
					}else{
						layer.msg(date.info, {icon:2,time:1500});
					}
				},
				error : function(){ }
			});
		}			
		</script></li>-->
            <?php endif; ?>
            <li>
                <label class="layui-form-label">是否显示</label>
                <div>
                    <input type="radio" name="is_effect" value="1" title="启用" <?php if($info['is_effect']==1): ?>checked<?php endif; ?>>
                    <input type="radio" name="is_effect" value="2" title="停用" <?php if($info['is_effect']==2): ?>checked<?php endif; ?>>
                </div>
            </li>
            <li>
                <label class="layui-form-label">跳新窗口</label>
                <div>
                    <input type="radio" name="is_new" value="1" title="否" <?php if($info['is_new']==1): ?>checked<?php endif; ?>>
                    <input type="radio" name="is_new" value="2" title="是" <?php if($info['is_new']==2): ?>checked<?php endif; ?>>
                </div>
            </li>
        </ul>
        </form>
    </div>
</div>

<div class="iframe_foot">
<input name="" type="submit" onclick="TQsubmit();" class="layui-btn TQmovesubmit" />　　
<input name="" type="button" value="关闭" onclick="open_iframe_close();" class="layui-btn layui-btn-danger" />
</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>
<script>
function TQsubmit(){
	$('.TQmovesubmit').attr('onclick','');
	$.post('update',$("#rule").serialize(),function(data){
		console.log(data);
		if(data.type==1){
			layer.msg(data['msg'], {icon:2,time:1000});
			$('.TQmovesubmit').attr('onclick','TQsubmit();');
		}else{
			layer.msg(data['msg'], {icon:1,time:1000});
			$("body",parent.document).find('#open_iframe').val(1);
			setTimeout(function(){ window.location.reload(); },1500);
		}
    });
	return false;
}

layui.use('form', function(){
	var form = layui.form;
	form.on('select(pid)', function(data){
		var lv=$(data.elem).find("option:selected").attr('data-lv');
		var text=$.trim($('.layui-pid .layui-input').val());
		$('.layui-pid .layui-input').val(text);
		$(data.elem).find("option:selected").text(text);
	});  
});
</script>