From c15d7ca29b32e440b679a9d7d52a6d8c7c042b36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9A=E4=BA=9A=E7=94=B7?= Date: Fri, 22 Oct 2021 18:03:14 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/js/http/userApi.js | 2 + pages/forgetPassword/forgetPassword.js | 40 ++++++++++++--- pages/forgetPassword/forgetPassword.wxml | 8 ++- pages/forgetPassword/forgetPassword.wxss | 11 ++++ pages/login/login.js | 19 ++++++- pages/login/login.wxss | 2 +- pages/phonePassword/phonePassword.js | 53 ++++++++----------- pages/phonePassword/phonePassword.wxml | 2 +- pages/phonePassword/phonePassword.wxss | 2 +- pages/setPassword/setPassword.js | 44 +++++----------- pages/setPassword/setPassword.json | 1 - pages/setPassword/setPassword.wxml | 4 +- pages/setPassword/setPassword.wxss | 2 +- pages/upDateInfo/upDateInfo.js | 65 +++++++++--------------- pages/upDateInfo/upDateInfo.wxml | 8 +-- pages/upDateInfo/upDateInfo.wxss | 2 +- 16 files changed, 137 insertions(+), 128 deletions(-) diff --git a/assets/js/http/userApi.js b/assets/js/http/userApi.js index 746240f..6c4e6ae 100644 --- a/assets/js/http/userApi.js +++ b/assets/js/http/userApi.js @@ -30,6 +30,8 @@ const UserApi = { wxUnbind: (params) => http.post(`${URL_CONFIG}company/unbindWeXin`, params), // 设置密码 setPassword: (params) => http.post(`${URL_CONFIG}company/changePasswordWithToken`, params), + // 忘记密码 + forgetPassword: (params) => http.post(`${URL_CONFIG}company/verificationChangePassword`, params), // 修改密码 updatePassword: (params) => http.post(`${URL_CONFIG}company/changePassword`, params), // 图片验证码 diff --git a/pages/forgetPassword/forgetPassword.js b/pages/forgetPassword/forgetPassword.js index 21dce39..31c65a1 100644 --- a/pages/forgetPassword/forgetPassword.js +++ b/pages/forgetPassword/forgetPassword.js @@ -10,7 +10,9 @@ Page({ confirmPassword: '', count: 60, rsaPublicKey: '', - showGetCaptcha: true + showGetCaptcha: true, + show: true, // 默认显示的是闭眼睛 + showVerify: true, }, bindInputPhone(e) { @@ -18,6 +20,16 @@ Page({ phone: e.detail.value }) }, + showPassword(){ + this.setData({ + show: !this.data.show + }) + }, + showPasswordVerify(){ + this.setData({ + showVerify: !this.data.showVerify + }) + }, // 获取验证码 getVerCode() { countdown = 60 @@ -116,7 +128,7 @@ Page({ let pattern = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,.\/]).{8,}$/ if(!pattern.test(e.detail.value.password)){ wx.showToast({ - title: '新密码由8位数字、大小写字母和特殊符号组成!', + title: '新密码由8位及以上数字、大小写字母和特殊符号组成!', icon: 'none' }) this.data.flag = false @@ -128,7 +140,7 @@ Page({ if(!e.detail.value.verifyPassword){ this.data.flag = false wx.showToast({ - title: '请输入确认新密码', + title: '请输入确认密码', icon: 'none' }) return @@ -136,7 +148,7 @@ Page({ let pattern = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,.\/]).{8,}$/ if(!pattern.test(e.detail.value.verifyPassword)){ wx.showToast({ - title: '确认新密码由8位数字、大小写字母和特殊符号组成!', + title: '确认密码由8位及以上数字、大小写字母和特殊符号组成!', icon: 'none' }) this.data.flag = false @@ -163,16 +175,22 @@ Page({ rsaPublicKey: this.data.rsaPublicKey } // 修改密码 - UserApi.updatePassword(params).then(res => { + UserApi.forgetPassword(params).then(res => { wx.showToast({ title: '加载中...', icon: 'loading' }) if (res.success) { - // 跳转登录页 - wx.redirectTo({ - url: '../login/login', + wx.showToast({ + title: '修改成功', + duration: 2000 }) + setTimeout(() => { + // 跳转登录页 + wx.redirectTo({ + url: '../login/login', + }) + }, 2000); } else { wx.showToast({ title: res.message, @@ -180,6 +198,12 @@ Page({ duration: 2000 }) } + }).catch(err => { + wx.showToast({ + title: err.message, + icon: 'none', + duration: 2000 + }) }) }, // 绑定微信 diff --git a/pages/forgetPassword/forgetPassword.wxml b/pages/forgetPassword/forgetPassword.wxml index 04fcf2e..5956659 100644 --- a/pages/forgetPassword/forgetPassword.wxml +++ b/pages/forgetPassword/forgetPassword.wxml @@ -17,13 +17,17 @@ 新密码 - + + + 确认密码 - + + + diff --git a/pages/forgetPassword/forgetPassword.wxss b/pages/forgetPassword/forgetPassword.wxss index 4f17b7e..57df52c 100644 --- a/pages/forgetPassword/forgetPassword.wxss +++ b/pages/forgetPassword/forgetPassword.wxss @@ -5,4 +5,15 @@ page { } .form-box{ transform: translateY(50%); +} +.text-value{ + position: relative; +} +.show{ + width: 15px; + height: 15px; + position: absolute; + right: 10px; + top: 8px; + z-index: 9; } \ No newline at end of file diff --git a/pages/login/login.js b/pages/login/login.js index 7e1c2f5..9fecdbd 100644 --- a/pages/login/login.js +++ b/pages/login/login.js @@ -118,6 +118,15 @@ Page({ }, // 登录 formSubmit(e) { + let pattern = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/ + if (!pattern.test(e.detail.value.phone)) { + wx.showToast({ + title: '请输入正确的手机号', + icon: 'none', + duration: 2000 + }) + return + } if (e.detail.value.phone && e.detail.value.captcha) { let params = { username: encrypt(this.data.rsaPublicKey,e.detail.value.phone), // 手机号加密 @@ -191,7 +200,9 @@ Page({ UserApi.wxBind(params).then(res=>{}) }) }, - + onLoad(){ + + }, /** * 生命周期函数--监听页面显示 */ @@ -205,6 +216,12 @@ Page({ key: 'rsaPublicKey', data: res.result }) + }else{ + wx.showToast({ + title: res.message, + icon: 'none', + duration: 2000 + }) } }).catch(err => { wx.showToast({ diff --git a/pages/login/login.wxss b/pages/login/login.wxss index 90abd73..11fbe39 100644 --- a/pages/login/login.wxss +++ b/pages/login/login.wxss @@ -4,7 +4,7 @@ page { color: #333; } .form-box{ - transform: translateY(50%); + transform: translateY(20%); } .forget{ color: #999; diff --git a/pages/phonePassword/phonePassword.js b/pages/phonePassword/phonePassword.js index 55d90fa..7068e1a 100644 --- a/pages/phonePassword/phonePassword.js +++ b/pages/phonePassword/phonePassword.js @@ -2,7 +2,6 @@ import UserApi from '../../assets/js/http/userApi' import { encrypt } from '../../assets/js/jsencrypt/rsa' import { wxBind } from '../../assets/js/common' -// var countdown = 60; // 倒计时秒数 Page({ @@ -11,7 +10,6 @@ Page({ */ data: { show: true, // 默认显示的是闭眼睛 - type: 'password', form: { currdatetime: '', requestCodeSuccess: true, @@ -21,17 +19,9 @@ Page({ flag: false }, showPassword(){ - if(this.data.show){ // 显示睁开眼睛的时候 type="text" - this.setData({ - type: 'text', - show: false - }) - }else{ - this.setData({ - type: 'password', - show: true - }) - } + this.setData({ + show: !this.data.show + }) }, back(){ wx.navigateBack({ @@ -64,7 +54,8 @@ Page({ this.data.flag = false wx.showToast({ title: '请输入手机号', - icon: 'none' + icon: 'none', + duration: 2000 }) return } else { @@ -72,7 +63,8 @@ Page({ if(!pattern.test(e.detail.value.phone)){ wx.showToast({ title: '请输入正确的手机号!', - icon: 'none' + icon: 'none', + duration: 2000 }) this.data.flag = false return @@ -84,34 +76,25 @@ Page({ this.data.flag = false wx.showToast({ title: '请输入密码', - icon: 'none' + icon: 'none', + duration: 2000 }) return } else { - let pattern = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,.\/]).{8,}$/ - if(!pattern.test(e.detail.value.password)){ - wx.showToast({ - title: '密码由8位数字、大小写字母和特殊符号组成!', - icon: 'none' - }) - this.data.flag = false - return - } else { - this.data.flag = true - } + this.data.flag = true } if(!e.detail.value.captcha){ this.data.flag = false wx.showToast({ title: '请输入验证码', - icon: 'none' + icon: 'none', + duration: 2000 }) return }else{ this.data.flag = true } console.log('form发生了submit事件,携带数据为:', e.detail.value) - // const time = new Date().getTime() let params = { username: encrypt(this.data.rsaPublicKey, e.detail.value.phone), password: encrypt(this.data.rsaPublicKey, e.detail.value.password), @@ -126,7 +109,7 @@ Page({ wx.showToast({ title: '首次登录请用验证码方式登录', icon: 'none', - duration: 2000 + duration: 3000 }) setTimeout(() => { wx.navigateBack() @@ -153,12 +136,16 @@ Page({ wx.showToast({ title: res.message, icon: 'none', - duration: 2000 + duration: 3000 }) this.handleChangeCheckCode() } - }).catch(err => { - wx.hideToast() + }).catch(err=>{ + wx.showToast({ + title: err.message, + icon: 'none', + duration: 3000 + }) }) } }, diff --git a/pages/phonePassword/phonePassword.wxml b/pages/phonePassword/phonePassword.wxml index ab3de1a..161c84e 100644 --- a/pages/phonePassword/phonePassword.wxml +++ b/pages/phonePassword/phonePassword.wxml @@ -10,7 +10,7 @@ 密码 - + diff --git a/pages/phonePassword/phonePassword.wxss b/pages/phonePassword/phonePassword.wxss index 7e71d14..7498aed 100644 --- a/pages/phonePassword/phonePassword.wxss +++ b/pages/phonePassword/phonePassword.wxss @@ -1,6 +1,6 @@ /* pages/meeting/meeting.wxss */ .form-box{ - transform: translateY(110pt); + transform: translateY(25%); } .text-label { diff --git a/pages/setPassword/setPassword.js b/pages/setPassword/setPassword.js index 958be81..4d2cf5d 100644 --- a/pages/setPassword/setPassword.js +++ b/pages/setPassword/setPassword.js @@ -13,35 +13,17 @@ Page({ rsaPublicKey: '', flag: false, show: true, // 默认显示的是闭眼睛 - showVerify: true, - type: 'password', - typeVerify: 'password' + showVerify: true }, showPassword(){ - if(this.data.show){ // 显示睁开眼睛的时候 type="text" - this.setData({ - type: 'text', - show: false - }) - }else{ - this.setData({ - type: 'password', - show: true - }) - } + this.setData({ + show: !this.data.show + }) }, showPasswordVerify(){ - if(this.data.showVerify){ // 显示睁开眼睛的时候 type="text" - this.setData({ - typeVerify: 'text', - showVerify: false - }) - }else{ - this.setData({ - typeVerify: 'password', - showVerify: true - }) - } + this.setData({ + showVerify: !this.data.showVerify + }) }, // 登录 formSubmit(e) { @@ -57,7 +39,7 @@ Page({ let pattern = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,.\/]).{8,}$/ if(!pattern.test(e.detail.value.newPassword)){ wx.showToast({ - title: '密码由8位数字、大小写字母和特殊符号组成!', + title: '密码由8位及以上数字、大小写字母和特殊符号组成!', icon: 'none' }) this.data.flag = false @@ -77,7 +59,7 @@ Page({ let pattern = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,.\/]).{8,}$/ if(!pattern.test(e.detail.value.verifyPassword)){ wx.showToast({ - title: '密码由8位数字、大小写字母和特殊符号组成!', + title: '密码由8位及以上数字、大小写字母和特殊符号组成!', icon: 'none' }) this.data.flag = false @@ -98,9 +80,9 @@ Page({ } if (this.data.flag) { let params = { - password: this.data.password, - newPassword: encrypt(this.data.rsaPublicKey, e.detail.value.newPassword), - verifyPassword: encrypt(this.data.rsaPublicKey, e.detail.value.verifyPassword), + password: this.data.password, // token + newPassword: encrypt(this.data.rsaPublicKey, e.detail.value.newPassword), // 密码 + verifyPassword: encrypt(this.data.rsaPublicKey, e.detail.value.verifyPassword), // 确认密码 rsaPublicKey: this.data.rsaPublicKey } // 请求短信登录start @@ -122,7 +104,7 @@ Page({ }) } else { wx.showToast({ - title: '登录失败', + title: res.message, icon: 'error', duration: 2000 }) diff --git a/pages/setPassword/setPassword.json b/pages/setPassword/setPassword.json index 4b49919..8835af0 100644 --- a/pages/setPassword/setPassword.json +++ b/pages/setPassword/setPassword.json @@ -1,4 +1,3 @@ { - "navigationBarTitleText": "设置密码", "usingComponents": {} } \ No newline at end of file diff --git a/pages/setPassword/setPassword.wxml b/pages/setPassword/setPassword.wxml index 63f0e2f..ad249d7 100644 --- a/pages/setPassword/setPassword.wxml +++ b/pages/setPassword/setPassword.wxml @@ -5,7 +5,7 @@ 密码 - + @@ -13,7 +13,7 @@ 确认密码 - + diff --git a/pages/setPassword/setPassword.wxss b/pages/setPassword/setPassword.wxss index f3b8ea4..9b476de 100644 --- a/pages/setPassword/setPassword.wxss +++ b/pages/setPassword/setPassword.wxss @@ -5,7 +5,7 @@ page { color: #333; } .form-box{ - transform: translateY(100%); + transform: translateY(20%); } .text-value{ position: relative; diff --git a/pages/upDateInfo/upDateInfo.js b/pages/upDateInfo/upDateInfo.js index 70029ff..2bf095c 100644 --- a/pages/upDateInfo/upDateInfo.js +++ b/pages/upDateInfo/upDateInfo.js @@ -16,50 +16,23 @@ Page({ rsaPublicKey: '', // 公钥 }, showOld: true, - typeOld: 'password', show: true, // 默认显示的是闭眼睛 showVerify: true, - type: 'password', - typeVerify: 'password' }, showPasswordOld(){ - if(this.data.showOld){ // 显示睁开眼睛的时候 type="text" - this.setData({ - typeOld: 'text', - showOld: false - }) - }else{ - this.setData({ - typeOld: 'password', - showOld: true - }) - } + this.setData({ + showOld: !this.data.showOld + }) }, showPassword(){ - if(this.data.show){ // 显示睁开眼睛的时候 type="text" - this.setData({ - type: 'text', - show: false - }) - }else{ - this.setData({ - type: 'password', - show: true - }) - } + this.setData({ + show: !this.data.show + }) }, showPasswordVerify(){ - if(this.data.showVerify){ // 显示睁开眼睛的时候 type="text" - this.setData({ - typeVerify: 'text', - showVerify: false - }) - }else{ - this.setData({ - typeVerify: 'password', - showVerify: true - }) - } + this.setData({ + showVerify: !this.data.showVerify + }) }, // 提交 formSubmit(e) { @@ -74,7 +47,7 @@ Page({ let pattern = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,.\/]).{8,}$/ if(!pattern.test(e.detail.value.oldpassword)){ wx.showToast({ - title: '旧密码由8位数字、大小写字母和特殊符号组成!', + title: '旧密码由8位及以上数字、大小写字母和特殊符号组成!', icon: 'none' }) this.data.flag = false @@ -94,7 +67,7 @@ Page({ let pattern = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,.\/]).{8,}$/ if(!pattern.test(e.detail.value.password)){ wx.showToast({ - title: '新密码由8位数字、大小写字母和特殊符号组成!', + title: '新密码由8位及以上数字、大小写字母和特殊符号组成!', icon: 'none' }) this.data.flag = false @@ -114,7 +87,7 @@ Page({ let pattern = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,.\/]).{8,}$/ if(!pattern.test(e.detail.value.confirmpassword)){ wx.showToast({ - title: '密码由8位数字、大小写字母和特殊符号组成!', + title: '确认新密码由8位及以上数字、大小写字母和特殊符号组成!!', icon: 'none' }) this.data.flag = false @@ -153,9 +126,19 @@ Page({ setTimeout(() => { wx.navigateBack() }, 2000); + }else{ + wx.showToast({ + title: res.message, + icon: 'none', + duration: 2000 + }) } - }).catch(err => { - wx.hideToast() + }).catch(err=>{ + wx.showToast({ + title: err.message, + icon: 'none', + duration: 2000 + }) }) } }, diff --git a/pages/upDateInfo/upDateInfo.wxml b/pages/upDateInfo/upDateInfo.wxml index 9d32d28..556715d 100644 --- a/pages/upDateInfo/upDateInfo.wxml +++ b/pages/upDateInfo/upDateInfo.wxml @@ -4,7 +4,7 @@ 旧密码 - + @@ -12,7 +12,7 @@ 新密码 - + @@ -20,13 +20,13 @@ 确认新密码 - + - + diff --git a/pages/upDateInfo/upDateInfo.wxss b/pages/upDateInfo/upDateInfo.wxss index ca0291b..0089c07 100644 --- a/pages/upDateInfo/upDateInfo.wxss +++ b/pages/upDateInfo/upDateInfo.wxss @@ -1,6 +1,6 @@ /* pages/meeting/meeting.wxss */ .form-box{ - transform: translateY(110pt); + transform: translateY(20%); } .text-label { width: 80px !important;