From 587651761b93c29e566f75bcd4082a40a5bf389a Mon Sep 17 00:00:00 2001 From: 10396 <1039655633@qq.com> Date: Fri, 4 Jul 2025 08:49:07 +0800 Subject: [PATCH] =?UTF-8?q?refactor(login):=20=E4=BC=98=E5=8C=96=E5=BF=98?= =?UTF-8?q?=E8=AE=B0=E5=AF=86=E7=A0=81=E5=8A=9F=E8=83=BD=E7=9A=84=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E5=92=8C=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -增加对服务器返回 code 的判断,确保只有在 code 为 0 时才显示成功提示 - 调整用户错误提示的显示方式,使用 uni.showToast 替代 uni.showModal - 优化异常处理,统一异常提示的显示格式 --- pages/login/forget/forget-reset.vue | 45 +++++++++++++++-------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/pages/login/forget/forget-reset.vue b/pages/login/forget/forget-reset.vue index d63fd4c..895400c 100644 --- a/pages/login/forget/forget-reset.vue +++ b/pages/login/forget/forget-reset.vue @@ -142,28 +142,31 @@ uni.hideLoading();//结束加载中动画 this.buttonloading = false if (res.data != null) { - var result = res.data.result; - if ("success" === result) { - uni.showToast({ - title: "密码修改成功", - duration: 1500, // 适当延长显示时间 - success: function() { - // 使用 setTimeout 确保提示框完全显示后再跳转 - setTimeout(function() { - uni.navigateTo({ - url: '/pages/login/home', - }); - }, 1500); // 延迟时间与 duration 一致或略长 - } - }); + var code = res.data.code; + var result = res.data.result; + if("success"===result){ + if ("0" === code) { + uni.showToast({ + title: "密码修改成功", + duration: 1500, // 适当延长显示时间 + success: function() { + // 使用 setTimeout 确保提示框完全显示后再跳转 + setTimeout(function() { + uni.navigateTo({ + url: '/pages/login/home', + }); + }, 1500); // 延迟时间与 duration 一致或略长 + } + }); - } else if ("usererror" == result) { - uni.showToast({ - icon: 'none', - title: "旧密码有误", - duration: 2000 - }); - }else if ("exception" == result) { + } else if ("9999" === code) { + uni.showToast({ + icon: 'none', + title: "旧密码有误", + duration: 2000 + }); + } + } else if ("exception" === result) { uni.showToast({ icon: 'none', title: res.data.exception,