mirror of
https://gitee.com/elegant_wings/dbd-meeting-wx-small.git
synced 2025-06-22 03:09:37 +08:00
83 lines
1.8 KiB
JavaScript
83 lines
1.8 KiB
JavaScript
let app = getApp();
|
|
Page({
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
getCodeTime: 40, //发送短信的间隔时间
|
|
verifyCodeTime: '获取验证码',
|
|
},
|
|
|
|
bSubmit: function (e) {
|
|
var that = this,
|
|
password = e.detail.value.password,
|
|
newPassword = e.detail.value.newPassword,
|
|
reNewPassword = e.detail.value.reNewPassword
|
|
if (!password) {
|
|
wx.showToast({
|
|
title: '请先输入旧密码',
|
|
duration: 3000,
|
|
icon: 'none'
|
|
})
|
|
that.setData({
|
|
passwordfocus: true
|
|
})
|
|
return false
|
|
}
|
|
if (!newPassword) {
|
|
wx.showToast({
|
|
title: '请先输入新密码',
|
|
duration: 3000,
|
|
icon: 'none'
|
|
});
|
|
that.setData({
|
|
newPasswordfocus: true
|
|
})
|
|
return false
|
|
}
|
|
if (!reNewPassword) {
|
|
wx.showToast({
|
|
title: '请再次输入新密码',
|
|
duration: 3000,
|
|
icon: 'none'
|
|
});
|
|
that.setData({
|
|
reNewPasswordfocus: true
|
|
})
|
|
return false
|
|
}
|
|
// 验证码检验
|
|
app.AjaxRequest('get', {
|
|
'content-type': 'application/json',
|
|
'Authorization': 'Bearer ' + app.Getopenid()
|
|
}, '/password/reset', {
|
|
password,
|
|
newPassword,
|
|
reNewPassword
|
|
}, function (res) {
|
|
if (res.code == 0) {
|
|
wx.showModal({
|
|
confirmText: '好的',
|
|
content: '密码已修改,请重新登录',
|
|
showCancel: false,
|
|
success(res) {
|
|
wx.clearStorageSync()
|
|
wx.reLaunch({
|
|
url: '/pages/login/login',
|
|
})
|
|
}
|
|
})
|
|
}
|
|
})
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (e) {},
|
|
|
|
retrieve() {
|
|
wx.navigateTo({
|
|
url: '../retrievePassword/retrievePassword',
|
|
})
|
|
}
|
|
}) |