diff --git a/pages/login/forget/forget-reset.vue b/pages/login/forget/forget-reset.vue index 44ecd3b..0a23ea4 100644 --- a/pages/login/forget/forget-reset.vue +++ b/pages/login/forget/forget-reset.vue @@ -5,9 +5,9 @@ 设置密码 - - 修改密码 - + + 账号:{{USERNAME}} + @@ -24,7 +24,7 @@ - 需8-20位字符 + 需8-20位字母大小写、数字、字符混合 @@ -44,6 +44,7 @@ nowPwd :'', buttonloading: false, confirmPwd :'', + USERNAME: loginUser.USERNAME } }, methods: { @@ -112,6 +113,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,16 +142,31 @@ 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', - }); + var Code = res.data.code; + console.log(res.data.code) + if ("success" === result) { + if("9999" === Code){ + uni.showToast({ + icon: 'none', + title: "旧密码错误", + duration: 2000 + }); + }else{ + uni.showToast({ + title: "密码修改成功", + duration: 1500, // 适当延长显示时间 + success: function() { + // 使用 setTimeout 确保提示框完全显示后再跳转 + setTimeout(function() { + uni.navigateTo({ + url: '/pages/login/home', + }); + }, 1500); // 延迟时间与 duration 一致或略长 + } + }); + } - } else if ("usererror" == result) { + } else if ("usererror" === result) { uni.showToast({ icon: 'none', title: "密码有误", @@ -179,4 +204,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 aef7d3c..afc77bf 100644 --- a/pages/login/home.vue +++ b/pages/login/home.vue @@ -271,13 +271,28 @@ title: res.data.msg, duration: 2000 }); - if ("success" == result) { + if ("success" === result) { setloginUserId(res.data.USER_ID); setCorpinfoId(res.data.CORPINFO_ID); setDeptId(res.data.DEPARTMENT_ID); 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}); const remember = {} remember.username = userName