无感登录修改

This commit is contained in:
weiwei committed 2025-02-25 22:24:27 +08:00
1 parent 91ecc48fdd
commit 44627cdc55
5 files changed
+85 -63

No files matched your search

+20
View File
@@ -250,6 +250,26 @@ http.interceptors.response.use(
// 成功提示
responseHelpers.handleSuccessMessage(response)
if (isEmpty(uni.getStorageSync(TOKEN_KEY))) {
const params = new URL(window.location.href).searchParams
const token = params.get("uabaseToken")
if (token) {
try {
userApi.auth(token).then(async (res) => {
if (res?.code === 0) {
uni.setStorageSync(TOKEN_KEY, res.data)
const { data: userData } = await userApi.userInfo()
uni.setStorageSync(USER_INFO_KEY, userData)
} else {
uni.showToast({ title: "获取浙政钉用户信息失败", icon: "none" })
}
})
} catch (error) {
uni.showToast({ title: "错误", icon: "none" })
}
}
}
// 登录过期处理
if (response.data.code === 1) {
responseHelpers.handleLoginExpired()