diff --git a/src/main/webapp/front/changePwd.html b/src/main/webapp/front/changePwd.html index 6a1ddb609228f04a6e9b447ba492d6927eab4f51..1e2dabef9f7eded39aef984146a72db354d6fad4 100644 --- a/src/main/webapp/front/changePwd.html +++ b/src/main/webapp/front/changePwd.html @@ -27,17 +27,26 @@
@@ -77,23 +86,41 @@ $(".security-code").text( + curCount1 + "秒再获取"); } } + //检查两次密码是否一致 + function checkPwd(){ + var confirm=$("#confirm-pwd").val(); + var newPwd=$("input[name=newPass]").val(); + if(confirm==newPwd){ + return true; + }else{ + mui.toast('两次密码不一致,请重新输入',{ duration:'2000', type:'div' }); + return false; + } + } mui(".mui-content").on('tap','.change-pwd',function(){ JSON.stringify(getFormData($('#change-pwd-form'))); console.log(JSON.stringify(getFormData($('#change-pwd-form')))); - // $.ajax({ - // type: "post", - // url: "", - // data: JSON.stringify(getFormData($('#change-pwd-form'))), - // dataType: "json", - // contentType: 'application/json', - // success: function(data){ - // console.log(data); - // - // }, - // error:function(){ - // mui.toast('修改密码出现异常,请联系管理员',{ duration:'2000', type:'div' }); - // } - // }); + var data=getFormData($('#change-pwd-form')); + + data['_method']="PUT"; + console.log(data); + if(checkPwd()){ + $.ajax({ + type: "POST", + url: "../user/", + data: JSON.stringify(data), + dataType: "json", + contentType: 'application/json', + success: function(data){ + console.log(data); + + }, + error:function(){ + mui.toast('修改密码出现异常,请联系管理员',{ duration:'2000', type:'div' }); + } + }); + } + });