Why does this code only report an error when the account is the same as the database, but not when the account is different?
submit() {
this.$refs.uLogin.validate().then(res => {
uni.$u.toast('正在登录')
this.isConfirm = false;
setTimeout(() => {
this.isConfirm = true
const db = wx.cloud.database()
let vm = this
db.collection('userAccounts').where({
user:vm.login.userInfo.user,
}).get({
success: function(res) {
if((res.data[0].password==vm.login.userInfo.password)&&(res.data[0].user==vm.login.userInfo.user)){
uni.$u.toast('欢迎回家!');
}else{
uni.$u.toast('账号或密码错误!');
}
}
})
// 这里此提示会被this.start()方法中的提示覆盖
// 通知验证码组件内部开始倒计时
}, 2000);
// this.isConfirm=false;
}).catch(errors => {
this.isConfirm = false;
setTimeout(() => {
this.isConfirm = true
// 这里此提示会被this.start()方法中的提示覆盖
uni.$u.toast('账号或密码错误');
// 通知验证码组件内部开始倒计时
}, 2000);
})
},
0 Answer
No answer yet
这家伙很懒,什么都没留下...