<?php
	$this->display(tpl('head',true));
	$yzm_way[$settingDB['yzm_way']]='checked';
	if($settingDB['yzm_way']==3) {$number ='';$state='number';} else{$number ='style="display: none;"';}  
	if($settingDB['yzm_way']==4) {$china ='';$state='china';} else{$china ='style="display: none;"';}
?>
<fieldset class="layui-elem-field layui-field-title">
  <legend>验证码设置</legend>
</fieldset>
<form id="SETForm" class="layui-form" method="post">

	<table class="layui-table my-tabel">
		<tbody>
			<tr>
				<td>验证码高度</td>
				<td>
					<input type="number" class="layui-input my-input" name="web[yzm_height]"  value="<?php echo $settingDB['yzm_height']?>" /> 填写数字即可
				</td>
			</tr>
			<tr>
				<td>验证码宽度</td>
				<td>
					<input type="number" class="layui-input my-input" name="web[yzm_width]"  value="<?php echo $settingDB['yzm_width']?>" /> 填写数字即可
				</td>
			</tr>
			<tr>
				<td>验证码长度</td>
				<td>
					<input type="number" class="layui-input my-input" name="web[yzm_length]"  value="<?php echo $settingDB['yzm_length']?>" /> 默认为4
				</td>
			</tr>
			<tr>
				<td>显示方式</td>
				<td>
					<input type="radio" lay-filter='yzm_way' name="web[yzm_way]" title="数字" value="0" <?php echo $yzm_way[0]?>/>
					<input type="radio" lay-filter='yzm_way' name="web[yzm_way]" title="字母" value="1" <?php echo $yzm_way[1]?>/>
					<input type="radio" lay-filter='yzm_way' name="web[yzm_way]" title="数字加字母"  value="2" <?php echo $yzm_way[2]?>/>
					<input type="radio" lay-filter='yzm_way' name="web[yzm_way]" title="数学加减运算"  value="3" <?php echo $yzm_way[3]?>/>
					<input type="radio" lay-filter='yzm_way' name="web[yzm_way]" title="汉字"  value="4" <?php echo $yzm_way[4]?>/>
				</td>
			</tr>
			<tr id="number" <?php echo $number ?>>
				<td>请输入一个数字</td>
				<td>
					<input class="layui-input my-input" type="number" name="web[yzm_num]"  value="<?php echo $settingDB['yzm_num']?>" />多少以内的加减法,默认为20以内
				</td>
			</tr>
			<tr id="china" <?php echo $china?>>
				<td>预设汉字</td>
				<td>
					<textarea name="web[yzm_china]"  class="layui-textarea my-input"><?php echo $settingDB['yzm_china']?></textarea>
					<p> 如果设置显示方法选择的是汉字。会随机挑选其中的验证码长度的汉字进行显示,只能是汉字，不允许出现数字或字母</p>
				</td>
			</tr>
			<script>
				var state='<?php echo $state ?>';
				layui.use(['form'], function() {
					var form = layui.form;
					form.on('radio(yzm_way)', function(data){
						if(state){
							$('#'+state).hide();
						}
					  	if(data.value==3){
					  		state='number';
					  		$('#number').show();
					  	}else if(data.value==4){
					  		state='china';
					  		$('#china').show();
					  	}
					});  
				});
			</script>
			<tr>
				<td colspan="2" class="my_button center" align="center">
					<input type="hidden" name="step" id="step" value="post" />
					<button class="layui-btn">立即提交</button>
				</td>
			</tr>
		</tbody>
		</tbody>
	</table>
</form>


<?php $this->display(tpl('foot',true)); ?>
