fix:token从storage读取+NEED_LOGIN弹窗增加去登录按钮
This commit is contained in:
parent
ac471925ef
commit
8cc51e3f20
@ -1402,11 +1402,16 @@ export default {
|
||||
console.error('加载仓库失败:', e)
|
||||
const errMsg = e.message || String(e)
|
||||
if (errMsg.includes('NEED_LOGIN')) {
|
||||
const displayMsg = errMsg.replace('NEED_LOGIN:', '')
|
||||
uni.showModal({
|
||||
title: '系统提示',
|
||||
content: displayMsg,
|
||||
showCancel: false
|
||||
content: 'PSI系统登录已过期,请重新登录',
|
||||
confirmText: '去登录',
|
||||
cancelText: '取消',
|
||||
success: (modalRes) => {
|
||||
if (modalRes.confirm) {
|
||||
uni.navigateTo({ url: '/pages/login/login' })
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
} finally {
|
||||
@ -1464,11 +1469,16 @@ export default {
|
||||
console.error('加载货位失败:', e)
|
||||
const errMsg = e.message || String(e)
|
||||
if (errMsg.includes('NEED_LOGIN')) {
|
||||
const displayMsg = errMsg.replace('NEED_LOGIN:', '')
|
||||
uni.showModal({
|
||||
title: '系统提示',
|
||||
content: displayMsg,
|
||||
showCancel: false
|
||||
content: 'PSI系统登录已过期,请重新登录',
|
||||
confirmText: '去登录',
|
||||
cancelText: '取消',
|
||||
success: (modalRes) => {
|
||||
if (modalRes.confirm) {
|
||||
uni.navigateTo({ url: '/pages/login/login' })
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
this.popupLocationList = this.popupAllLocationList
|
||||
|
||||
@ -150,7 +150,7 @@ function requestWithRetry(requestFn, apiName) {
|
||||
return requestFn(getAuthToken()).catch((err) => {
|
||||
const errMsg = err.message || String(err)
|
||||
console.error(`【${apiName}】请求失败:`, errMsg)
|
||||
if (errMsg.includes('401') || errMsg.includes('无效的认证令牌') || errMsg.includes('未登录')) {
|
||||
if (errMsg.includes('401') || errMsg.includes('无效的认证令牌')) {
|
||||
throw new Error('NEED_LOGIN:PSI系统登录已过期,请在登录页重新登录')
|
||||
}
|
||||
throw err
|
||||
|
||||
Loading…
Reference in New Issue
Block a user