<?php include $this->admin_tpl('meta', 'admin');?>
<title>添加关键字回复 - YzmCMS内容管理系统</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 微信管理 <span class="c-gray en">&gt;</span> 消息回复 <span class="c-gray en">&gt;</span> 关键字回复 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<article class="page-container">
<div class="formdoby_normal"> 
	<form method="post" action="<?php echo U('edit');?>" onsubmit="return dosub(this)">
		<ul>
			<li><label><span class="c-red">*</span>关键字：</label><input type="text" class="input" style="width:300px" placeholder="关键字不宜太长" name="keyword" value="<?php echo $data['keyword'];?>"></li>
			<li><label>关键字模式：</label><label><input class="radio" type="radio" name="keyword_type" value="1" <?php if($data['keyword_type']) echo 'checked="checked"';?>>完全匹配</label>&nbsp;&nbsp;
	                <label><input class="radio" type="radio" name="keyword_type" value="0" <?php if(!$data['keyword_type']) echo 'checked="checked"';?>>模糊匹配</label></li>
			<li><label>回复模式：</label><label><input class="radio" type="radio" name="type" value="1" <?php if(!$data['relation_id']) echo 'checked="checked"';?>>文本回复</label>&nbsp;&nbsp;
	                <label><input class="radio" type="radio" name="type" value="0" <?php if($data['relation_id']) echo 'checked="checked"';?>>图文回复</label></li>
			<li id="relation_id_li" <?php if(!$data['relation_id']) echo 'style="display:none"';?>><label>回复文章ID：</label><input type="text" class="input" style="width:450px" id="relation_id" placeholder="多个ID之间用“,”分割，限制为8条以内" name="relation_id" readonly="readonly" value="<?php echo $data['relation_id'];?>">&nbsp;&nbsp;<a href="javascript:;" class="btn btn-default radius" onclick="yzm_open('选择文章','<?php echo U('select_article');?>',900,520)">选择文章</a></li>
			<li id="content" <?php if(!$data['content']) echo 'style="display:none"';?>><label>回复内容：</label><textarea class="textarea" name="content" style="width:450px"><?php echo $data['content'];?></textarea></li>
			<li></li>
			<li><input type="hidden" name="id" value="<?php echo $data['id'];?>"><input class="dosubmit w_120 btn-primary radius" name="dosubmit" type="submit" value="提交"></li>
		</ul>
	</form>
</div>
</article>
<?php include $this->admin_tpl('footer', 'admin');?>

<script type="text/javascript">
	$(function(){
		$('input:radio[name="type"]').change(function(){  
			if($(this).val()=='1') {
				$('#content').css('display','');
				$('#relation_id_li').css('display','none');
				$("input[name='relation_id']").val('');
			}else{
				$('#content').css('display','none');
				$('#relation_id_li').css('display','');
			}
		}); 
	});

	function dosub(obj){
		 if($("input[name='keyword']").val()==''){
			 layer.msg('关键字不能为空！');
			 return false;
		 }
		 
		 
		 if($("input[name='type']:checked").val()=='1'){
			 if($("textarea[name='content']").val()==''){
				 layer.msg('回复内容不能为空！');
				 return false;
			 }
		 }else{
			 if($("input[name='relation_id']").val()==''){
				 layer.msg('回复文章ID不能为空！');
				 return false;
			 }		 
		 }
	 
		return true;			 
	}
</script> 

</body>
</html>