美化了样式
This commit is contained in:
@ -25,7 +25,7 @@ const formatPassword = (pwd , currentPwd) => {
|
||||
if (pwd.length < 6 || pwd.length > 10) {
|
||||
wx.showToast({
|
||||
title: '密码长度必须在6-10位',
|
||||
icon: 'error'
|
||||
icon: 'none'
|
||||
})
|
||||
return false;
|
||||
}
|
||||
@ -44,19 +44,38 @@ const formatPassword = (pwd , currentPwd) => {
|
||||
return false;
|
||||
}
|
||||
// 纪文昊写的 密码必须包含字母和数字
|
||||
const hasLetter = /[a-zA-z]/.test(pwd);
|
||||
const hasNumber = /[0-9]/.test(pwd);
|
||||
if (!hasLetter || !hasNumber) {
|
||||
const isValid = /^[A-Za-z0-9]+$/.test(pwd); // 只能是数字和字母
|
||||
if (!isValid) {
|
||||
wx.showToast({
|
||||
title: '密码必须包含字母和数字',
|
||||
title: '密码只能包含字母和数字',
|
||||
icon: 'none'
|
||||
})
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
const notLogin = (msg) => {
|
||||
if (msg === '无权限' || msg === 'token为空' || msg === 'token已过期' || msg === '用户不存在') {
|
||||
wx.showToast({
|
||||
title: '未登录',
|
||||
icon: 'none'
|
||||
})
|
||||
setTimeout(() => {
|
||||
wx.redirectTo({
|
||||
url: '/pages/welcome/homePage/homePage',
|
||||
})
|
||||
}, 1000)
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: msg,
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
formatTime,
|
||||
formatPassword
|
||||
formatPassword,
|
||||
notLogin
|
||||
}
|
||||
|
Reference in New Issue
Block a user