diff --git a/pages/upload/upload.vue b/pages/upload/upload.vue index cca4188..c45849f 100644 --- a/pages/upload/upload.vue +++ b/pages/upload/upload.vue @@ -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 diff --git a/utils/api.js b/utils/api.js index 27df417..3df2b4e 100644 --- a/utils/api.js +++ b/utils/api.js @@ -150,8 +150,8 @@ 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('未登录')) { - throw new Error('NEED_LOGIN:PSI系统登录已过期,请在登录页重新登录') + if (errMsg.includes('401') || errMsg.includes('无效的认证令牌')) { + throw new Error('NEED_LOGIN:PSI系统登录已过期,请在登录页重新登录') } throw err })