修改登录bug
This commit is contained in:
@@ -182,65 +182,6 @@ const getVerifyCode = () => {
|
||||
})
|
||||
}
|
||||
|
||||
// 登录处理
|
||||
const handleLogin = () => {
|
||||
if (!canLogin.value) return
|
||||
uni.showLoading({
|
||||
title: '登录中...',
|
||||
mask: true
|
||||
})
|
||||
let params = {
|
||||
phone: phoneNumber.value,
|
||||
smsCode: verifyCode.value,
|
||||
scene: 'butler_login'
|
||||
}
|
||||
getLoginBySms(params)
|
||||
.then(res => {
|
||||
if (res.code === 200) {
|
||||
if (res.data) {
|
||||
uni.setStorageSync('token', res.data.token)
|
||||
// 存用户ID
|
||||
if (res.data.userId) {
|
||||
uni.setStorageSync('userId', res.data.userId)
|
||||
}
|
||||
// 存当前绑定的小区ID,0 表示未绑定
|
||||
const currentVillageId = res.data.currentVillageId || 0
|
||||
uni.setStorageSync('currentVillageId', currentVillageId)
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '登录成功',
|
||||
icon: 'success'
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
}, 1500)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '登录失败',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '登录失败',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
uni.showToast({
|
||||
title: err.msg,
|
||||
icon: 'error'
|
||||
})
|
||||
})
|
||||
// 模拟登录请求
|
||||
// uni.showLoading({
|
||||
// title: '登录中...'
|
||||
// });
|
||||
}
|
||||
|
||||
// 登录处理
|
||||
const handleLogin = () => {
|
||||
if (!phoneNumber.value) {
|
||||
@@ -313,11 +254,6 @@ const handleLogin = () => {
|
||||
icon: 'error'
|
||||
})
|
||||
})
|
||||
|
||||
// 模拟登录请求
|
||||
// uni.showLoading({
|
||||
// title: '登录中...'
|
||||
// });
|
||||
}
|
||||
|
||||
// ========== 生命周期 ==========
|
||||
|
||||
Reference in New Issue
Block a user