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