water_xcx/pages/resetting/resetting.js

121 lines
2.1 KiB
JavaScript
Raw Normal View History

2025-04-15 15:44:51 +08:00
const app = getApp()
var myRequest = require("../../utils/api.js");
const aesUtil = require('../../utils/utils.js')
Page({
/**
* 页面的初始数据
*/
data: {
canIUse: wx.canIUse('button.open-type.getUserInfo'),
oldPwd: '',
newPwd: '',
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var that = this;
},
getOldPwd(e) {
this.setData({
oldPwd: e.detail.value,
})
},
getNewPwd(e) {
this.setData({
newPwd: e.detail.value,
})
},
resettingPassword() {
var that = this;
if (that.data.oldPwd == '') {
wx.showToast({
title: '请输入旧密码',
icon: 'none'
})
return false;
}
if (that.data.newPwd == '') {
wx.showToast({
title: '请输入新密码',
icon: 'none'
})
return false;
}
myRequest.myRequest('system/updatePwd', {
oldPwd: that.data.oldPwd,
newPwd: that.data.newPwd,
}, 'post').then(function(res){
wx.showToast({
title: '重置成功',
duration: 2000,
success: function() {
setTimeout(()=>
{
wx.redirectTo({
url: '../login/login',
})
}, 2000)
}
})
}).catch(function(res){
console.log(res);
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
return {
title: '登录',
path: '/pages/login/login'
}
}
})