修改登录bug
This commit is contained in:
@@ -177,7 +177,7 @@ const submitForm = async () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 提交数据
|
// 提交数据
|
||||||
uni.showLoading({ title: '提交中...' ,})
|
uni.showLoading({ title: '提交中...' ,mask:true})
|
||||||
try {
|
try {
|
||||||
// 先上传图片
|
// 先上传图片
|
||||||
const imageUrls = await uploadImages()
|
const imageUrls = await uploadImages()
|
||||||
|
|||||||
@@ -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 = () => {
|
const handleLogin = () => {
|
||||||
if (!phoneNumber.value) {
|
if (!phoneNumber.value) {
|
||||||
@@ -313,11 +254,6 @@ const handleLogin = () => {
|
|||||||
icon: 'error'
|
icon: 'error'
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// 模拟登录请求
|
|
||||||
// uni.showLoading({
|
|
||||||
// title: '登录中...'
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========== 生命周期 ==========
|
// ========== 生命周期 ==========
|
||||||
|
|||||||
Reference in New Issue
Block a user