refactor(login): 优化忘记密码功能的逻辑和提示

-增加对服务器返回 code 的判断,确保只有在 code 为 0 时才显示成功提示
- 调整用户错误提示的显示方式,使用 uni.showToast 替代 uni.showModal
- 优化异常处理,统一异常提示的显示格式
dev
10396 2025-07-04 08:49:07 +08:00
parent bf7e5d3709
commit 587651761b
1 changed files with 24 additions and 21 deletions

View File

@ -142,28 +142,31 @@
uni.hideLoading();// uni.hideLoading();//
this.buttonloading = false this.buttonloading = false
if (res.data != null) { if (res.data != null) {
var result = res.data.result; var code = res.data.code;
if ("success" === result) { var result = res.data.result;
uni.showToast({ if("success"===result){
title: "密码修改成功", if ("0" === code) {
duration: 1500, // uni.showToast({
success: function() { title: "密码修改成功",
// 使 setTimeout duration: 1500, //
setTimeout(function() { success: function() {
uni.navigateTo({ // 使 setTimeout
url: '/pages/login/home', setTimeout(function() {
}); uni.navigateTo({
}, 1500); // duration url: '/pages/login/home',
} });
}); }, 1500); // duration
}
});
} else if ("usererror" == result) { } else if ("9999" === code) {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: "旧密码有误", title: "旧密码有误",
duration: 2000 duration: 2000
}); });
}else if ("exception" == result) { }
} else if ("exception" === result) {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: res.data.exception, title: res.data.exception,