const app = getApp(); Page({ data: { login: "***" }, 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.checkLogin(); let {login} = global.accountManager.getCurrentAccount(); this.setData({login}); } })