From bf7e5d3709b6aad2ef05b408c04ee424d9131538 Mon Sep 17 00:00:00 2001 From: 10396 <1039655633@qq.com> Date: Thu, 3 Jul 2025 15:47:37 +0800 Subject: [PATCH] =?UTF-8?q?feat(login):=20=E5=BC=BA=E5=8C=96=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E5=AE=89=E5=85=A8=E6=80=A7=E5=92=8C=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改密码页面增加用户名显示和密码复杂度要求- 提交密码时增加复杂度校验 - 密码修改成功后增加提示框和延迟跳转 - 登录时增加弱密码提示并跳转到修改密码页面 --- pages/login/forget/forget-reset.vue | 53 +++++++++++++++++++++-------- pages/login/home.vue | 15 ++++++++ 2 files changed, 54 insertions(+), 14 deletions(-) diff --git a/pages/login/forget/forget-reset.vue b/pages/login/forget/forget-reset.vue index 44ecd3b..d63fd4c 100644 --- a/pages/login/forget/forget-reset.vue +++ b/pages/login/forget/forget-reset.vue @@ -5,9 +5,9 @@ 设置密码 - - 修改密码 - + + 账号:{{USERNAME}} + @@ -24,8 +24,8 @@ - 需8-20位字符 - + 需8-20位字母大小写、数字、字符混合 + @@ -44,6 +44,8 @@ nowPwd :'', buttonloading: false, confirmPwd :'', + USERNAME: loginUser.USERNAME + } }, methods: { @@ -112,6 +114,15 @@ }); return } + var reg1 = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[~!@#$%^&*.])[\da-zA-Z~!@#$%^&*.]{8,}$/ + if (!reg1.test(_this.nowPwd)) { + uni.showToast({ + icon: 'none', + title: '密码必须包含大小写字母、数字、特殊符号', + duration: 2000 + }); + return + } this.buttonloading = true uni.request({ url: basePath +'/app/user/editUserPwd' , @@ -132,19 +143,24 @@ this.buttonloading = false if (res.data != null) { var result = res.data.result; - if ("success" == result) { - uni.showToast({ - title: "密码修改成功", - duration: 1000 - }); - uni.navigateTo({ - url: '/pages/login/home', - }); + if ("success" === result) { + 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: "密码有误", + title: "旧密码有误", duration: 2000 }); }else if ("exception" == result) { @@ -179,4 +195,13 @@ page{ background-color: #FFFFFF; } + .user_main{ + width: 100%; + padding:30upx 20upx ; + background: #d8e9ff; + border-radius: 10upx; + box-sizing: border-box; + margin-bottom: 40upx; + font-size: 30upx; + } diff --git a/pages/login/home.vue b/pages/login/home.vue index b6ac662..953208d 100644 --- a/pages/login/home.vue +++ b/pages/login/home.vue @@ -272,6 +272,21 @@ setDeptLevel(res.data.DEPARTMENT_LEVEL); setIsRest(res.data.ISREST); setloginUser(res.data); + if(res.data.passwordType === '0'){ + uni.showToast({ + icon: 'none', + title: "登录的密码强度为弱,请修改密码!", + duration: 2000 // 显示2秒 + }); + + // 延迟2000ms后再执行页面跳转 + setTimeout(() => { + uni.navigateTo({ + url: '/pages/login/forget/forget-reset' + }); + }, 2000); // 延迟时间必须大于等于toast的duration + return + } uni.setStorage({ key: 'USER', data: res.data