<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>{echo admin_title()}</title>
	{template _header}
	<style>
		.weui-cells::after, .weui-cells::before{ display: none;}
	</style>
</head>
<body>
	<div class="weui-tab">
		<div class="weui-tab__panel" style="background: #fff;">
			<div class="weui-form">
				<div class="weui-form__control-area" style="margin:15px 0 30px;">
					<div class="weui-cells__group weui-cells__group_form">
						<div class="weui-cells weui-cells_form" style="margin-top: 15px;">
							<div class="weui-cell">
								<div class="weui-cell__hd"><label class="weui-label">原密码</label></div>
								<div class="weui-cell__bd">
									<input type="password" id="password" name="password" class="weui-input" placeholder="填写原密码">
								</div>
							</div>
							<div class="weui-cell">
								<div class="weui-cell__hd"><label class="weui-label">新密码</label></div>
								<div class="weui-cell__bd">
									<input type="password" id="new_password" name="new_password" class="weui-input" placeholder="填写新密码">
								</div>
							</div>
							<div class="weui-cell">
								<div class="weui-cell__hd"><label class="weui-label">确认新密码</label></div>
								<div class="weui-cell__bd">
									<input type="password" id="renew_password" name="renew_password" class="weui-input" placeholder="确认新密码">
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="weui-form__tips-area"></div>
				<div class="weui-form__opr-area">
					<a href="javascript:;" class="weui-btn weui-btn_primary" id="submit2">确定</a>
				</div>
			</div>
		</div>
		{template _main_nav}
	</div>
<script>
$("#submit2").click(function(){
	if($("#password").val() == "") {
		weui.topTips("请输入原密码!");
		return false;
	}
	if($("#new_password").val() == "") {
		weui.topTips("请输入新密码!");
		return false;
	}
	if($("#new_password").val() != $("#renew_password").val()) {
		weui.topTips("两次密码输入不一致!");
		return false;
	}
	var loading = weui.loading('加载中');
	$.ajax({
		type: "POST",
		url: "{echo \befen\get_url()}",
		data: {
			password: $('#password').val(),
			new_password: $('#new_password').val(),
			renew_password: $('#renew_password').val(),
		},
		success: function(res){
			loading.hide();
			if(res.status == 0){
				return weui.topTips(res.message);
			}
			weui.toast('操作成功');
			location.assign("{echo url('login/index')}");
		}
	});
});
</script>
</body>
</html>