<?php include $this->admin_tpl('meta', 'admin');?>
<title>添加关键字回复 - YzmCMS内容管理系统</title>
</head>
<body>
<nav class="breadcrumb"><i class="yzm-iconfont yzm-iconai-home"></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="yzm-iconfont yzm-iconshuaxin"></i></a></nav>
<article class="page-container">
<div class="formdoby_normal"> 
	<form method="post" action="<?php echo U('add');?>" onsubmit="return dosub(this)">
		<ul>
			<li><label><span class="c-red">*</span>关键字：</label>
				<input type="text" class="input" style="width:300px" placeholder="关键字长度控制在21个汉字之内" name="keyword" value="">
			</li>
			<li><label>关键字模式：</label>
				<label><input class="radio" type="radio" name="keyword_type" value="1" checked="checked"> 完全匹配 </label>
	            <label><input class="radio" type="radio" name="keyword_type" value="0" > 模糊匹配 </label>
	        </li>
			<li><label>回复模式：</label>
				<label><input class="radio" type="radio" name="type" value="1" checked="checked"> 文本回复 </label>
	            <label><input class="radio" type="radio" name="type" value="0" > 图文回复 </label>
	        </li>
			<li id="relation_id_li" 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="">&nbsp;&nbsp;
				<a href="javascript:;" class="btn btn-default radius" onclick="yzm_open('选择文章','<?php echo U('select_article');?>',900,525)">选择文章</a>
			</li>
			<li id="content"><label>回复内容：</label>
				<textarea class="textarea" name="content" style="width:450px"></textarea>
			</li>
			<li></li>
			<li>
				<input type="hidden" name="dosubmit" value="1">
				<input class="dosubmit w_100 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');
			}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>