|
|
|
@ -49,7 +49,7 @@ const httpInterceptor = { |
|
|
|
if (token) { |
|
|
|
options.header.token = token |
|
|
|
} |
|
|
|
console.log("最终请求参数:",options) |
|
|
|
console.log("最终请求参数:", options) |
|
|
|
// 避免误用 Authorization 头,后端要求的是 token 头
|
|
|
|
// if (options.header.Authorization) delete options.header.Authorization
|
|
|
|
return options |
|
|
|
@ -75,10 +75,22 @@ export const http = (options) => { |
|
|
|
loginStore.setLoginInfo("false") |
|
|
|
console.log("2loginStore.loginInfo", loginStore.loginInfo); |
|
|
|
|
|
|
|
// uni.showToast({
|
|
|
|
// title: '请先登录',
|
|
|
|
// icon: 'none'
|
|
|
|
// })
|
|
|
|
|
|
|
|
} |
|
|
|
if (result.data.code === 400) { |
|
|
|
const userStore = useUserStore() |
|
|
|
userStore.clearUserInfo() |
|
|
|
uni.showModal({ |
|
|
|
title: "登录失效", |
|
|
|
content: "点击确定跳转登录页面", |
|
|
|
confirmText: "确定", |
|
|
|
cancelText: "取消", |
|
|
|
success: (res) => { |
|
|
|
uni.navigateTo({ |
|
|
|
url: '/pages/start/login/login' |
|
|
|
}) |
|
|
|
}, |
|
|
|
}); |
|
|
|
} |
|
|
|
resolve(result.data) |
|
|
|
} else if (result.statusCode === 401) { |
|
|
|
@ -87,7 +99,7 @@ export const http = (options) => { |
|
|
|
memberStore.clearUserInfo() |
|
|
|
// 提示用户重新登录
|
|
|
|
uni.navigateTo({ |
|
|
|
url: '/pages/login/login' |
|
|
|
url: '/pages/start/login/login' |
|
|
|
}) |
|
|
|
reject(result) |
|
|
|
} else { |
|
|
|
|