优化登录提示语,优化request错误返回提示语
This commit is contained in:
@@ -55,7 +55,6 @@
|
||||
<!-- 登录按钮 -->
|
||||
<button
|
||||
class="login-btn"
|
||||
:disabled="!canLogin"
|
||||
@click="handleLogin"
|
||||
>
|
||||
登录
|
||||
@@ -109,30 +108,37 @@ onLoad(() =>{
|
||||
|
||||
// 登录逻辑
|
||||
const handleLogin = () => {
|
||||
// if (!canLogin.value) {
|
||||
// uni.showToast({ title: '请输入账号和密码', icon: 'none' });
|
||||
// return
|
||||
// }
|
||||
|
||||
if (!phoneNumber.value) {
|
||||
uni.showToast({ title: '请输入账号', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (phoneNumber.value.length < 4 || phoneNumber.value.length > 16) {
|
||||
uni.showToast({ title: '账号长度需为 4-16 位', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (!password.value) {
|
||||
uni.showToast({ title: '请输入密码', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (password.value.length < 6) {
|
||||
uni.showToast({ title: '密码至少输入 6 位', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (password.value.length > 16) {
|
||||
uni.showToast({ title: '密码不能超过 16 位', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if(!agreeAgreement.value){
|
||||
uni.showToast({ title: '请勾选协议', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
// uni.showLoading({ title: '登录中...', mask: true });
|
||||
uni.showLoading({ title: '登录中...', mask: true });
|
||||
let params = {
|
||||
username:phoneNumber.value,
|
||||
password:password.value
|
||||
}
|
||||
getLoginPassword(params).then(res =>{
|
||||
// console.log('33333',res)
|
||||
if(res.code === 200){
|
||||
uni.setStorageSync('token', res.data.token);
|
||||
// 存用户ID
|
||||
@@ -160,16 +166,6 @@ const handleLogin = () => {
|
||||
});
|
||||
})
|
||||
|
||||
// 测试
|
||||
// uni.showLoading({
|
||||
// title: '登录中...',
|
||||
// mask:true
|
||||
// });
|
||||
// setTimeout(() => {
|
||||
// uni.switchTab({ url: '/pages/index/index' });
|
||||
// }, 1500);
|
||||
// uni.hideLoading()
|
||||
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user