python学习
This commit is contained in:
61
web/static/js/user/edit.js
Normal file
61
web/static/js/user/edit.js
Normal file
@@ -0,0 +1,61 @@
|
||||
;
|
||||
var user_edit_ops = {
|
||||
init:function(){
|
||||
this.eventBind();
|
||||
},
|
||||
eventBind:function(){
|
||||
$(".user_edit_wrap .save").click(function(){
|
||||
var btn_target = $(this);
|
||||
if( btn_target.hasClass("disabled") ){
|
||||
common_ops.alert("正在处理!!请不要重复提交~~");
|
||||
return;
|
||||
}
|
||||
|
||||
var nickname_target = $(".user_edit_wrap input[name=nickname]");
|
||||
var nickname = nickname_target.val();
|
||||
|
||||
var email_target = $(".user_edit_wrap input[name=email]");
|
||||
var email = email_target.val();
|
||||
|
||||
if( !nickname || nickname.length < 2 ){
|
||||
common_ops.tip( "请输入符合规范的姓名~~",nickname_target );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !email || email.length < 2 ){
|
||||
common_ops.tip( "请输入符合规范的邮箱~~",nickname_target );
|
||||
return false;
|
||||
}
|
||||
|
||||
btn_target.addClass("disabled");
|
||||
|
||||
var data = {
|
||||
nickname: nickname,
|
||||
email: email
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url:common_ops.buildUrl( "/user/edit" ),
|
||||
type:'POST',
|
||||
data:data,
|
||||
dataType:'json',
|
||||
success:function( res ){
|
||||
btn_target.removeClass("disabled");
|
||||
var callback = null;
|
||||
if( res.code == 200 ){
|
||||
callback = function(){
|
||||
window.location.href = window.location.href;
|
||||
}
|
||||
}
|
||||
common_ops.alert( res.msg,callback );
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$(document).ready( function(){
|
||||
user_edit_ops.init();
|
||||
} );
|
||||
59
web/static/js/user/reset_pwd.js
Normal file
59
web/static/js/user/reset_pwd.js
Normal file
@@ -0,0 +1,59 @@
|
||||
;
|
||||
var mod_pwd_ops = {
|
||||
init:function(){
|
||||
this.eventBind();
|
||||
},
|
||||
eventBind:function(){
|
||||
$("#save").click(function(){
|
||||
var btn_target = $(this);
|
||||
if( btn_target.hasClass("disabled") ){
|
||||
common_ops.alert("正在处理!!请不要重复提交~~");
|
||||
return;
|
||||
}
|
||||
|
||||
var old_password = $("#old_password").val();
|
||||
var new_password = $("#new_password").val();
|
||||
|
||||
|
||||
if( !old_password ){
|
||||
common_ops.alert( "请输入原密码~~" );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !new_password || new_password.length < 6 ){
|
||||
common_ops.alert( "请输入不少于6位的新密码~~" );
|
||||
return false;
|
||||
}
|
||||
|
||||
btn_target.addClass("disabled");
|
||||
|
||||
var data = {
|
||||
old_password: old_password,
|
||||
new_password: new_password
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url:common_ops.buildUrl( "/user/reset-pwd" ),
|
||||
type:'POST',
|
||||
data:data,
|
||||
dataType:'json',
|
||||
success:function( res ){
|
||||
btn_target.removeClass("disabled");
|
||||
var callback = null;
|
||||
if( res.code == 200 ){
|
||||
callback = function(){
|
||||
window.location.href = window.location.href;
|
||||
}
|
||||
}
|
||||
common_ops.alert( res.msg,callback );
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$(document).ready( function(){
|
||||
mod_pwd_ops.init();
|
||||
} );
|
||||
Reference in New Issue
Block a user