<%@ page contentType="text/html;charset=UTF-8"%>
<%-- <%@ include file="../include/head.jsp"%> --%>
<script type="text/javascript">
	var saveAction = "${ctx}/ycjt-ggcx/admin/save";
	function test(){
		var oldPassword = $('#oldPassword').val();
		var newPassword = $('#newPassword').val();
		var copyPassword = $('#copyPassword').val();
		var reg = new RegExp("[\\u4E00-\\u9FFF]+","g");
		if(oldPassword==""||oldPassword==null){
			$.messager.alert("消息","请输入旧密码");
			return false;
		}
		if(reg.test(oldPassword)){    
			$.messager.alert("消息","密码不能含有汉字");
			return false;
		}
		if(newPassword==""||newPassword==null){
			$.messager.alert("消息","请输入新密码");
			return false;
		}
		if(reg.test(newPassword)){    
			$.messager.alert("消息","新密码不能含有汉字");
			return false;
		}
		if(copyPassword==""||copyPassword==null){
			$.messager.alert("消息","请输入确认的新密码");
			return false;
		}
		if(reg.test(copyPassword)){    
			$.messager.alert("消息","确认新密码不能含有汉字");
			return false;
		}
		if(newPassword==oldPassword){
			$.messager.alert("消息","新旧密码不能相同");
			return false;
		}
		
		if(newPassword!=copyPassword){
			$.messager.alert("消息","新密码和确认新密码不相同");
			return false;
		}
		
		$.ajax({
			url:saveAction,
			type : "POST",
			data:{
					'oldPassword':oldPassword,
					'newPassword':newPassword,
				},
			success:function(data){
					if("ok"==data.result){
						$.messager.alert("消息", data.msg, "info", function () {
							$('#passwordMngWin').dialog('close');
				        }); 
					}else{
						$.messager.alert("消息",data.msg);
						document.forms[0].reset();
					}
				} 
		});
	}
</script>
<div class="easyui-layout" fit="true" region="center">
		<div class="dialog-toolbar">
				<a href="#" class="easyui-linkbutton"
					data-options="plain:true,iconCls:'icon-save'" onclick="test()">保存</a>
				<a href="#" class="easyui-linkbutton"
					data-options="plain:true,iconCls:'icon-undo'" onclick="document.forms[0].reset()">清空</a>
		</div>
		<div class="editform">
			<form id="f1" method="post">
				<table>
					<tbody>
						<tr>
							<td class="label" style="margin-left: 25px;" ><div></br></div><label>旧密码：</label><div></br></div></td>
							<td><div></br></div><input id="oldPassword"   type="password" name="oldPassword" class="easyui-validatebox" value="${one.code }" size="20" maxLength="10" />
							<span class="inputrequired" style="color: red;margin-left:10px;">*</span><div></br></div></td>
						</tr>
						<tr>
							<td class="label" style="margin-left: 25px;"><div></br></div><label>新密码：</label><div></br></div></td>
							<td><div></br></div><input id="newPassword"  type="password" name="newPassword" class="easyui-validatebox" value="${one.name }" size="20" maxLength="10" />
							<span class="inputrequired" style="color: red;margin-left:10px;">*</span><div></br></div></td>
						</tr>
						<tr>
							<td class="label"><div></br></div><label>确认新密码：</label><div></br></div></td>
							<td><div></br></div>	
								<input id="copyPassword" name="copyPassword"  type="password" class="easyui-validatebox" value="${one.name }" size="20" maxLength="10"/>
								<span class="inputrequired" style="color: red;margin-left:10px;">*</span>
							<div></br></div>
							</td>
						</tr>
					</tbody>
				</table>
			</form>
		</div>
</div>