This commit is contained in:
hongchao 2025-06-21 13:30:32 +08:00
commit 7bb2215aaf
1 changed files with 13 additions and 4 deletions

View File

@ -10,7 +10,7 @@ const ENV = process.env.NODE_ENV
// export const baseURL = ENV === 'development' ? 'http://sgwpdm.ah.sgcc.com.cn/iws/jiju-api/' : 'http://sgwpdm.ah.sgcc.com.cn/iws/jiju-api/'//生产
export const baseURL = ENV === 'development' ? '/api' : '/iws/jiju-api'; // 宏源服务
// export const baseURL = ENV === 'development' ? 'http://192.168.0.234:18080' : '***'
// export const baseURL = ENV === 'development' ? 'http://192.168.1.244:18080' : 'http://192.168.1.244:18080'//马
// export const baseURL = ENV === 'development' ? 'http://192.168.0.96:18080' : 'http://192.168.1.244:18080'//马
// export const baseURL = ENV === 'development' ? '/api' : '***'
// **********OCR识别为NVUE文件页面请求URL需要同步配置**********
@ -72,15 +72,24 @@ export const http = (options) => {
const memberStore = useMemberStore()
memberStore.clearUserInfo()
memberStore.clearToken()
uni.navigateTo({
url: '/pages/login/index',
})
const pages = getCurrentPages()
const currentPage = pages[pages.length - 1]
if (!currentPage.route.includes('login')) {
uni.reLaunch({
url: '/pages/login/index',
})
}
reject(res)
} else if (res.data.code === 500) {
uni.showToast({
icon: 'none',
title: `${res.data.msg}`,
})
} else {
uni.showToast({
icon: 'none',
title: `${res.data.msg}` || '请求失败',
})
}
} else if (res.statusCode === 401) {
// 2. 401 表示token过期 去往登录页重新登录