const app = getApp(); Page({ data: { past_password:'', //旧密码 password:'', //新密码 qpassword:'', //确认密码 used_value:'', password_value:'', qpassword_value:'', }, onLoad: function (options) { }, //获取旧密码 used_password: function (e) { var _used_password = e.detail.value; // console.log(_used_password); this.setData({ past_password: _used_password }); }, //获取新密码 password: function (e) { var _password = e.detail.value; // console.log(_password); this.setData({ password: _password }); }, //获取确认密码 qpassword: function (e) { var _qpassword = e.detail.value; // console.log(_qpassword); this.setData({ qpassword: _qpassword }); }, //完成事件 complete: function (e) { var _this = this; var _past_password = _this.data.past_password; var _password = _this.data.password; var _qpassword = _this.data.qpassword; // console.log(_past_password); // console.log(_password); // console.log(_qpassword); if (_past_password == ''){ var _qrcode = '原始密码不能为空' getApp().Tips(_qrcode); } else if (_password == ''){ var _qrcode = '新密码不能为空' getApp().Tips(_qrcode); } else if (_qpassword == '') { var _qrcode = '确认新密码不能为空' getApp().Tips(_qrcode); } else if (_password != _qpassword) { var _qrcode = '两次新密码输入不一致' getApp().Tips(_qrcode); }else{ let income_url = 'my/accountsecurity/resetpassword'; let income_data = { past_password: _past_password, //旧密码 password: _password, //新密码 qpassword: _qpassword, //确认密码 }; app.postRequest(income_url, income_data, function (res) { // console.log(income_data.photo); if (res.code == 201) { wx.showToast({ title: '修改成功', duration: 1500, }) setTimeout(function () { wx.clearStorageSync(); wx.reLaunch({ url: '/pages/Landpage/Land/Land' }); }, 800) return; } // console.log(res.data.past_password); if (res.data.past_password){ getApp().Tips(res.data.past_password[0]); _this.setData({ used_value: '', }); } else if (res.data.password){ getApp().Tips(res.data.password[0]); _this.setData({ password_value: '', qpassword_value: '', }); } }) } }, })