This commit is contained in:
weiwei committed 2025-02-24 10:00:04 +08:00
1 parent cf26471d9a
commit 3e476dc83f
1 file changed
+20 -20
+20 -20
View File
@@ -127,29 +127,29 @@ const doLogin = async (loginType: number, token: string, accountId: string | nul
// authData = response.data
break
case 2:
if (isEmpty(tokenStorage) || isEmpty(userStorage)) {
try {
uni.showLoading({
title: "登录中...",
mask: true,
})
const res = await userApi.auth(token)
if (res?.code === 0) {
uni.setStorageSync(tokenKey, res.data)
uni.hideLoading()
uni.showToast({ title: "登录成功", icon: "none" })
const { data: userData } = await userApi.userInfo()
uni.setStorageSync(userInfoKey, userData)
getStorageUserInfo()
} else {
uni.hideLoading()
uni.showToast({ title: "获取浙政钉用户信息失败", icon: "none" })
}
} catch (error) {
// if (isEmpty(tokenStorage) || isEmpty(userStorage)) {
try {
uni.showLoading({
title: "登录中...",
mask: true,
})
const res = await userApi.auth(token)
if (res?.code === 0) {
uni.setStorageSync(tokenKey, res.data)
uni.hideLoading()
uni.showToast({ title: "错误", icon: "none" })
uni.showToast({ title: "登录成功", icon: "none" })
const { data: userData } = await userApi.userInfo()
uni.setStorageSync(userInfoKey, userData)
getStorageUserInfo()
} else {
uni.hideLoading()
uni.showToast({ title: "获取浙政钉用户信息失败", icon: "none" })
}
} catch (error) {
uni.hideLoading()
uni.showToast({ title: "错误", icon: "none" })
}
// }
break
default:
uni.showToast({ title: "当前登录环境未知", icon: "none" })