You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.1 KiB
51 lines
1.1 KiB
const app = getApp();
|
|
Page({
|
|
data: {
|
|
user:{}
|
|
},
|
|
|
|
onFormReset(){
|
|
wx.navigateBack({
|
|
delta:1
|
|
});
|
|
},
|
|
changePassword({detail:{value}}){
|
|
if(app.user().user_id==2)
|
|
return wx.showToast({
|
|
title: '请登陆后操作哦', icon: "none"
|
|
});
|
|
if(!value.password||!value.old_password||!value.password_confirmation)
|
|
return wx.showToast({
|
|
title: '请输入完整哦', icon: "none"
|
|
});
|
|
if(value.password_confirmation!=value.password)
|
|
return wx.showToast({
|
|
title: '两次输入的新密码不一致哦',icon:"none"
|
|
});
|
|
if(value.old_password==value.password)
|
|
return wx.showToast({
|
|
title: '输入的新旧密码是一样的哦', icon: "none"
|
|
});
|
|
app.api("users.accounts.password")(value)
|
|
.then(res=>{
|
|
if(res.status==0)
|
|
res.message="修改成功";
|
|
app.showMsg(res);
|
|
setTimeout(()=>{
|
|
wx.navigateBack({
|
|
delta: 1
|
|
});
|
|
},1000);
|
|
|
|
})
|
|
.catch(e=>{
|
|
app.showError(e);
|
|
})
|
|
},
|
|
onLoad: function (options) {
|
|
app.syncUser()
|
|
.then(res=>{
|
|
this.setData({})
|
|
})
|
|
}
|
|
}) |