修复登陆问题
This commit is contained in:
@@ -120,7 +120,23 @@ class HttpService {
|
||||
|
||||
// 业务状态码检查
|
||||
if (data && typeof data === 'object') {
|
||||
if (data.success === false || (data.code && data.code !== 0 && data.code !== 200)) {
|
||||
|
||||
if (data.message === "用户不存在" || data.code === -2) {
|
||||
tokenManager.clearTokens()
|
||||
Taro.showToast({
|
||||
title: '登录已过期,请重新登录',
|
||||
icon: 'none'
|
||||
})
|
||||
Taro.reLaunch({
|
||||
url: '/pages/login/index'
|
||||
})
|
||||
reject(new Error('用户不存在'))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ((data.code && data.code !== 0)) {
|
||||
if (showToast) {
|
||||
this.handleBusinessError(data)
|
||||
reject(new Error(data.message || '请求失败'))
|
||||
@@ -131,6 +147,8 @@ class HttpService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
resolve(data)
|
||||
})
|
||||
}
|
||||
@@ -201,19 +219,6 @@ class HttpService {
|
||||
|
||||
let fullUrl = this.buildUrl(url, method === 'GET' ? params : undefined)
|
||||
|
||||
|
||||
// 后门id,用于调试
|
||||
let userid = this.getHashParam("userIdTest")
|
||||
if (userid) {
|
||||
if (fullUrl.indexOf("?") > -1) {
|
||||
fullUrl += `&userIdTest45=${userid}`
|
||||
}
|
||||
else {
|
||||
fullUrl += `?userIdTest45=${userid}`
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.log('info', `发起请求: ${method} ${fullUrl}`, {
|
||||
data: method !== 'GET' ? data : undefined,
|
||||
params: method === 'GET' ? params : undefined
|
||||
|
||||
Reference in New Issue
Block a user