update_obj.html
4.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
{echo:JS::import('form');}
{echo:JS::import('dialog?skin=tinysimple');}
{echo:JS::import('dialogtools');}
<link type="text/css" rel="stylesheet" href="{url:#css/ucenter.css}" />
<div class="container clearfix">
{widget:name=sub_navs action=ucsidebar sidebar=$sidebar act=$actionId}
{set:$objInfo=array('password'=>'登录密码','email'=>'邮箱','mobile'=>'手机号码','paypwd'=>'支付密码')}
<div class="uc-content">
<h1 class="title"><span>修改{$objInfo[$obj]}</span></h1>
<div>
{set:$items=array("验证身份","修改".$objInfo[$obj],"完成");} {widget:name=sub_navs action=crumbs items=$items step=3 current=2}
</div>
<div class="simple-box " >
<form action="{url:/ucenter/update_obj_act}" name="form_update" class="simple" method="post">
<ul class="form ">
{if:$obj=='password' || $obj=='paypwd'}
<li><span class="perfix fa"></span><input bind="repassword" minlen=6 maxlen=20 class="input" type="password" name="password" pattern="required" placeholder="密码" alt="6-20任意字符组合"></li>
<li><span class="perfix fa"></span><input bind="password" minlen=6 maxlen=20 class="input" type="password" name="repassword" pattern="required" placeholder="确认密码" alt="6-20任意字符组合"></li>
{elseif:$obj=='mobile'}
<li>
<span class="perfix fa"></span><input type="text" id="account" class="input" name="account" pattern="mobi" placeholder="手机号码" value="{$mobile}" alt="正确的手机号码">
</li>
<li>
<span class="perfix fa"></span><input type="text" name="code" pattern="\d{6}" alt="6位短信验证码" placeholder="短信验证码"><label></label>
<input id="sendSMS" type="button" class="btn btn-default" value="获取短信验证码">
</li>
{elseif:$obj=='email'}
<li>
<span class="perfix fa"></span><input type="text" id="account" class="input" name="account" pattern="email" placeholder="邮箱地址" value="{$account}" alt="正确邮箱地址">
</li>
<li>
<span class="perfix fa"></span><input type="text" name="code" pattern="\d{6}" alt="" placeholder="邮箱收到的验证码"><label></label>
<input id="sendEmail" type="button" class="btn btn-default" value="发送邮件">
</li>
{/if}
<li><div id="msgInfo" ></div></li>
<li><input type="submit" name="" class="btn" value="提交修改"></li>
</ul>
</form>
</div>
</div>
</div>
<script type="text/javascript">
{if:isset($invalid)}
var form = new Form("form_update");
//autoValidate.showMsg({id:$("input[name='{$invalid['field']}']").get(0),error:true,msg:"{$invalid['msg']}"});
$("#msgInfo").text("{$invalid['msg']}");
{/if}
$("#sendSMS").click(function() {
var account = $("#account").val();
$.post("{url:/ucenter/send_objcode}",{account:account},function(result) {
if (result['status'] == 'success') {
lockSendButton($("#sendSMS"),120);
} else {
art.dialog.tips("<p class='fail'>" + result['msg'] + "</p>");
lockSendButton($("#sendSMS"),data['haveTime']);
}
}, 'json');
});
$("#sendEmail").on('click',function(){
var account = $("#account").val();
$.post("{url:/ucenter/send_objcode}",{account:account},function(data){
if(data['status']=='fail'){
art.dialog.tips("<p class='fail'>"+data['msg']+"</p>");
lockSendButton($("#sendEmail"),data['haveTime']);
}else{
lockSendButton($("#sendEmail"),120);
}
},'json');
});
function lockSendButton(obj,haveTime){
var send_sms = obj;
send_sms.attr("disabled", true);
send_sms.addClass("btn-disable");
var i = haveTime;
send_sms.val(i + '秒后重新获取');
var timer = setInterval(function() {
i--;
send_sms.val(i + '秒后重新获取');
if (i <= 0) {
clearInterval(timer);
send_sms.val('获取验证码');
send_sms.removeClass("btn-disable");
send_sms.attr("disabled", false);
}
}, 1000);
}
</script>