bug修改

This commit is contained in:
姚亚男
2021-10-22 18:03:14 +08:00
parent dcc0e8b1fa
commit c15d7ca29b
16 changed files with 137 additions and 128 deletions
+2
View File
@@ -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),
// 图片验证码
+32 -8
View File
@@ -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
})
})
},
// 绑定微信
+6 -2
View File
@@ -17,13 +17,17 @@
<view class="form-item">
<view class="text-label">新密码</view>
<view class="text-value">
<input name="password" type="password" value="{{password}}" placeholder="请输入新密码" />
<input name="password" value="{{password}}" password="{{show}}" placeholder="请输入新密码" />
<image src="../../assets/images/show.png" class="show" wx:if="{{!show}}" bindtap="showPassword"></image>
<image src="../../assets/images/none.png" class="show" wx:if="{{show}}" bindtap="showPassword"></image>
</view>
</view>
<view class="form-item">
<view class="text-label">确认密码</view>
<view class="text-value">
<input name="verifyPassword" type="password" value="{{verifyPassword}}" placeholder="请输入确认密码" />
<input name="verifyPassword" bindblur="bindBlurInput" value="{{verifyPassword}}" password="{{showVerify}}" placeholder="请输入确认密码" />
<image src="../../assets/images/show.png" class="show" wx:if="{{!showVerify}}" bindtap="showPasswordVerify"></image>
<image src="../../assets/images/none.png" class="show" wx:if="{{showVerify}}" bindtap="showPasswordVerify"></image>
</view>
</view>
<view class="btn-area">
+11
View File
@@ -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;
}
+18 -1
View File
@@ -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({
+1 -1
View File
@@ -4,7 +4,7 @@ page {
color: #333;
}
.form-box{
transform: translateY(50%);
transform: translateY(20%);
}
.forget{
color: #999;
+20 -33
View File
@@ -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
})
})
}
},
+1 -1
View File
@@ -10,7 +10,7 @@
<view class="form-item">
<view class="text-label">密码</view>
<view class="text-value">
<input name="password" value="{{password}}" type="{{type}}" placeholder="请输入密码" />
<input name="password" value="{{password}}" password="{{show}}" placeholder="请输入密码" />
<image src="../../assets/images/show.png" class="show" wx:if="{{!show}}" bindtap="showPassword"></image>
<image src="../../assets/images/none.png" class="show" wx:if="{{show}}" bindtap="showPassword"></image>
</view>
+1 -1
View File
@@ -1,6 +1,6 @@
/* pages/meeting/meeting.wxss */
.form-box{
transform: translateY(110pt);
transform: translateY(25%);
}
.text-label {
+13 -31
View File
@@ -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
})
-1
View File
@@ -1,4 +1,3 @@
{
"navigationBarTitleText": "设置密码",
"usingComponents": {}
}
+2 -2
View File
@@ -5,7 +5,7 @@
<view class="form-item">
<view class="text-label">密码</view>
<view class="text-value">
<input name="newPassword" bindblur="bindBlurInput" value="{{newPassword}}" type="{{type}}" placeholder="请输入密码" />
<input name="newPassword" bindblur="bindBlurInput" value="{{newPassword}}" password="{{show}}" placeholder="请输入密码" />
<image src="../../assets/images/show.png" class="show" wx:if="{{!show}}" bindtap="showPassword"></image>
<image src="../../assets/images/none.png" class="show" wx:if="{{show}}" bindtap="showPassword"></image>
</view>
@@ -13,7 +13,7 @@
<view class="form-item">
<view class="text-label">确认密码</view>
<view class="text-value">
<input name="verifyPassword" bindblur="bindBlurInput" value="{{verifyPassword}}" type="{{typeVerify}}" placeholder="请确认密码" />
<input name="verifyPassword" bindblur="bindBlurInput" value="{{verifyPassword}}" password="{{showVerify}}" placeholder="请输入确认密码" />
<image src="../../assets/images/show.png" class="show" wx:if="{{!showVerify}}" bindtap="showPasswordVerify"></image>
<image src="../../assets/images/none.png" class="show" wx:if="{{showVerify}}" bindtap="showPasswordVerify"></image>
</view>
+1 -1
View File
@@ -5,7 +5,7 @@ page {
color: #333;
}
.form-box{
transform: translateY(100%);
transform: translateY(20%);
}
.text-value{
position: relative;
+24 -41
View File
@@ -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
})
})
}
},
+4 -4
View File
@@ -4,7 +4,7 @@
<view class="form-item">
<view class="text-label">旧密码</view>
<view class="text-value">
<input name="oldpassword" value="{{oldpassword}}" type="{{typeOld}}" placeholder="请输入旧密码" />
<input name="oldpassword" value="{{oldpassword}}" password="{{showOld}}" placeholder="请输入旧密码" />
<image src="../../assets/images/show.png" class="show" wx:if="{{!showOld}}" bindtap="showPasswordOld"></image>
<image src="../../assets/images/none.png" class="show" wx:if="{{showOld}}" bindtap="showPasswordOld"></image>
</view>
@@ -12,7 +12,7 @@
<view class="form-item">
<view class="text-label">新密码</view>
<view class="text-value">
<input name="password" value="{{password}}" type="{{type}}" placeholder="请输入新密码" />
<input name="password" value="{{password}}" password="{{show}}" placeholder="请输入新密码" />
<image src="../../assets/images/show.png" class="show" wx:if="{{!show}}" bindtap="showPassword"></image>
<image src="../../assets/images/none.png" class="show" wx:if="{{show}}" bindtap="showPassword"></image>
</view>
@@ -20,13 +20,13 @@
<view class="form-item">
<view class="text-label">确认新密码</view>
<view class="text-value">
<input name="confirmpassword" value="{{confirmpassword}}" type="{{typeVerify}}" placeholder="请确认新密码" />
<input name="confirmpassword" value="{{confirmpassword}}" password="{{showVerify}}" placeholder="请输入确认新密码" />
<image src="../../assets/images/show.png" class="show" wx:if="{{!showVerify}}" bindtap="showPasswordVerify"></image>
<image src="../../assets/images/none.png" class="show" wx:if="{{showVerify}}" bindtap="showPasswordVerify"></image>
</view>
</view>
<view class="btn-area">
<button type="primary" formType="submit">登录</button>
<button type="primary" formType="submit">确定</button>
</view>
</form>
</view>
+1 -1
View File
@@ -1,6 +1,6 @@
/* pages/meeting/meeting.wxss */
.form-box{
transform: translateY(110pt);
transform: translateY(20%);
}
.text-label {
width: 80px !important;